Example usage for android.app Activity finish

List of usage examples for android.app Activity finish

Introduction

In this page you can find the example usage for android.app Activity finish.

Prototype

public void finish() 

Source Link

Document

Call this when your activity is done and should be closed.

Usage

From source file:ru.valle.btc.MainActivityTest.java

public void testLayoutOnStart() {
    Activity activity = getActivity();
    assertTrue(activity.findViewById(R.id.send_layout).getVisibility() == View.GONE);
    assertTrue(activity.findViewById(R.id.spend_tx_description).getVisibility() == View.GONE);
    assertTrue(activity.findViewById(R.id.spend_tx).getVisibility() == View.GONE);
    activity.finish();
}

From source file:ch.luklanis.esscan.history.HistoryActivity.java

private void setCancelOkAlert(final Activity activity, int id) {
    new CancelOkDialog(id).setOkClickListener(new DialogInterface.OnClickListener() {
        @Override/*from   w  ww  . j  a va  2s  .  c  o  m*/
        public void onClick(DialogInterface dialogInterface, int i) {
            activity.finish();
        }
    }).show(getFragmentManager(), "HistoryActivity.setCancelOkAlert");
}

From source file:net.ec_cube.eccube_Android.PushRegistrationFragment.java

/**
 * Google Play services?????//from ww w  . j  a  va2s . c  o m
 *
 * @return ???true.
 */
private boolean checkPlayServices() {
    final Activity activity = getActivity();
    final int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(activity);
    if (resultCode != ConnectionResult.SUCCESS) {
        if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
            GooglePlayServicesUtil.getErrorDialog(resultCode, activity, PLAY_SERVICES_RESOLUTION_REQUEST)
                    .show();
        } else {
            Log.i(TAG, "This device is not supported.");
            activity.finish();
        }
        return false;
    }
    return true;
}

From source file:net.gsantner.opoc.preference.GsPreferenceFragmentCompat.java

protected void restartActivity() {
    Activity activity;
    if (isAdded() && (activity = getActivity()) != null) {
        Intent intent = getActivity().getIntent();
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK
                | Intent.FLAG_ACTIVITY_NO_ANIMATION);
        activity.overridePendingTransition(0, 0);
        activity.finish();
        activity.overridePendingTransition(0, 0);
        startActivity(intent);//from w  w  w .  j  a  va2  s  .  com
    }
}

From source file:com.acc.android.util.widget.adapter.ImageAdapter.java

public ImageAdapter(final Context context,
        // List<Cphoto> cPhotos,
        Gallery gallery, BitmapProviderManager bitmapProviderManager, ACCFileCallback accFileCallback,
        // boolean useOldShowImage,
        boolean useGalleryDeleteAction, boolean isBig) {
    this.context = context;
    this.gallery = gallery;
    // this.cPhotos = new ArrayList<Cphoto>();
    this.isBig = isBig;
    // if (fileDownloadManager == null) {
    // Handler fileDownloadListener = new Handler() {
    // @Override/*  w  w w.  ja v a 2s.c om*/
    // public void handleMessage(final Message msg) {
    // ImageAdapter.this.notifyDataSetChanged();
    // }
    // };
    // // ;
    // fileDownloadManager = new FileDownloadManager(context,
    // fileDownloadListener);
    // }
    this.accFileCallback = accFileCallback;
    this.bitmapProviderManager = bitmapProviderManager;
    // this.gallery.setAdapter(this);
    this.gallery.setVisibility(View.GONE);
    // this.fileDownloadManager = fileDownloadManager;
    this.initGalleryAciton(
            // useOldShowImage,
            useGalleryDeleteAction);
    this.onSingleTapListener = new OnSingleTapListener() {

        @Override
        public void onSingleTap() {
            Intent intent = new Intent();
            intent.putExtras(IntentUtil.getBundle(ACCALibConstant.KEY_BUNDLE_ACC_FILE_S,
                    ImageAdapter.this.getTransImageData()));
            Activity contextActivity = (Activity) context;
            contextActivity.setResult(Activity.RESULT_OK, intent);
            contextActivity.finish();
        }
    };
    this.initImageData();
}

From source file:co.beem.project.beem.ui.wizard.AccountConfigureFragment.java

/**
 * Callback called when the account was connected successfully.
 *
 * @param jid the jid used to connect/*from   w w  w.  j  a  va  2  s. c o m*/
 * @param password the password used to connect
 *
 */
private void onAccountConnectionSuccess(String jid, String password) {
    Activity a = getActivity();
    saveCredential(jid, password);
    // launch login
    Intent i = new Intent(a, Login.class);
    i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    startActivity(i);
    a.finish();
}

From source file:org.kontalk.ui.GroupInfoFragment.java

void openChat(String jid) {
    Intent i = new Intent();
    i.setData(MyMessages.Threads.getUri(jid));
    Activity parent = getActivity();
    parent.setResult(GroupInfoActivity.RESULT_PRIVATE_CHAT, i);
    parent.finish();
}

From source file:org.sufficientlysecure.keychain.ui.CreateKeyFinalFragment.java

public void finishWithResult(OperationResult result) {
    Activity activity = getActivity();
    if (activity == null) {
        mQueuedFinishResult = result;/*  w  ww .j  av  a2 s.  c om*/
        return;
    }

    Intent data = new Intent();
    data.putExtra(OperationResult.EXTRA_RESULT, result);
    activity.setResult(Activity.RESULT_OK, data);
    activity.finish();
}

From source file:it.geosolutions.android.map.fragment.featureinfo.FeatureInfoAttributeListFragment.java

private void returnSelectedItem() {
    Intent returnIntent = new Intent();
    Activity activity = getSherlockActivity();
    // get current markers
    // currentFeatures is present
    if (currentFeatures != null && currentFeatures.size() > 0) {
        returnIntent.putExtra(GetFeatureInfoLayerListActivity.RESULT_FEATURE_EXTRA, currentFeatures.get(0));
        returnIntent.putExtra(GetFeatureInfoLayerListActivity.LAYER_FEATURE_EXTRA, layers.get(0));
        activity.setResult(Activity.RESULT_OK, returnIntent);
    }/*  ww  w .  jav a 2s  .  co m*/
    activity.finish();
}

From source file:com.github.ppamorim.dragger.DraggerView.java

private void finish() {
    Context context = getContext();
    if (context instanceof Activity) {
        Activity activity = (Activity) context;
        if (!activity.isFinishing()) {
            activity.overridePendingTransition(0, android.R.anim.fade_out);
            activity.finish();
        }//from  w w  w. j a  va  2 s  .co  m
    }
}