当前位置: 首页>>代码示例>>Java>>正文


Java ActivityCompat.finishAffinity方法代码示例

本文整理汇总了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);
}
 
开发者ID:maddog05,项目名称:whatanime-android,代码行数:16,代码来源:Navigator.java

示例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;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:21,代码来源:AppCompatActivity.java

示例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;
}
 
开发者ID:feliperce,项目名称:MyNotes,代码行数:31,代码来源:EditProfileActivity.java

示例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);
    }
  };
}
 
开发者ID:jainsahab,项目名称:AndroidSnooper,代码行数:9,代码来源:SnooperBaseActivity.java

示例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);
}
 
开发者ID:harsh159357,项目名称:android_client_php_backend,代码行数:13,代码来源:ProfileFragment.java

示例6: onBackPressed

import android.support.v4.app.ActivityCompat; //导入方法依赖的package包/类
@Override
public void onBackPressed() {
  if (drawerHelper.isDrawerOpen()) {
    drawerHelper.closeDrawer();
  } else {
    ActivityCompat.finishAffinity(this);
  }
}
 
开发者ID:AtlantPlatform,项目名称:atlant-android,代码行数:9,代码来源:HomeActivity.java

示例7: onBackPressed

import android.support.v4.app.ActivityCompat; //导入方法依赖的package包/类
@Override
public void onBackPressed() {
  super.onBackPressed();
  if (type == TYPE_AUTHORISATION) {
    ActivityCompat.finishAffinity(this);
  }
}
 
开发者ID:AtlantPlatform,项目名称:atlant-android,代码行数:8,代码来源:LoginActivity.java

示例8: onBackPressed

import android.support.v4.app.ActivityCompat; //导入方法依赖的package包/类
@Override
public void onBackPressed() {
  super.onBackPressed();
  ActivityCompat.finishAffinity(this);
}
 
开发者ID:AtlantPlatform,项目名称:atlant-android,代码行数:6,代码来源:BackupActivity.java

示例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));
}
 
开发者ID:Trumeet,项目名称:MiPushFramework,代码行数:7,代码来源:WizardSPUtils.java


注:本文中的android.support.v4.app.ActivityCompat.finishAffinity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。