本文整理匯總了Java中android.support.v4.app.ActivityCompat.finishAffinity方法的典型用法代碼示例。如果您正苦於以下問題:Java ActivityCompat.finishAffinity方法的具體用法?Java ActivityCompat.finishAffinity怎麽用?Java ActivityCompat.finishAffinity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v4.app.ActivityCompat
的用法示例。
在下文中一共展示了ActivityCompat.finishAffinity方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: goToMain
import android.support.v4.app.ActivityCompat; //導入方法依賴的package包/類
public static void goToMain(AppCompatActivity activity, View view) {
ActivityOptionsCompat aoc;
if (AndroidVersions.isLollipop() && view != null) {
aoc = ActivityOptionsCompat.makeClipRevealAnimation(view,
0,
0,
view.getWidth(),
view.getHeight());
} else {
aoc = ActivityOptionsCompat.makeBasic();
}
Intent intent = new Intent(activity, MainActivity.class);
ActivityCompat.startActivity(activity, intent, aoc.toBundle());
ActivityCompat.finishAffinity(activity);
}
示例2: onSupportNavigateUp
import android.support.v4.app.ActivityCompat; //導入方法依賴的package包/類
public boolean onSupportNavigateUp() {
Intent upIntent = getSupportParentActivityIntent();
if (upIntent == null) {
return false;
}
if (supportShouldUpRecreateTask(upIntent)) {
TaskStackBuilder b = TaskStackBuilder.create(this);
onCreateSupportNavigateUpTaskStack(b);
onPrepareSupportNavigateUpTaskStack(b);
b.startActivities();
try {
ActivityCompat.finishAffinity(this);
} catch (IllegalStateException e) {
finish();
}
} else {
supportNavigateUpTo(upIntent);
}
return true;
}
示例3: onOptionsItemSelected
import android.support.v4.app.ActivityCompat; //導入方法依賴的package包/類
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
case android.R.id.home:
finish();
break;
case R.id.changePasswordItem:
new AlertDialog.Builder(this)
.setTitle(R.string.change_password_button)
.setMessage(R.string.edit_password_dialog_contet)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String email = CheckLoginActivity.user.getEmail();
emailSent(email);
}
})
.setNegativeButton(android.R.string.cancel, null)
.create().show();
break;
case R.id.signoutItem:
FirebaseAuth mAuth = FirebaseAuth.getInstance();
mAuth.signOut();
Intent it = new Intent(this, CheckLoginActivity.class);
startActivity(it);
ActivityCompat.finishAffinity(this);
break;
}
return true;
}
示例4: finishActivityReceiver
import android.support.v4.app.ActivityCompat; //導入方法依賴的package包/類
private BroadcastReceiver finishActivityReceiver(final Activity activity) {
return new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
ActivityCompat.finishAffinity(activity);
}
};
}
示例5: logout
import android.support.v4.app.ActivityCompat; //導入方法依賴的package包/類
private void logout() {
SharedPreferences.Editor editor = pref.edit();
editor.putBoolean(Util.IS_LOGGED_IN, false);
editor.putString(Util.EMAIL, "");
editor.putString(Util.NAME, "");
editor.putString(Util.UNIQUE_ID, "");
editor.apply();
ActivityCompat.finishAffinity(getActivity());
Intent intent = new Intent(getActivity(), SplashActivity.class);
intent.putExtra("finish", true);
startActivity(intent);
}
示例6: onBackPressed
import android.support.v4.app.ActivityCompat; //導入方法依賴的package包/類
@Override
public void onBackPressed() {
if (drawerHelper.isDrawerOpen()) {
drawerHelper.closeDrawer();
} else {
ActivityCompat.finishAffinity(this);
}
}
示例7: onBackPressed
import android.support.v4.app.ActivityCompat; //導入方法依賴的package包/類
@Override
public void onBackPressed() {
super.onBackPressed();
if (type == TYPE_AUTHORISATION) {
ActivityCompat.finishAffinity(this);
}
}
示例8: onBackPressed
import android.support.v4.app.ActivityCompat; //導入方法依賴的package包/類
@Override
public void onBackPressed() {
super.onBackPressed();
ActivityCompat.finishAffinity(this);
}
示例9: finishWizard
import android.support.v4.app.ActivityCompat; //導入方法依賴的package包/類
static void finishWizard (Activity context) {
setShouldShowWizard(false, context);
ActivityCompat.finishAffinity(context);
context.startActivity(new Intent(context,
MainActivity.class));
}