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

Apps the application *** has stopped unexpectedly. Please try again

cb03

Lurker
hi everybody.
I'm writing a program based on the example on web. It's ok but when i run it, there is a dialog show"the application Hello Tab widget(process.com.goolke.packagea) has stopped unexpectedly. Please try again"
I don't know why.
Help me, please!!
 
Here's the example I wrote. I try to debug it but I don't really understand that message. Could u see the code and help me a little???????????
~thanks so much~
 

Attachments

You made a couple of mistakes when copying this example from the Android site:

Tab Layout | Android Developers

1. You need to place the drawable (pictures + xml) resources in the res/drawable/ directory instead of res/drawable-hdpi/ directory.
2. The xml files you created (ic_tab_artists.xml, etc.) have an extra <resources> + </resources> XML tag pair. You should remove these tags from all three ic_tab_* files.
3. You need to update your Android manifest to define activities for ArtistsActivity, AlbumsActivity & SongsActivity (I think this step is not obvious from the web page).
 
There're 2 activities in the example below. But I just see an activity is defined in the Android manifest????? So I did the same with the example above( didn't defined 3 activities in the android manifest)
Could u explain more for me?????
 

Attachments

I attached a working version of the sample you are building.

The code written inside of onCreate instantiates three Intent objects. In order for these objects to work properly the Android Manifest needs define an Activity in the Android manifest in order to launch the appropriate code when you click on a Tab.

Every Android manifest has at least one Activity definition - i.e. the one that is executed when the application launches. Typically, if your class extends Activity or some child class of Activity, then you will want to include information about this class in your Android activity.

You can read more about Activities on the Android developer website:
Activity | Android Developers
 

Attachments

1) I created new drawable folder and copied all images and xml file in it
2) Update the manifest xml file as shown below

and it works

Cheers guys :)



<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.hellotabwidget" android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="9" />

<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".AlbumsActivity" android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
</activity>
<activity android:name=".ArtistsActivity" android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
</activity>
<activity android:name=".SongsActivity" android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
</activity>


<activity android:name=".HelloTabWidget" android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</application>
</manifest>
 
it should be like this... for abow zip file

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.googke.packagea"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".HelloTabWidget" android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity android:name="ArtistsActivity" android:theme="@android:style/Theme.NoTitleBar" android:label="artists"></activity>
<activity android:name="AlbumsActivity" android:theme="@android:style/Theme.NoTitleBar" android:label="albums"></activity>
<activity android:theme="@android:style/Theme.NoTitleBar" android:name="SongsActivity" android:label="songs"></activity>
</application>
<uses-sdk android:minSdkVersion="7" />

</manifest>
1) I created new drawable folder and copied all images and xml file in it
2) Update the manifest xml file as shown below

and it works

Cheers guys :)



<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.hellotabwidget" android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="9" />

<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".AlbumsActivity" android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
</activity>
<activity android:name=".ArtistsActivity" android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
</activity>
<activity android:name=".SongsActivity" android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
</activity>


<activity android:name=".HelloTabWidget" android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</application>
</manifest>
 
hey, i've got the same problem,
I checked all my files and compared them to the working version of disco6stu9
and i haven't found any differences, except for var names

please check my file and help me if u can, i'm already despaired of it

Edit: Found the problem by myself. I had a 7 where a / should have been
 

Attachments

Hope below could be a possible solution for the problem.


Check the VM size of the Emulator so that its good enough to run your app in its VM. Check the Size of your . Keep it in min sized so that Emulator will not find any difficulties in executing your app..


Cheers,

Rajesh Vaddi
 
Back
Top Bottom