Example usage for android.app Activity moveTaskToBack

List of usage examples for android.app Activity moveTaskToBack

Introduction

In this page you can find the example usage for android.app Activity moveTaskToBack.

Prototype

public boolean moveTaskToBack(boolean nonRoot) 

Source Link

Document

Move the task containing this activity to the back of the activity stack.

Usage

From source file:Main.java

public static void finishActivity(Activity activity) {
    activity.moveTaskToBack(true);
    activity.finish();
}

From source file:com.github.baoti.pioneer.ui.Navigator.java

public static boolean moveToBackIfRoot(Activity activity) {
    return activity.moveTaskToBack(false);
}

From source file:org.totschnig.myexpenses.dialog.DialogUtils.java

public static AlertDialog passwordDialog(final Activity ctx, final boolean cancelable) {
    final String securityQuestion = PrefKey.SECURITY_QUESTION.getString("");
    LayoutInflater li = LayoutInflater.from(ctx);
    //noinspection InflateParams
    View view = li.inflate(R.layout.password_check, null);
    view.findViewById(R.id.password).setTag(Boolean.valueOf(false));
    AlertDialog.Builder builder = new AlertDialog.Builder(ctx).setTitle(R.string.password_prompt).setView(view)
            .setOnCancelListener(new DialogInterface.OnCancelListener() {
                @Override/*  www. j  ava2 s. com*/
                public void onCancel(DialogInterface dialog) {
                    if (cancelable) {
                        dialog.dismiss();
                    } else {
                        ctx.moveTaskToBack(true);
                    }
                }
            });
    if (ContribFeature.SECURITY_QUESTION.hasAccess() && !securityQuestion.equals("")) {
        builder.setNeutralButton(R.string.password_lost, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
            }
        });
    }
    builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
        }
    });
    if (cancelable) {
        builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            }
        });
    }
    return builder.create();
}

From source file:com.transistorsoft.cordova.bggeo.CDVBackgroundGeolocation.java

@Override
protected void pluginInitialize() {
    gWebView = this.webView;

    Activity activity = this.cordova.getActivity();

    settings = activity.getSharedPreferences("TSLocationManager", 0);
    Settings.init(settings);//from   w  w w . j  ava  2s.  co  m

    toneGenerator = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 100);

    Intent launchIntent = activity.getIntent();
    if (launchIntent.hasExtra("forceReload")) {
        // When Activity is launched due to forceReload, minimize the app.
        activity.moveTaskToBack(true);
    }
}