當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。