本文整理汇总了Java中android.app.Activity.RESULT_OK属性的典型用法代码示例。如果您正苦于以下问题:Java Activity.RESULT_OK属性的具体用法?Java Activity.RESULT_OK怎么用?Java Activity.RESULT_OK使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.app.Activity
的用法示例。
在下文中一共展示了Activity.RESULT_OK属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case PICK_IMAGE_REQUEST_CODE:
if (resultCode == Activity.RESULT_OK) {
Bitmap avatar= ImagePicker.getImageFromResult(this, data);
profileFragment.setAvatar(avatar);
}
break;
case LOGIN_REQUEST_CODE:
if (resultCode != Activity.RESULT_OK)
finish();
default:
super.onActivityResult(requestCode, resultCode, data);
break;
}
}
示例2: onActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case REQUEST_SPEECH:
switch (resultCode) {
case Activity.RESULT_OK:
setSearchQuery(data, true);
break;
default:
// If recognizer is canceled or failed, keep focus on the search orb
if (FINISH_ON_RECOGNIZER_CANCELED) {
if (!hasResults()) {
if (DEBUG) Log.v(TAG, "Voice search canceled");
getView().findViewById(R.id.lb_search_bar_speech_orb).requestFocus();
}
}
break;
}
break;
}
}
示例3: activityResponseCodeToString
static String activityResponseCodeToString(int respCode) {
switch (respCode) {
case Activity.RESULT_OK:
return "RESULT_OK";
case Activity.RESULT_CANCELED:
return "RESULT_CANCELED";
case GamesActivityResultCodes.RESULT_APP_MISCONFIGURED:
return "RESULT_APP_MISCONFIGURED";
case GamesActivityResultCodes.RESULT_LEFT_ROOM:
return "RESULT_LEFT_ROOM";
case GamesActivityResultCodes.RESULT_LICENSE_FAILED:
return "RESULT_LICENSE_FAILED";
case GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED:
return "RESULT_RECONNECT_REQUIRED";
case GamesActivityResultCodes.RESULT_SIGN_IN_FAILED:
return "SIGN_IN_FAILED";
default:
return String.valueOf(respCode);
}
}
示例4: handleSentResult
private void handleSentResult(MasterSecret masterSecret, long messageId, int result) {
try {
EncryptingSmsDatabase database = DatabaseFactory.getEncryptingSmsDatabase(context);
SmsMessageRecord record = database.getMessage(masterSecret, messageId);
switch (result) {
case Activity.RESULT_OK:
database.markAsSent(messageId, false);
break;
case SmsManager.RESULT_ERROR_NO_SERVICE:
case SmsManager.RESULT_ERROR_RADIO_OFF:
Log.w(TAG, "Service connectivity problem, requeuing...");
ApplicationContext.getInstance(context)
.getJobManager()
.add(new SmsSendJob(context, messageId, record.getIndividualRecipient().getNumber()));
break;
default:
database.markAsSentFailed(messageId);
MessageNotifier.notifyMessageDeliveryFailed(context, record.getRecipients(), record.getThreadId());
}
} catch (NoSuchMessageException e) {
Log.w(TAG, e);
}
}
示例5: onActivityResult
public void onActivityResult(
final int requestCode,
final int resultCode,
final Intent data) {
if (requestCode != REQUEST_CODE_CREATE_CLAIM_ITEM
|| resultCode != Activity.RESULT_OK
|| data == null) {
return;
}
final ClaimItem claimItem = data.getParcelableExtra(
CaptureClaimActivity.EXTRA_CLAIM_ITEM
);
if (claimItem.isValid()) {
final ClaimDatabase database = ClaimApplication.getClaimDatabase();
AsyncTask.SERIAL_EXECUTOR.execute(database.createClaimItemTask(claimItem));
}
}
开发者ID:PacktPublishing,项目名称:Hands-On-Android-UI-Development,代码行数:21,代码来源:NewClaimItemFloatingActionButtonFragment.java
示例6: onActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (RetroUtils.hasKitKat()) {
switch (requestCode) {
case DOCUMENT_TREE_REQUEST_CODE:
if (resultCode == Activity.RESULT_OK) {
Uri treeUri = data.getData();
RetroApplication.getInstance().getContentResolver().takePersistableUriPermission(treeUri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
PreferenceUtil.getInstance(this).setDocumentTreeUri(data.getData().toString());
//saveTags();
}
break;
}
}
}
示例7: onActivityResult
@Override
boolean onActivityResult(int requestCode, int resultCode, Intent data) {
// Handle stuff
Result outcome;
if (data == null) {
// This happens if the user presses 'Back'.
outcome = Result.createCancelResult(pendingRequest, "Operation canceled");
} else if (resultCode == Activity.RESULT_CANCELED) {
outcome = Result.createCancelResult(pendingRequest, data.getStringExtra("error"));
} else if (resultCode != Activity.RESULT_OK) {
outcome = Result.createErrorResult(pendingRequest, "Unexpected resultCode from authorization.", null);
} else {
outcome = handleResultOk(data);
}
if (outcome != null) {
completeAndValidate(outcome);
} else {
tryNextHandler();
}
return true;
}
示例8: onActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.i(TAG, "onActivityResult requestCode: " + requestCode + ", resultCode: " + resultCode);
switch (requestCode) {
case REQ_CODE_START_RTLSDR:
final String startRtlSdrResultAsString=FragmentUtils.parseOpenCloseDeviceActivityResultAsString(data);
Analytics.getInstance().logEvent(Analytics.CATEGORY_RTLSDR_DEVICE, OpenDeviceResult.TAG, startRtlSdrResultAsString+" - "+Utils.retrieveAbi());
logStatus(startRtlSdrResultAsString);
if (resultCode == Activity.RESULT_OK) {
FragmentUtils.rtlSdrRunning=true;
if (calibrateTask!=null){
calibrateTask.onDeviceOpened();
} else {
Log.e(TAG,"Started RTL-SDR - Calibrate task not set.");
}
} else {
resetGuiToInitialState();
Utils.showPopup(IMAGE_POPUP_ID_OPEN_RTLSDR_ERROR,getActivity(),this,getString(R.string.popup_start_device_failed_title),getString(R.string.popup_start_device_failed_message)+" "+startRtlSdrResultAsString,R.drawable.thumbs_down_circle,null);
}
break;
case REQ_CODE_STOP_RTLSDR:
logStatus(FragmentUtils.parseOpenCloseDeviceActivityResultAsString(data));
FragmentUtils.rtlSdrRunning=false;
if (resultCode == Activity.RESULT_OK) {
if (calibrateTask!=null){
calibrateTask.onDeviceClosed();
} else {
Log.e(TAG,"Stopped RTL-SDR - Calibrate task not set.");
}
}
break;
default:
Log.e(TAG, "Unexpected request code: " + requestCode);
}
}
示例9: sendMessage
@POST
@Path("conversations")
@Secure
public Response sendMessage(Message message) throws InterruptedException {
final SmsManager sms = SmsManager.getDefault();
final ArrayList<String> parts = sms.divideMessage(message.getBody());
final CountDownLatch sentLatch = new CountDownLatch(parts.size());
final AtomicInteger statusCode =
new AtomicInteger(Response.Status.CREATED.getStatusCode());
final BroadcastReceiver receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (getResultCode() != Activity.RESULT_OK) {
statusCode.set(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
}
sentLatch.countDown();
}
};
deskDroidService.registerReceiver(receiver, new IntentFilter("com.steeplesoft.deskdroid.SMS_SENT"));
ArrayList<PendingIntent> sentPIs = new ArrayList<>();
for (int i = 0; i < parts.size(); i++) {
sentPIs.add(PendingIntent.getBroadcast(deskDroidService.getApplicationContext(), 0,
new Intent("com.steeplesoft.deskdroid.SMS_SENT"), 0));
}
sms.sendMultipartTextMessage(message.getAddress(), null, parts, sentPIs, null);
sentLatch.await(5, TimeUnit.SECONDS);
deskDroidService.unregisterReceiver(receiver);
return Response.status(statusCode.get()).build();
}
示例10: onActivityResult
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case ActFlightQuery.QUERY_REQUEST_CODE:
if (resultCode == Activity.RESULT_OK) {
currentQuery = (FlightQuery) data.getSerializableExtra(ActFlightQuery.QUERY_TO_EDIT);
}
default:
break;
}
}
示例11: result
@Override
public void result(int requestCode, int resultCode) {
// If a task was successfully added, show snackbar
if (AddEditTaskActivity.REQUEST_ADD_TASK == requestCode && Activity.RESULT_OK == resultCode) {
mTasksView.showSuccessfullySavedMessage();
}
}
示例12: handleUserSignIn
private void handleUserSignIn( int resultCode ) {
if( resultCode == Activity.RESULT_OK ) {
AIR.log( "GameServicesHelper | user signed in - client is connected: " + mGoogleApiClient.isConnected() );
if( !mGoogleApiClient.isConnected() && !mGoogleApiClient.isConnecting() ) {
mGoogleApiClient.connect();
}
} else {
String errorMessage = (resultCode == Activity.RESULT_CANCELED) ? "User has declined signing in." : "There was an error signing the user in.";
AIR.log( errorMessage );
AIR.dispatchEvent( GameServicesEvent.AUTH_ERROR, errorMessage );
}
}
示例13: onActivityResult
public void onActivityResult(int request_code, int result_code, Intent intent)
{
if (request_code == 1)
{
if (result_code == Activity.RESULT_OK)
{
String root_folder = intent.getStringExtra("root_folder");
SharedPreferences.Editor preferences_editor = PreferenceManager.getDefaultSharedPreferences(this)
.edit();
preferences_editor.putString("root_folder", root_folder);
preferences_editor.commit();
}
}
}
示例14: onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_BARCODE_TEXT && resultCode == Activity.RESULT_OK) {
// Return result to MainActivity
Intent intent = new Intent();
intent.putExtras(data);
setResult(RESULT_OK, intent);
finish();
}
}
示例15: onActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.i(TAG, "onActivityResult requestCode: " + requestCode + ", resultCode: " + resultCode);
switch (requestCode) {
case REQ_CODE_START_RTLSDR:
final String startRtlSdrResultAsString = FragmentUtils.parseOpenCloseDeviceActivityResultAsString(data);
Analytics.getInstance().logEvent(Analytics.CATEGORY_RTLSDR_DEVICE, OpenDeviceResult.TAG, startRtlSdrResultAsString+" - "+Utils.retrieveAbi());
logStatus(startRtlSdrResultAsString);
if (resultCode != Activity.RESULT_OK) {
resetGuiToInitialState();
Utils.showPopup(IMAGE_POPUP_ID_OPEN_RTLSDR_ERROR, getActivity(), this, getString(R.string.popup_start_device_failed_title), getString(R.string.popup_start_device_failed_message) + " " + startRtlSdrResultAsString, R.drawable.thumbs_down_circle, null);
} else {
FragmentUtils.rtlSdrRunning = true;
}
break;
case REQ_CODE_STOP_RTLSDR:
logStatus(FragmentUtils.parseOpenCloseDeviceActivityResultAsString(data));
FragmentUtils.rtlSdrRunning = false;
break;
default:
Log.e(TAG, "Unexpected request code: " + requestCode);
}
}