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:com.cloudkick.LoginActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == SETTINGS_ACTIVITY_ID) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(LoginActivity.this);
        if (prefs.getString("editKey", "").equals("") && prefs.getString("editSecret", "").equals("")) {
            finish();//from ww w.j a v  a 2s.  c o m
        } else {
            Intent result = new Intent();
            result.putExtra("login", true);
            setResult(Activity.RESULT_OK, result);
            finish();
        }
    }
}

From source file:com.corumgaz.mobilsayac.VoiceRecognizer.VoiceRecognizer.java

private void getSupportedLanguages() {
    if (languageDetailsChecker == null) {
        languageDetailsChecker = new LanguageDetailsChecker(callbackContext);
    }//from  w ww  .j a v  a 2s.co  m
    // Create and launch get languages intent
    Intent detailsIntent = new Intent(RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS);
    cordova.getActivity().sendOrderedBroadcast(detailsIntent, null, languageDetailsChecker, null,
            Activity.RESULT_OK, null, null);

}

From source file:com.money.manager.ex.settings.PerDatabaseFragment.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    switch (requestCode) {
    case REQUEST_PICK_CURRENCY:
        // Returning from the currency picker screen.
        if ((resultCode == Activity.RESULT_OK) && (data != null)) {
            int currencyId = data.getIntExtra(CurrencyListActivity.INTENT_RESULT_CURRENCYID, -1);
            // set preference
            CurrencyService utils = new CurrencyService(getActivity());
            utils.setBaseCurrencyId(currencyId);
            // refresh the displayed value.
            showCurrentDefaultCurrency();

            // notify the user to update exchange rates!
            showCurrencyChangeNotification();
        }/*from  www.ja  va2s .c om*/
        break;
    }
}

From source file:org.mifos.androidclient.templates.DownloaderActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    switch (requestCode) {
    case LoginActivity.REQUEST_CODE:
        switch (resultCode) {
        case Activity.RESULT_OK:
            break;
        case Activity.RESULT_CANCELED:
            finish();/*from   ww w .  j  a  v  a2s . co  m*/
            break;
        default:
            break;
        }
        break;
    default:
        break;
    }
}

From source file:com.manueldeveloper.SpeechRecognizer.java

public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    // Check the request code
    if (requestCode == REQUEST_CODE) {
        // Check the result code
        if (resultCode == Activity.RESULT_OK) {
            // Get the results
            this.results = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
            sendResults();/*  w  ww.j a va 2s .c  o  m*/
        } else {
            if (this.speechRecognizerCallbackContext != null) {
                switch (resultCode) {
                case RecognizerIntent.RESULT_NETWORK_ERROR:
                    this.speechRecognizerCallbackContext.error("NETWORK_ERROR");
                    break;
                case RecognizerIntent.RESULT_CLIENT_ERROR:
                    this.speechRecognizerCallbackContext.error("CLIENT_ERROR");
                    break;
                case RecognizerIntent.RESULT_SERVER_ERROR:
                    this.speechRecognizerCallbackContext.error("SERVER_ERROR");
                    break;
                case RecognizerIntent.RESULT_AUDIO_ERROR:
                    this.speechRecognizerCallbackContext.error("AUDIO_ERROR");
                    break;
                case RecognizerIntent.RESULT_NO_MATCH:
                    this.speechRecognizerCallbackContext.error("NO_MATCH");
                    break;
                }
            }
        }
    }
}

From source file:com.winsuk.pebbletype.WatchCommunication.java

@Override
public void onReceive(Context context, Intent intent) {
    if (ACTION_PEBBLE_RECEIVE.equals(intent.getAction())) {
        final UUID receivedUuid = (UUID) intent.getSerializableExtra("uuid");

        // Pebble-enabled apps are expected to be good citizens and only inspect broadcasts containing their UUID
        if (!PEBBLE_APP_UUID.equals(receivedUuid)) {
            return;
        }//from   ww w .jav a2 s  . c  om

        final int transactionId = intent.getIntExtra("transaction_id", -1);
        final String jsonData = intent.getStringExtra("msg_data");
        if (jsonData == null || jsonData.isEmpty()) {
            return;
        }

        try {
            final PebbleDictionary data = PebbleDictionary.fromJson(jsonData);
            receiveData(context, transactionId, data);
        } catch (JSONException e) {
            e.printStackTrace();
            return;
        }
    }

    if (ACTION_SMS_REPLY.equals(intent.getAction())) {
        boolean sent = getResultCode() == Activity.RESULT_OK;

        if (!sent)
            Log.w("com.winsuk.pebbletype", "Message failed to send. Result code: " + getResultCode());

        PebbleDictionary data = new PebbleDictionary();
        data.addUint8(sent ? KEY_MESSAGE_SENT : KEY_MESSAGE_NOT_SENT, (byte) 1);
        PebbleKit.sendDataToPebble(context, PEBBLE_APP_UUID, data);
    }
}

From source file:ca.six.unittestapp.todo.addedittask.AddEditTaskFragment.java

@Override
public void showTasksList() {
    getActivity().setResult(Activity.RESULT_OK);
    getActivity().finish();
}

From source file:com.vsu.bruteremote.FileBrowser.java

/**
 * Called when a list item is clicked.// www.j  a  v a  2s.co  m
 * @param l         The ListView where the click happened
 * @param v         The view that was clicked within the ListView
  * @param position  The position of the view in the list
  * @param id        The row id of the item that was clicked
  */
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);

    // Get the item that was clicked
    FileBrowserItem item = (FileBrowserItem) this.getListAdapter().getItem(position);

    if (item.isSubdirectory()) {
        refreshData(item.getFullPath());
    } else {
        // Create the result Intent and include the filename
        Intent intent = new Intent();
        intent.putExtra(EXTRA_FILENAME, item.getDisplayText());
        intent.putExtra(EXTRA_PARENTPATH, item.getParentPath());
        intent.putExtra(EXTRA_FULLPATH, item.getFullPath());

        // Set result and finish this Activity
        setResult(Activity.RESULT_OK, intent);

        finish();
    }
}

From source file:com.zapto.park.ParkActivity.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    /*//from   w ww .j  av a2s .  com
     * Once a user has typed in their ID to clock and pressed Done,
     * the Pad will close and save the user's clock-in information
     * in the database clock.db
     * */
    if (resultCode == Activity.RESULT_OK && requestCode == ACTIVITY_RESULT_PAD) {
        Log.i(LOG_TAG, "onActivityResult()");
        Bundle extras = data.getExtras();
        String id = extras.getString("id");

        //this clocks in the user
        employeeCheck(id, true);

        Log.i(LOG_TAG, "Result: " + id);
    } else {
        Log.i(LOG_TAG, "onActivityResult(). Problem!");
    }
}

From source file:ch.hesso.master.sweetcity.activity.tag.TagSelectionActivity.java

@Override
public void onClick(View v) {
    SparseBooleanArray checked = listView.getCheckedItemPositions();
    ArrayList<Integer> selectedItems = new ArrayList<Integer>();
    for (int i = 0; i < checked.size(); i++) {
        int position = checked.keyAt(i);

        if (checked.valueAt(i)) {
            selectedItems.add(CurrentTagList.getInstance().getPosition(adapter.getItem(position)));
        }//ww w  .  j  a  v  a  2  s. co  m
    }

    // Return tag selection list to the parent activity
    Intent resultIntent = new Intent();
    Bundle bundle = new Bundle();
    bundle.putIntegerArrayList("selectedItems", selectedItems);
    resultIntent.putExtras(bundle);
    setResult(Activity.RESULT_OK, resultIntent);
    finish();
}