• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps How to create a sub-activity

If you mean, how to make a new .java file with the other .java files in your package, here goes:
- Right click the package where you want the .java file to be stored
- Click New
- Click Class
- And in the Name field, put in the name of the class
 
Thanks for reply. I used this procedure to create a main java file and other two class in the same package. In mail java class i have two calls of Intent to revoke the other two class. The compile is correct and load the apk activity is success. But when I try open the application in emulator, it display the application is stopped unexpectedly.

I don't know what is the reason for this issue. Could you please give me hints.

Thanks
 
We need to see the exception thrown in logcat and the code which generates the exception.

- Open logcat: Window > Show view > Other, Android > Logcat
- Start app in emulator
- Take picture/screenshot/whatever of the exception thrown in logcat from the app
 
We need to see the exception thrown in logcat and the code which generates the exception.

- Open logcat: Window > Show view > Other, Android > Logcat
- Start app in emulator
- Take picture/screenshot/whatever of the exception thrown in logcat from the app


The screenshot jpeg is not visible on reply
 
Please see the attached jpeg file for exceptions I grabbed
The code of creating these exceptions are following:

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TabHost;

public class IntentTabsdemo extends TabActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TabHost host=getTabHost();
host.addTab(host.newTabSpec("one").setIndicator("CW").setContent(new Intent(this, CWBrowser.class)));
host.addTab(host.newTabSpec("two").setIndicator("Android").setContent(new Intent(this, AndroidBrowser.class)));
}
}

Thank you for your reply
 

Attachments

  • Android Exception0314.JPG
    Android Exception0314.JPG
    276.4 KB · Views: 136
It says the problem is on line 14 and it cant find the activity. Have you added all activities to AndroidManifes.xml?
 
#( Also my first thought... All activities that are used by your app have to be registered in the Manifest.xml fil!!!

Like this:

Code:
<activity
	  android:name=".ActivityClassName"
	  android:label="@string/activities_header"
/>
 
Back
Top Bottom