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:io.imoji.sdk.editor.fragment.CreateTaskFragment.java

private void notifyFailure(Activity a) {
    EditorBitmapCache.getInstance().clearNonOutlinedBitmaps();
    a.setResult(Activity.RESULT_CANCELED, null);
    a.finish();
}

From source file:com.vst.functionframework.ui.SupportActivity.java

/**
 * skip to @param(cls)and call @param(aty's) finish() method
 *//*from   w  ww .  ja va  2  s .co  m*/
@Override
public void skipActivity(Activity aty, Class<?> cls) {
    showActivity(aty, cls);
    aty.finish();
}

From source file:com.frostwire.android.gui.util.DangerousPermissionsChecker.java

private void shutdownFrostWire() {
    if (!Ref.alive(activityRef)) {
        return;// www  .  j  a  va 2s.  c  om
    }
    final Activity activity = activityRef.get();
    activity.finish();
    Engine.instance().shutdown();
    MusicUtils.requestMusicPlaybackServiceShutdown(activity);
}

From source file:com.money.manager.ex.sync.CloudFilePickerFragment.java

private void getFolderContents(String folder) {
    // show progress bar
    progressDialog = new MaterialDialog.Builder(getActivity()).title(R.string.loading)
            .content(R.string.please_wait).progress(true, 0).canceledOnTouchOutside(false).show();

    getSyncManager().getRemoteFolderContentsSingle(folder).subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .map(new Func1<List<CloudMetaData>, List<CloudMetaData>>() {
                @Override//from  www .  j av  a  2s.co  m
                public List<CloudMetaData> call(List<CloudMetaData> cloudMetaDatas) {
                    // sort the items in the process.
                    return sortRemoteItems(cloudMetaDatas);
                }
            }).subscribe(new SingleSubscriber<List<CloudMetaData>>() {
                @Override
                public void onSuccess(List<CloudMetaData> value) {
                    // hide the progress binaryDialog
                    progressDialog.dismiss();

                    // Refresh the data in the list.
                    mAdapter = new CloudDataAdapter(getActivity(), value);
                    mRecyclerView.setAdapter(mAdapter);
                }

                @Override
                public void onError(Throwable error) {
                    progressDialog.dismiss();
                    Timber.e(error, "retrieving the remote folder contents");
                    // Close activity.
                    Activity activity = getActivity();
                    if (activity != null) {
                        activity.finish();
                    }
                }
            });

}

From source file:com.vst.functionframework.ui.SupportActivity.java

/**
 * skip to @param(cls)and call @param(aty's) finish() method
 *///from  w  ww . j a v  a 2  s .  c o m
@Override
public void skipActivity(Activity aty, Class<?> cls, Bundle extras) {
    showActivity(aty, cls, extras);
    aty.finish();
}

From source file:org.schabi.newpipe.util.NavStack.java

public void navBack(Activity activity) throws Exception {
    if (stack.size() == 0) { // if stack is already empty here, activity was probably called
        // from another app
        activity.finish();
        return;//from w ww.  j a v  a2s  .co  m
    }
    stack.pop(); // remove curent activty, since we dont want to return to itself
    if (stack.size() == 0) {
        openMainActivity(activity); // if no more page is on the stack this means we are home
        return;
    }
    NavEntry entry = stack.pop(); // this element will reapear, since by calling the old page
    // this element will be pushed on top again
    try {
        StreamingService service = NewPipe.getService(entry.serviceId);
        switch (service.getLinkTypeByUrl(entry.url)) {
        case STREAM:
            openDetailActivity(activity, entry.url, entry.serviceId);
            break;
        case CHANNEL:
            openChannelActivity(activity, entry.url, entry.serviceId);
            break;
        case NONE:
            throw new Exception("Url not known to service. service=" + Integer.toString(entry.serviceId)
                    + " url=" + entry.url);
        default:
            openMainActivity(activity);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.amaze.carbonfilemanager.activities.PreferencesActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        // Navigate "up" the demo structure to the launchpad activity.
        if (selectedItem != START_PREFERENCE && changed)
            restartPC(this);
        else if (selectedItem != START_PREFERENCE) {
            selectItem(START_PREFERENCE);
        } else {/* w  w  w.  j a  v  a 2  s. c o m*/
            Intent in = new Intent(PreferencesActivity.this, MainActivity.class);
            in.setAction(Intent.ACTION_MAIN);
            in.setAction(Intent.CATEGORY_LAUNCHER);

            final int enter_anim = android.R.anim.fade_in;
            final int exit_anim = android.R.anim.fade_out;
            Activity activity = this;
            activity.overridePendingTransition(enter_anim, exit_anim);
            activity.finish();
            activity.overridePendingTransition(enter_anim, exit_anim);
            activity.startActivity(in);
        }
        return true;
    }
    return true;
}

From source file:com.ntsync.android.sync.activities.MessageDialog.java

@Override
public void onDismiss(DialogInterface dialog) {
    super.onDismiss(dialog);
    if (resultListener != null && positiveBtnText == null) {
        resultListener.messageDialogClosed(textId);
    }//ww  w .ja  v  a  2 s.com
    if (resultListener2 != null && positiveBtnText != null) {
        resultListener2.messageDialogClosed(title, positivePressed);
    }
    if (closeActivity) {
        Activity activity = getActivity();
        if (activity != null) {
            activity.finish();
        }
    }
}

From source file:org.dkf.jmule.util.DangerousPermissionsChecker.java

private void shutdownFrostWire() {
    if (!Ref.alive(activityRef)) {
        return;//from  ww  w  .  j  a v a 2  s  . co m
    }
    final Activity activity = activityRef.get();

    //Offers.stopAdNetworks(activity);
    activity.finish();
    Engine.instance().shutdown();
}

From source file:org.deviceconnect.android.localoauth.fragment.ConfirmAuthFragment.java

/**
 * ??????.//  w ww  . j  a v a  2s  .  com
 * @param timeout (ms)
 */
private void startTimeoutTimer(final long timeout) {
    if (mTimeoutTimer == null) {
        TimerTask timerTask = new TimerTask() {
            @Override
            public void run() {
                Activity a = getActivity();
                if (a != null) {
                    a.finish();
                }
            }
        };
        mTimeoutTimer = new Timer(true);
        mTimeoutTimer.schedule(timerTask, timeout);
    }
}