Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does the up button cause an exception in the 'Building Your First App' Android training

Tags:

android

I had done all of the steps on the last part (Starting Another Activity) and it does display the message on the second activity but when I click the up button it throws the exception below, I've included the whole error section from the LogCat window.

I've tried searching online for 'bad parentActivityName' or 'does not have a parent activity name specified' but I couldn't find any clear information or anything related to the training.

E/Activity(17099): getParentActivityIntent: bad parentActivityName 'com.example.myfirstapp.MainActivity' in manifest
E/NavUtils(17099): getParentActivityIntent: bad parentActivityName 'com.example.myfirstapp.MainActivity' in manifest
D/AndroidRuntime(17099): Shutting down VM
E/AndroidRuntime(17099): FATAL EXCEPTION: main
E/AndroidRuntime(17099): java.lang.IllegalArgumentException: Activity DisplayMessageActivity 
    does not have a parent activity name specified. (Did you forget to add the 
    android.support.PARENT_ACTIVITY <meta-data>  element in your manifest?)

E/AndroidRuntime(17099):    at android.support.v4.app.NavUtils.navigateUpFromSameTask(NavUtils.java:177)
E/AndroidRuntime(17099):    at com.example.myfirstname.DisplayMessageActivity.onOptionsItemSelected(DisplayMessageActivity.java:55)
E/AndroidRuntime(17099):    at android.app.Activity.onMenuItemSelected(Activity.java:2548)
E/AndroidRuntime(17099):    at com.android.internal.widget.ActionBarView$3.onClick(ActionBarView.java:167)
E/AndroidRuntime(17099):    at android.view.View.performClick(View.java:4204)
E/AndroidRuntime(17099):    at android.view.View$PerformClick.run(View.java:17355)
E/AndroidRuntime(17099):    at android.os.Handler.handleCallback(Handler.java:725)
E/AndroidRuntime(17099):    at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime(17099):    at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(17099):    at android.app.ActivityThread.main(ActivityThread.java:5041)
E/AndroidRuntime(17099):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(17099):    at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(17099):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/AndroidRuntime(17099):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/AndroidRuntime(17099):    at dalvik.system.NativeStart.main(Native Method)
like image 955
Kioshiki Avatar asked May 01 '13 19:05

Kioshiki


1 Answers

I have the same problem. My problem was singly different. I specified ParentActivity with no full namespace in AndroidStudio IDE dialog. Naturally AndroidStudio generated a section in AndroidManifest.xml with no fully specified Class. I changed it manually by specifying full namespace in xml tag

<meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="____._____.MainActivity"/>
</activity>
like image 80
alpyapple Avatar answered Sep 27 '22 20:09

alpyapple