本文整理汇总了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));
}