I have defined my settings.xml file to include an item that uses
android:action item in the setting dialog. See the sample code for
that activity below.
It all works fine. However this thing is "overlaying" my entire
activity and when user presses back button my entire application
finishes. Is there a way to launch a "Fragment" using android:action
in settings.xml or how I can restructure my activity so when that
activity finishes my main activity is resumed?
<PreferenceScreen>
<Preference android:title="Current User" >
<intent android:action="com.example.coreui.ShowCurrentUserActivity"
/>
</Preference>
</PreferenceScreen>
here is the activity code
public class ShowCurrentUserActivity extends Activity {
public AlertDialog dialog = null;
@Override
public void onCreate(Bundle savedInstanceState) {
String msgStr;
super.onCreate(savedInstanceState);
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setPositiveButton("Logout",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
ShowCurrentUserActivity.this.finish();
}
});
alert.setNegativeButton("Dismiss",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
ShowCurrentUserActivity.this.finish();
}
});
}
}
This is how I specify activity in my AndroidManifest.xml
<activity
android:name="com.example.coreui.ShowCurrentUserActivity"
android:label="CurrentUser"
android:exported="false">
<intent-filter>
<action android:name="com.example.coreui.ShowCurrentUserActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.