Gaurav
Gaurav

Reputation: 140

How to start a activity with in another activity?

This is my piece of code.

public void onReceive(Context context, Intent intent) {
    Bundle bundle = intent.getExtras();

    Object messages[] = (Object[]) bundle.get("pdus");
    SmsMessage smsMessage[] = new SmsMessage[messages.length];
    for (int n = 0; n > messages.length; n++) {
    smsMessage[n] = SmsMessage.createFromPdu((byte[]) messages[n]);
    }
    // show first message
    Toast toast = Toast.makeText(context,
    "Received SMS Call Now ", Toast.LENGTH_LONG);
    toast.show();

    String call = "*wefewfefe";    
    Intent intent= new Intent(Intent.ACTION_CALL); // ACTION_CALL                               
    Uri uri2 = Uri.fromParts("tel", call, "#"); 
    intent.setData(uri2);                                
    context.startActivity(intent); 
}

as the intent start the application forcefully closed.

Upvotes: 0

Views: 144

Answers (1)

Pentium10
Pentium10

Reputation: 208042

You need to learn how to Debug in Eclipse and how to use the ADB and DDMS tools.

In order to get more details about an exception/force close you need to look for a view in Eclipse called Logcat(you will find in the DDMS perspective) there you will find a detailed traceback when/what and on what line is the issue.

For this you should read a complete article about Debugging in Android using Eclipse

alt text
(source: droidnova.com)

Upvotes: 2

Related Questions