I have a simple app with a set of preferences for the user to select.  I 
have the preferences menu (using Preference fragments) that works, however, 
what is the preferred method of providing navigation back to the app if 
there are no physical buttons on the device.
 
I have added a "Return to Game" header, however, I'm now at a loss on how 
to configure the intent to pop the preference menu off the stack and 
therefore return to the game.
 
If I am headed in the wrong direction, please point me in the right one.
 
Using the below code the Preference appears in my settings menu, however, 
when I click on the return to game preference (and thus starting the 
intent) I get the following error in the debugger:
 
android.content.ActivityNotFoundException: No Activity found to handle 
Intent { act=com.mycompany.myApp.PrefsActivity.GoBack }
 
Below is the code parts that I think will help you understand what I am up 
to:
 
manifest
~~~~~~~
...
<activity 
     android:name=".PrefsActivity" 
     android:label="Preferences" 
     android:enabled="true" > 
     <intent-filter> 
         <category android:name="android.intent.category.DEFAULT" />  
         <action android:name="com.mycompany.myapp.PrefsActivity.GoBack"/> 
     </intent-filter> 
</activity>

...

pref_headers.xml
~~~~~~~~~~~~~
<preference-headers 
xmlns:android="http://schemas.android.com/apk/res/android"; >
...

<header android:title="Go Back" android:summary="Return to Bonk! Bonk!"  
android:id="@+id/go_back"> 
     <intent 
           android:action="com.mycompany.myApp.PrefsActivity.GoBack" 
           android:targetClass="com.mycmopany.myApp.PrefsActivity"/>
</header> 
</preference-headers>
 
PrefsActivity extends PreferenceActivity
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

public void GoBackOneLevel() 
{ 
Log.i("PREFERENCES", "Return to game button pressed!"); 
Context context = (PrefsActivity)
this.getBaseContext(); 
Toast.makeText(context, "I've been clicked!", Toast.LENGTH_SHORT).show(); 
}
 
 
 Thanks in advance for your help... and your patience!
 
B.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to