当前位置: 首页>>代码示例>>Java>>正文


Java Activity.RESULT_OK属性代码示例

本文整理汇总了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;
    }
}
 
开发者ID:mirhoseini,项目名称:bcg,代码行数:17,代码来源:MainActivity.java

示例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;
    }
}
 
开发者ID:ITVlab,项目名称:android-tv-news,代码行数:21,代码来源:SearchFragment.java

示例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);
    }
}
 
开发者ID:antonioalmeida,项目名称:retro-reversi,代码行数:20,代码来源:GameHelperUtils.java

示例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);
  }
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:24,代码来源:SmsSentJob.java

示例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;
        }
    }
}
 
开发者ID:h4h13,项目名称:RetroMusicPlayer,代码行数:16,代码来源:SongTagEditorActivity.java

示例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;
}
 
开发者ID:MobileDev418,项目名称:chat-sdk-android-push-firebase,代码行数:23,代码来源:AuthorizationClient.java

示例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);
	}
}
 
开发者ID:videgro,项目名称:Ships,代码行数:37,代码来源:CalibrateFragment.java

示例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();

}
 
开发者ID:PacktPublishing,项目名称:Java-9-Programming-Blueprints,代码行数:31,代码来源:DeskDroidResource.java

示例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;
    }
}
 
开发者ID:ericberman,项目名称:MyFlightbookAndroid,代码行数:11,代码来源:ActRecentsWS.java

示例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();
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:TasksPresenter.java

示例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 );
	}
}
 
开发者ID:marpies,项目名称:game-services-ane,代码行数:12,代码来源:GameServicesHelper.java

示例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();
		}
	}
}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:14,代码来源:FileExplorerSettingsActivity.java

示例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();
    }
}
 
开发者ID:CR96,项目名称:rxinfo,代码行数:10,代码来源:InputActivity.java

示例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);
    }
}
 
开发者ID:videgro,项目名称:Ships,代码行数:27,代码来源:ShowMapFragment.java


注:本文中的android.app.Activity.RESULT_OK属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。