Example usage for android.app Activity RESULT_OK

List of usage examples for android.app Activity RESULT_OK

Introduction

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

Prototype

int RESULT_OK

To view the source code for android.app Activity RESULT_OK.

Click Source Link

Document

Standard activity result: operation succeeded.

Usage

From source file:ca.rmen.android.networkmonitor.app.dbops.ui.Clear.java

/**
 * Deletes rows from the database, keeping only the given number of rows.
 *
 * @param activity a progress dialog will be displayed in this activity
 * @param numRowsToKeep delete all but the most recent numRowToKeep rows. 0 to delete all rows.
 *///from  w w  w . j a v a  2 s .  c  o m
public static void clear(final FragmentActivity activity, int numRowsToKeep) {
    Log.v(TAG, "clear, keeping " + numRowsToKeep + " records");
    DBPurge dbPurge = new DBPurge(activity, numRowsToKeep);
    new DBOpAsyncTask<Integer>(activity, dbPurge, null) {

        @Override
        protected void onPostExecute(Integer result) {
            // Once the DB is deleted, reload the WebView.
            if (result > 0)
                Toast.makeText(activity, activity.getString(R.string.compress_successful, result),
                        Toast.LENGTH_LONG).show();
            activity.setResult(Activity.RESULT_OK);
            super.onPostExecute(result);
        }
    }.execute();

}

From source file:cat.mvmike.minimalcalendarwidget.activity.PermissionsActivity.java

@Override
public void onRequestPermissionsResult(final int requestCode, final @NonNull String[] permissions,
        final @NonNull int[] grantResults) {

    if (requestCode == READ_CALENDAR_PERM && grantResults.length == 1
            && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
        setResult(Activity.RESULT_OK);
        MonthWidget.forceRedraw(this);
    }/*from   ww w .  j  a va  2 s.  c  o m*/

    this.finish();
}

From source file:com.ct.speech.HintReceiver.java

@Override
public void onReceive(Context context, Intent intent) {

    if (getResultCode() != Activity.RESULT_OK) {
        return;/* w  w w .  jav  a2  s. c om*/
    }
    // the list of supported languages.
    ArrayList<CharSequence> hints = getResultExtras(true)
            .getCharSequenceArrayList(RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES);

    // Convert the map to json
    JSONArray languageArray = new JSONArray(hints);
    PluginResult result = new PluginResult(PluginResult.Status.OK, languageArray);
    result.setKeepCallback(false);
    // speechRecognizer.callbackId = "";
    speechRecognizerPlugin.success(result, "");
}

From source file:br.ufg.inf.muralufg.utils.gcm.GcmBroadcastReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    ComponentName comp = new ComponentName(context.getPackageName(), GcmIntentService.class.getName());
    startWakefulService(context, intent.setComponent(comp));
    setResultCode(Activity.RESULT_OK);
}

From source file:br.es.integracao.cliente.gcm.GCMBroadcastReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    // Especificar de forma explcita qual GcmIntentService que ir lidar
    // com a inteno
    ComponentName comp = new ComponentName(context.getPackageName(), GCMIntentService.class.getName());
    // Inicia o servio, mantendo o dispositivo acordado enquanto ele
    // estiver rodando.
    startWakefulService(context, (intent.setComponent(comp)));
    setResultCode(Activity.RESULT_OK);
}

From source file:br.com.epitrack.healthycup.gcm.GCMBroadcastReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    // Explicitly specify that GcmIntentService will handle the intent.
    Log.i("SaudeNaCopa", "GcmBroadcastReceiver");
    ComponentName comp = new ComponentName(context.getPackageName(), GCMIntentService.class.getName());

    // Start the service, keeping the device awake while it is launching.
    startWakefulService(context, (intent.setComponent(comp)));
    setResultCode(Activity.RESULT_OK);
}

From source file:com.abbiya.proximity.proximity.GcmBroadcastReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    // Explicitly specify that GcmIntentService will handle the intent.
    ComponentName comp = new ComponentName(context.getPackageName(), GCMIntentService.class.getName());
    // Start the service, keeping the device awake while it is launching.
    startWakefulService(context, (intent.setComponent(comp)));
    setResultCode(Activity.RESULT_OK);
}

From source file:co.mindquake.nester.pushNoti.GcmBroadcastReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    // Explicitly specify that GcmIntentService will handle the intent.
    ComponentName comp = new ComponentName(context.getPackageName(), GcmIntentService.class.getName());
    // Start the service, keeping the device awake while it is launching.
    startWakefulService(context, (intent.setComponent(comp)));
    setResultCode(Activity.RESULT_OK);

}

From source file:addresspager.test_google_cloud_messaging.GcmBroadcastReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    // Explicitly specify that GcmIntentService will handle the intent.
    ComponentName comp = new ComponentName(context.getPackageName(), GcmIntentService.class.getName());
    // Start the service, keeping the device awake while it is launching.
    startWakefulService(context, (intent.setComponent(comp)));
    setResultCode(Activity.RESULT_OK);
}

From source file:fr.smile.cordova.calendar.CalendarPlugin.java

public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == RESULT_CODE_CREATE) {
        if (resultCode == Activity.RESULT_OK) {
            callback.success();//from   w w w  . ja va  2s.  c  o  m
        } else {
            callback.error("Activity result code " + resultCode);
        }
    }
}