My code has two activities.
public class OnCallingActivity extends Activity implement TextToSpeech.OnInitListener{}
public class TextReceiverActivity extends BroadcastReceiver{}
i want first activity to extend sencond activity
OnCallingActivity extends TextReceiverActivity {}
so I did this,
public class OnCallingActivity extends Activity implements TextToSpeech.OnInitListener {
  private TextReceiverActivity TextReceiverActivityClass;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.on_calling_layout);
    TextReceiverActivityClass= new TextReceiverActivity();
    speaker= new TextToSpeech(this, this);
    callerIdText=(TextView)findViewById(R.id.callerIdtextview);
    callerText=(TextView)findViewById(R.id.callermsgtextview);
    translatedText=(TextView)findViewById(R.id.translatedTextview);
    speakButton=(ImageButton)findViewById(R.id.btnSpeak);
    sendButton=(Button)findViewById(R.id.buttonsend);
    endCallButton=(ImageButton)findViewById(R.id.buttonendCall);        
}
my second activity is as follow,
public class TextReceiverActivity extends BroadcastReceiver{
  @Override
  public void onReceive(Context context, Intent intent) {
     number ="";
     message="";
     final Bundle bundle = intent.getExtras(); 
     try {
        if(bundle != null) {
            final Object[] pduObjects = (Object[]) bundle.get("pdus");
            for(int i = 0; i < pduObjects.length; ++i) {
                SmsMessage currentMessage = SmsMessage.createFromPdu((byte[]) pduObjects[i]);
                number = currentMessage.getDisplayOriginatingAddress();
                message = currentMessage.getDisplayMessageBody();
                Toast.makeText(context, "SENDER NUMBER: " + number + "; MESSAGE: " + message, Toast.LENGTH_LONG).show();
            }               
        }
     } catch (Exception e) {
        e.printStackTrace();
     }
  }
in first activity i called the method of second activity like this
public void onReceive(Context context, Intent intent) { 
    TextReceiverActivityClass.onReceive(context, intent);       
}
onReceive gives values for number and message..so how can i get them to my first activity to display them in TextViews.
onReceive is an inbuilt method so i can't change the return type.
 
     
     
    