Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to restart the application or return the LAUNCHER page in Preferences Activity?
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/7308324/restart-app-to-a-certain-activity">Restart app to a certain activity?</a> </p> </blockquote> <p>I am currently writing an DialogPreferences Activity to delete the user account. I completely deleted the user data successfully and now planning to return to the LAUNCHER screen in order to push the user make a new installation. But I really couldn't find any way to return.</p> <p>Intent is only usable from XML file as far as I understand. </p> <p>Is there any way to use StartActivity() or restart the application in DialogPreferences Activity?</p> <pre><code> public class DeleteAccountActivity extends DialogPreference { public DeleteAccountActivity(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected void onDialogClosed(boolean positiveResult) { super.onDialogClosed(positiveResult); if (positiveResult) { if (DEBUG) Log.d(0, DEBUG_TAG, "DeleteAccountActivity"); try { ... boolean success = rest.deregister(request); if (success) { Toast.makeText(getContext(), getContext().getResources().getText(R.string.successfully_deleted_account), Toast.LENGTH_LONG).show(); SharedPreferences.Editor editor = mSharedPref.edit(); editor.clear(); editor.commit(); Intent intent = new Intent(); intent.setClass(this, A.class); StartActivity(intent); //error if (DEBUG) Log.d(0, DEBUG_TAG, "Deleted the user account successfully."); } } catch (Exception e) { Log.e(0, DEBUG_TAG, "asd", e); } } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload