Java Code Examples for android.support.v4.app.fragmentactivity#finish()

The following examples show how to use android.support.v4.app.fragmentactivity#finish() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StartupHandler.java    From citra_android with GNU General Public License v3.0 6 votes vote down vote up
public static void HandleInit(FragmentActivity parent)
{
  // Ask the user to grant write permission if it's not already granted
  PermissionsHandler.checkWritePermission(parent);

  String start_file = "";
  Bundle extras = parent.getIntent().getExtras();
  if (extras != null)
    start_file = extras.getString("AutoStartFile");

  if (!TextUtils.isEmpty(start_file))
  {
    // Start the emulation activity, send the ISO passed in and finish the main activity
    Intent emulation_intent = new Intent(parent, EmulationActivity.class);
    emulation_intent.putExtra("SelectedGame", start_file);
    parent.startActivity(emulation_intent);
    parent.finish();
  }
}
 
Example 2
Source File: ClanUtils.java    From BigApp_Discuz_Android with Apache License 2.0 6 votes vote down vote up
public static void logout(FragmentActivity activity, String msg) {
    ZogUtils.printError(ClanUtils.class, "logout_succeed");

    ToastUtils.mkLongTimeToast(activity, msg);

    PreferenceManager.getDefaultSharedPreferences(activity).edit().clear().commit();
    AppSPUtils.saveAvatarUrl(activity, "");
    MyFavUtils.deleteAllForum(activity);
    MyFavUtils.deleteAllThread(activity);
    MyFavUtils.deleteAllArticle(activity);

    AppSPUtils.setLoginInfo(activity, false, "0", "");

    activity.setResult(ResultCode.RESULT_CODE_EXIT);
    activity.finish();
}
 
Example 3
Source File: TyWebViewToolbarFragment.java    From tysq-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void close() {
    tyWebViewFragment.setListener(null);
    FragmentActivity activity = getActivity();
    if (activity != null) {
        activity.finish();
    }
}
 
Example 4
Source File: IgnoreTextDialogActivity.java    From oversec with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onDismiss(DialogInterface dialog) {
    super.onDismiss(dialog);
    FragmentActivity a = getActivity();
    if (a != null) {
        a.finish();
    }
}
 
Example 5
Source File: FacebookDialogFragment.java    From kognitivo with Apache License 2.0 5 votes vote down vote up
private void onCompleteWebDialog(Bundle values, FacebookException error) {
    FragmentActivity fragmentActivity = getActivity();

    Intent resultIntent = NativeProtocol.createProtocolResultIntent(
            fragmentActivity.getIntent(),
            values,
            error);

    int resultCode = error == null ? Activity.RESULT_OK : Activity.RESULT_CANCELED;

    fragmentActivity.setResult(resultCode, resultIntent);
    fragmentActivity.finish();
}
 
Example 6
Source File: FacebookDialogFragment.java    From kognitivo with Apache License 2.0 5 votes vote down vote up
private void onCompleteWebFallbackDialog(Bundle values) {
    FragmentActivity fragmentActivity = getActivity();

    Intent resultIntent = new Intent();
    resultIntent.putExtras(values == null ? new Bundle() : values);

    fragmentActivity.setResult(Activity.RESULT_OK, resultIntent);
    fragmentActivity.finish();
}
 
Example 7
Source File: ChangeActivityHelper.java    From AwesomeSplash with MIT License 5 votes vote down vote up
public static void changeActivity(FragmentActivity source, Class<?> destination, boolean shouldFinishContext, Bundle bundle) {
    if (shouldFinishContext){
        source.finish();
    }
    Intent intent = new Intent(source, destination);
    intent.putExtras(bundle);
    source.startActivity(intent);
}
 
Example 8
Source File: FragmentTestActivity.java    From android-task with Apache License 2.0 5 votes vote down vote up
@TaskResult
public void onResult(Boolean result) {
    FragmentActivity activity = getActivity();

    if (activity != null) {
        Toast.makeText(activity, "Result " + result, Toast.LENGTH_SHORT).show();
        activity.finish();
    }

}
 
Example 9
Source File: BluetoothChatFragment.java    From android-BluetoothChat with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setHasOptionsMenu(true);
    // Get local Bluetooth adapter
    mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

    // If the adapter is null, then Bluetooth is not supported
    if (mBluetoothAdapter == null) {
        FragmentActivity activity = getActivity();
        Toast.makeText(activity, "Bluetooth is not available", Toast.LENGTH_LONG).show();
        activity.finish();
    }
}
 
Example 10
Source File: CaptureListFragment.java    From CapturePacket with MIT License 4 votes vote down vote up
@Override
public boolean onMenuItemClick(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.exit:
            FragmentActivity activity = getActivity();
            if (activity != null) {
                activity.finish();
            }
            return true;
        case R.id.help:
            FragmentActivity fragmentActivity = getActivity();
            if (fragmentActivity != null) {
                fragmentActivity.getSupportFragmentManager()
                        .beginTransaction()
                        .addToBackStack(null)
                        .replace(R.id.fl_content,new HelpFragment(),HelpFragment.TAG)
                        .commitAllowingStateLoss();
            }
            break;
        case R.id.clear:
            if (mCaptureBinder != null) {
                mCaptureBinder.clearHarEntries();
                onClearEntries();
            }
            break;
        case R.id.auto_scroll:
            mAutoScroll = !item.isChecked();
            item.setChecked(mAutoScroll);
            break;
        case R.id.float_window:
            Toast toast = Toast.makeText(getActivity(), "开发中,敬请期待!", Toast.LENGTH_SHORT);
            toast.setGravity(Gravity.CENTER,0,0);
            toast.show();
            break;
        case R.id.save_log:
            if (mSearchView != null && mSearchView.hasFocus()) {
                mSearchView.clearFocus();
            }
            saveLog();
            break;
    }
    return true;
}
 
Example 11
Source File: FacebookDialogFragment.java    From letv with Apache License 2.0 4 votes vote down vote up
private void onCompleteWebDialog(Bundle values, FacebookException error) {
    FragmentActivity fragmentActivity = getActivity();
    fragmentActivity.setResult(error == null ? -1 : 0, NativeProtocol.createProtocolResultIntent(fragmentActivity.getIntent(), values, error));
    fragmentActivity.finish();
}