List of usage examples for android.app Activity RESULT_OK
int RESULT_OK
To view the source code for android.app Activity RESULT_OK.
Click Source Link
From source file:ac.robinson.mediaphone.activity.TemplateBrowserActivity.java
@Override public void onBackPressed() { setResult(Activity.RESULT_OK); finish(); }
From source file:de.elanev.studip.android.app.frontend.forums.ForumEntryComposeFragment.java
private void createNewEntry() { setViewsVisible(false);//from w w w . j a v a 2 s .co m String subject = mSubjectEditText.getText().toString(); String content = mContentEditText.getText().toString(); Server server = Prefs.getInstance(getActivity()).getServer(); StudIpLegacyApiService legacyApiService = new StudIpLegacyApiService(server, getActivity()); mCompositeSubscription.add(bind(legacyApiService.createForumEntry(sEntryId, subject, content)) .subscribe(new Subscriber<ForumArea>() { @Override public void onCompleted() { Toast.makeText(getActivity(), R.string.successfully_added, Toast.LENGTH_LONG).show(); getActivity().setResult(Activity.RESULT_OK); getActivity().finish(); } @Override public void onError(Throwable e) { if (e instanceof TimeoutException) { Toast.makeText(getActivity(), "Request timed out", Toast.LENGTH_SHORT).show(); } else if (e instanceof RetrofitError || e instanceof HttpException) { Toast.makeText(getActivity(), "Retrofit error or http exception", Toast.LENGTH_LONG) .show(); Log.e(TAG, e.getLocalizedMessage()); } else { e.printStackTrace(); throw new RuntimeException("See inner exception"); } setViewsVisible(true); } @Override public void onNext(ForumArea forumArea) { } })); }
From source file:cz.zcu.kiv.eeg.mobile.base.ws.asynctask.CreateDigitization.java
/** * Informs user whether digitization creation was successful or not. * * @param digitization returned digitization info if any *//*from www. ja v a 2 s . co m*/ @Override protected void onPostExecute(Digitization digitization) { if (digitization != null) { Intent resultIntent = new Intent(); resultIntent.putExtra(Values.ADD_DIGITIZATION_KEY, digitization); Toast.makeText(activity, R.string.creation_ok, Toast.LENGTH_SHORT).show(); activity.setResult(Activity.RESULT_OK, resultIntent); activity.finish(); } else { Toast.makeText(activity, R.string.creation_failed, Toast.LENGTH_SHORT).show(); } }
From source file:cz.zcu.kiv.eeg.mobile.base.ws.asynctask.CreateReservation.java
/** * If reservation was created/*from w w w .j av a2s . c o m*/ * * @param reservation created reservation if any */ @Override protected void onPostExecute(Reservation reservation) { if (reservation != null) { Intent resultIntent = new Intent(); resultIntent.putExtra(Values.ADD_RESERVATION_KEY, reservation); Toast.makeText(activity, activity.getString(R.string.reser_created), Toast.LENGTH_SHORT).show(); activity.setResult(Activity.RESULT_OK, resultIntent); activity.finish(); } }
From source file:com.tuxpan.foregroundvideocapture.CaptureFG.java
/** * Called when the video view exits.//w w w .j a va2 s.c om * * @param requestCode * The request code originally supplied to * startActivityForResult(), allowing you to identify who this * result came from. * @param resultCode * The integer result code returned by the child activity through * its setResult(). * @param intent * An Intent, which can return result data to the caller (various * data can be attached to Intent "extras"). * @throws JSONException */ public void onActivityResult(int requestCode, int resultCode, final Intent intent) { // Result received okay if (resultCode == Activity.RESULT_OK) { // An audio clip was requested final CaptureFG that = this; Runnable captureVideo = new Runnable() { @Override public void run() { Uri data = null; if (intent != null) { // Get the uri of the video clip data = intent.getData(); } if (data == null) { File movie = new File(getTempDirectoryPath(), "video.3gp"); data = Uri.fromFile(movie); } // create a file object from the uri if (data == null) { that.fail(createErrorObject(CAPTURE_NO_MEDIA_FILES, "Error: data is null")); } else { results.put(createMediaFile(data)); // Send Uri back to JavaScript for viewing video that.callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, results)); } } }; this.cordova.getThreadPool().execute(captureVideo); } // If canceled else if (resultCode == Activity.RESULT_CANCELED) { // If we have partial results send them back to the user if (results.length() > 0) { this.callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, results)); } // user canceled the action else { this.fail(createErrorObject(CAPTURE_NO_MEDIA_FILES, "Canceled.")); } } // If something else else { // If we have partial results send them back to the user if (results.length() > 0) { this.callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, results)); } // something bad happened else { this.fail(createErrorObject(CAPTURE_NO_MEDIA_FILES, "Did not complete!")); } } }
From source file:com.orange.ocara.ui.activity.CreateSiteActivity.java
@Click(resName = "create_site_button") void onCreateSiteButtonClicked() { if (validateSite()) { site.save();// www. j a v a2s .c o m Intent intent = new Intent(); intent.putExtra("siteId", site.getId()); setResult(Activity.RESULT_OK, intent); finish(); } }
From source file:com.ipo.wiimote.SpeechRecognizer.java
/** * Handle the results from the recognition activity. *//*from www . j av a 2s . co m*/ @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK) { // Fill the list view with the strings the recognizer thought it could have heard ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); float[] confidence = data.getFloatArrayExtra(RecognizerIntent.EXTRA_CONFIDENCE_SCORES); if (confidence != null) { Log.d(LOG_TAG, "confidence length " + confidence.length); Iterator<String> iterator = matches.iterator(); int i = 0; while (iterator.hasNext()) { Log.d(LOG_TAG, "Match = " + iterator.next() + " confidence = " + confidence[i]); i++; } } else { Log.d(LOG_TAG, "No confidence" + ""); } ReturnSpeechResults(requestCode, matches); } else { // Failure - Let the caller know ReturnSpeechFailure(resultCode); } super.onActivityResult(requestCode, resultCode, data); }
From source file:cz.zcu.kiv.eeg.mobile.base.ws.asynctask.CreateElectrodeLocation.java
/** * Informs user whether ElectrodeLocation creation was successful or not. * * @param location returned electrode location info if any */// w w w .j a v a 2 s .c o m @Override protected void onPostExecute(ElectrodeLocation location) { if (location != null) { Intent resultIntent = new Intent(); resultIntent.putExtra(Values.ADD_ELECTRODE_LOCATION_KEY, location); Toast.makeText(activity, R.string.creation_ok, Toast.LENGTH_SHORT).show(); activity.setResult(Activity.RESULT_OK, resultIntent); activity.finish(); } else { Toast.makeText(activity, R.string.creation_failed, Toast.LENGTH_SHORT).show(); } }
From source file:com.example.SpeechRecognizer.java
/** * Handle the results from the recognition activity. *//*ww w . ja v a2s. c o m*/ @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK) { // Fill the list view with the strings the recognizer thought it could have heard ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); ReturnSpeechResults(requestCode, matches); } else { // Failure - Let the caller know ReturnSpeechFailure(resultCode); } super.onActivityResult(requestCode, resultCode, data); }
From source file:cz.zcu.kiv.eeg.mobile.base.ws.asynctask.CreateWeather.java
/** * Informs user whether weather creation was successful or not. * * @param weather returned weather info if any *///from w w w . ja v a2s.c om @Override protected void onPostExecute(Weather weather) { if (weather != null) { Intent resultIntent = new Intent(); resultIntent.putExtra(Values.ADD_WEATHER_KEY, weather); Toast.makeText(activity, R.string.creation_ok, Toast.LENGTH_SHORT).show(); activity.setResult(Activity.RESULT_OK, resultIntent); activity.finish(); } else { Toast.makeText(activity, R.string.creation_failed, Toast.LENGTH_SHORT).show(); } }