Java Code Examples for android.content.Intent#getStringExtra()
The following examples show how to use
android.content.Intent#getStringExtra() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: QuranAndroid File: SearchActivity.java License: GNU General Public License v3.0 | 6 votes |
/** * Function to init views */ private void init() { Intent intent = getIntent(); searchText = intent.getStringExtra(AppConstants.General.SEARCH_TEXT); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitle(getString(R.string.search)); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); resultsInfo = (TextView) findViewById(R.id.textView13); ayas = new ArrayList<Aya>(); adapter = new SearchShowAdapter(this, searchText, ayas); searchResults = (ListView) findViewById(R.id.listView3); searchResults.setOnItemClickListener(this); searchResults.setEmptyView(findViewById(R.id.progressBar3)); searchResults.setAdapter(adapter); new SearchResults().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }
Example 2
Source Project: Pix-Art-Messenger File: RtpSessionActivity.java License: GNU General Public License v3.0 | 6 votes |
@Override public void onNewIntent(final Intent intent) { Log.d(Config.LOGTAG, this.getClass().getName() + ".onNewIntent()"); super.onNewIntent(intent); setIntent(intent); if (xmppConnectionService == null) { Log.d(Config.LOGTAG, "RtpSessionActivity: background service wasn't bound in onNewIntent()"); return; } final Account account = extractAccount(intent); final Jid with = Jid.ofEscaped(intent.getStringExtra(EXTRA_WITH)); final String sessionId = intent.getStringExtra(EXTRA_SESSION_ID); if (sessionId != null) { Log.d(Config.LOGTAG, "reinitializing from onNewIntent()"); if (initializeActivityWithRunningRtpSession(account, with, sessionId)) { return; } if (ACTION_ACCEPT_CALL.equals(intent.getAction())) { Log.d(Config.LOGTAG, "accepting call from onNewIntent()"); requestPermissionsAndAcceptCall(); resetIntent(intent.getExtras()); } } else { throw new IllegalStateException("received onNewIntent without sessionId"); } }
Example 3
Source Project: lost-phone-tracker-app File: LogAlarmReceiver.java License: MIT License | 6 votes |
@Override public void onReceive(Context context, Intent intent) { if (intent == null || !ACTION_TRIGGER_ALARM.equals(intent.getAction())) { return; } if (intent.getStringExtra(EXTRA_PHONE_NUMBER) == null || intent.getStringExtra(EXTRA_PHONE_NUMBER).length() == 0) { return; } SmsLocationReporter sender = new SmsLocationReporter(context, intent.getStringExtra(EXTRA_PHONE_NUMBER)); sender.report(); // reschedule the alarm after the SMS has been sent enqueueAlarm(context, intent.getStringExtra(EXTRA_PHONE_NUMBER)); }
Example 4
Source Project: Wrox-ProfessionalAndroid-4E File: LifeformDetectedReceiver.java License: Apache License 2.0 | 6 votes |
@Override public void onReceive(Context context, Intent intent) { // Get the lifeform details from the intent. String type = intent.getStringExtra(EXTRA_LIFEFORM_NAME); double lat = intent.getDoubleExtra(EXTRA_LATITUDE, Double.NaN); double lng = intent.getDoubleExtra(EXTRA_LONGITUDE, Double.NaN); if (type.equals(FACE_HUGGER)) { NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context); NotificationCompat.Builder builder = new NotificationCompat.Builder(context); builder.setSmallIcon(R.drawable.ic_alien) .setContentTitle("Face Hugger Detected") .setContentText(Double.isNaN(lat) || Double.isNaN(lng) ? "Location Unknown" : "Located at " + lat + "," + lng); notificationManager.notify(NOTIFICATION_ID, builder.build()); } }
Example 5
Source Project: SmsCode File: HomeActivity.java License: GNU General Public License v3.0 | 6 votes |
private void handleIntent(Intent intent) { int themeIdx = SPUtils.getCurrentThemeIndex(this); ThemeItem themeItem = ThemeItemContainer.get().getItemAt(themeIdx); String action = intent.getAction(); SettingsFragment settingsFragment = null; if (Intent.ACTION_VIEW.equals(action)) { String extraAction = intent.getStringExtra(SettingsFragment.EXTRA_ACTION); if (SettingsFragment.ACTION_GET_RED_PACKET.equals(extraAction)) { settingsFragment = SettingsFragment.newInstance(themeItem, extraAction); } } if (settingsFragment == null) { settingsFragment = SettingsFragment.newInstance(themeItem); } settingsFragment.setOnPreferenceClickCallback(this); mFragmentManager = getSupportFragmentManager(); mFragmentManager.beginTransaction() .replace(R.id.home_content, settingsFragment) .commit(); mCurrentFragment = settingsFragment; }
Example 6
Source Project: weMessage File: ConnectionService.java License: GNU Affero General Public License v3.0 | 6 votes |
@Override public int onStartCommand(Intent intent, int flags, int startId) { if (getConnectionHandler() != null && getConnectionHandler().isRunning().get()){ throw new ConnectionException("There is already a connection to the weServer established."); } synchronized (connectionHandlerLock){ ConnectionHandler connectionHandler = new ConnectionHandler(this, intent.getStringExtra(weMessage.ARG_HOST), intent.getIntExtra(weMessage.ARG_PORT, -1), intent.getStringExtra(weMessage.ARG_EMAIL), intent.getStringExtra(weMessage.ARG_PASSWORD), intent.getBooleanExtra(weMessage.ARG_PASSWORD_ALREADY_HASHED, false), intent.getStringExtra(weMessage.ARG_FAILOVER_IP)); connectionHandler.start(); this.connectionHandler = connectionHandler; } return START_REDELIVER_INTENT; }
Example 7
Source Project: BusyBox File: ScriptsFragment.java License: Apache License 2.0 | 5 votes |
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_CREATE_SCRIPT && resultCode == Activity.RESULT_OK) { String name = data.getStringExtra(CreateScriptActivity.EXTRA_SCRIPT_NAME); String filename = data.getStringExtra(CreateScriptActivity.EXTRA_FILE_NAME); createScript(name, filename); return; } super.onActivityResult(requestCode, resultCode, data); }
Example 8
Source Project: alpha-wallet-android File: ImportWalletActivity.java License: MIT License | 5 votes |
private void handleScanQR(int resultCode, Intent data) { switch (resultCode) { case FullScannerFragment.SUCCESS: if (data != null) { String barcode = data.getStringExtra(FullScannerFragment.BarcodeObject); //if barcode is still null, ensure we don't GPF if (barcode == null) { displayScanError(); return; } QRURLParser parser = QRURLParser.getInstance(); QrUrlResult result = parser.parse(barcode); String extracted_address = null; if (result != null && result.type == EIP681Type.ADDRESS) { extracted_address = result.getAddress(); if (currentPage == ImportType.WATCH_FORM_INDEX) { ((SetWatchWalletFragment) pages.get(ImportType.WATCH_FORM_INDEX.ordinal()).second) .setAddress(extracted_address); } } } break; case QRScanningActivity.DENY_PERMISSION: showCameraDenied(); break; default: Log.e("SEND", String.format(getString(R.string.barcode_error_format), "Code: " + String.valueOf(resultCode) )); break; } }
Example 9
Source Project: glimmr File: StackWidgetProvider.java License: Apache License 2.0 | 5 votes |
@Override public void onReceive(Context context, Intent intent) { if (BuildConfig.DEBUG) Log.d(TAG, "onReceive"); AppWidgetManager mgr = AppWidgetManager.getInstance(context); if (intent.getAction().equals(ACTION_START_VIEWER)) { //int appWidgetId = intent.getIntExtra( // AppWidgetManager.EXTRA_APPWIDGET_ID, // AppWidgetManager.INVALID_APPWIDGET_ID); int viewIndex = intent.getIntExtra(VIEW_INDEX, 0); String photoListFile = intent.getStringExtra( PhotoViewerActivity.KEY_PHOTO_LIST_FILE); Intent photoViewer = new Intent(context, PhotoViewerActivity.class); photoViewer.putExtra( PhotoViewerActivity.KEY_START_INDEX, viewIndex); photoViewer.setAction(PhotoViewerActivity.ACTION_VIEW_PHOTOLIST); photoViewer.putExtra(PhotoViewerActivity.KEY_PHOTO_LIST_FILE, photoListFile); photoViewer.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); photoViewer.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); context.startActivity(photoViewer); } else if (intent.getAction().equals(ACTION_REFRESH)) { if (BuildConfig.DEBUG) Log.d(TAG, "got action_refresh"); int appWidgetId = intent.getIntExtra( AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); mgr.notifyAppWidgetViewDataChanged(appWidgetId, R.id.stack_view); } super.onReceive(context, intent); }
Example 10
Source Project: guarda-android-wallets File: WithdrawFragment.java License: GNU General Public License v3.0 | 5 votes |
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == RequestCode.QR_CODE_REQUEST_CODE) { if (resultCode == Activity.RESULT_OK) { String result = data.getStringExtra(Extras.QR_CODE_RESULT); if (!result.isEmpty()) { String address = filterAddress(result); etSendCoinsAddress.setText(address); } } } super.onActivityResult(requestCode, resultCode, data); }
Example 11
Source Project: springreplugin File: DebuggerReceivers.java License: Apache License 2.0 | 5 votes |
/** * 安装"纯APK"插件 * * @param context * @param intent * @return 执行是否成功 */ private boolean doActionInstall(final Context context, final Intent intent) { String path = intent.getStringExtra(PARAM_PATH); String immediatelyText = intent.getStringExtra(PARAM_IMMEDIATELY); boolean immediately = false; if (TextUtils.equals(immediatelyText, "true")) { immediately = true; } onInstallByApk(path, immediately); return true; }
Example 12
Source Project: NetEasyNews File: VideoDetailActivity.java License: GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_video_detail); mContext = this; Intent intent = getIntent(); if (intent != null) { vid = intent.getStringExtra(VID); mMp4_url = intent.getStringExtra(MP4URL); } Log.d("VideoDetailActivity", "onCreate: " + vid); initView(); initValidata(); initListener(); }
Example 13
Source Project: blade-player File: MainActivity.java License: GNU General Public License v3.0 | 5 votes |
@Override protected void onNewIntent(Intent intent) { if(Intent.ACTION_SEARCH.equals(intent.getAction())) { final String query = intent.getStringExtra(SearchManager.QUERY); if(globalSearch) { new Thread() { public void run() { final ArrayList<LibraryObject> objects = LibraryService.queryWeb(query); runOnUiThread(new Runnable() { @Override public void run() { setContentToSearch(objects); } }); } }.start(); } else setContentToSearch(LibraryService.query(query)); } }
Example 14
Source Project: Klyph File: UiLifecycleHelper.java License: MIT License | 5 votes |
private boolean handleFacebookDialogActivityResult(int requestCode, int resultCode, Intent data, FacebookDialog.Callback facebookDialogCallback) { if (pendingFacebookDialogCall == null || pendingFacebookDialogCall.getRequestCode() != requestCode) { return false; } if (data == null) { // We understand the request code, but have no Intent. This can happen if the called Activity crashes // before it can be started; we treat this as a cancellation because we have no other information. cancelPendingAppCall(facebookDialogCallback); return true; } String callIdString = data.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID); UUID callId = null; if (callIdString != null) { try { callId = UUID.fromString(callIdString); } catch (IllegalArgumentException exception) { } } // Was this result for the call we are waiting on? if (callId != null && pendingFacebookDialogCall.getCallId().equals(callId)) { // Yes, we can handle it normally. FacebookDialog.handleActivityResult(activity, pendingFacebookDialogCall, requestCode, data, facebookDialogCallback); } else { // No, send a cancellation error to the pending call and ignore the result, because we // don't know what to do with it. cancelPendingAppCall(facebookDialogCallback); } pendingFacebookDialogCall = null; return true; }
Example 15
Source Project: QuickerAndroid File: MainActivity.java License: GNU General Public License v3.0 | 5 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQ_CODE_SCAN_BRCODE) { if (resultCode == CommonStatusCodes.SUCCESS) { String qrcode = data.getStringExtra("barcode"); Log.d(TAG, "扫描结果:" + qrcode); clientService.getClientManager().sendTextMsg(TextDataMessage.TYPE_QRCODE, qrcode); } } else if (requestCode == VOICE_RECOGNITION_REQUEST_CODE) { if (resultCode == RESULT_OK && data != null) { //返回结果是一个list,我们一般取的是第一个最匹配的结果 ArrayList<String> text = data .getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); clientService.getClientManager().sendTextMsg(TextDataMessage.TYPE_VOICE_RECOGNITION, text.get(0)); } } else if (requestCode == REQUEST_TAKE_PHOTO) { if (resultCode == RESULT_OK) { // readPic(); Bitmap bitmap = ImagePicker.getImageFromResult(this, resultCode, data); sendImage(bitmap); } else { // Bitmap bitmap=MediaStore.Images.Media.getBitmap(getContentResolver(),imageUri); // iv_image.setImageBitmap(bitmap); } } }
Example 16
Source Project: mollyim-android File: WebRtcCallService.java License: GNU General Public License v3.0 | 5 votes |
private void handleSendAnswer(Intent intent) { RemotePeer remotePeer = getRemotePeer(intent); CallId callId = getCallId(intent); Integer remoteDevice = intent.getIntExtra(EXTRA_REMOTE_DEVICE, -1); boolean broadcast = intent.getBooleanExtra(EXTRA_BROADCAST, false); String answer = intent.getStringExtra(EXTRA_ANSWER_DESCRIPTION); Log.i(TAG, "handleSendAnswer: id: " + callId.format(remoteDevice)); AnswerMessage answerMessage = new AnswerMessage(callId.longValue(), answer); Integer destinationDeviceId = broadcast ? null : remoteDevice; SignalServiceCallMessage callMessage = SignalServiceCallMessage.forAnswer(answerMessage, true, destinationDeviceId); sendCallMessage(remotePeer, callMessage); }
Example 17
Source Project: kolabnotes-android File: OverviewFragment.java License: GNU Lesser General Public License v3.0 | 5 votes |
@Override public void run() { //Query the notes final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); Intent startIntent = getActivity().getIntent(); String email = startIntent.getStringExtra(Utils.INTENT_ACCOUNT_EMAIL); String rootFolder = startIntent.getStringExtra(Utils.INTENT_ACCOUNT_ROOT_FOLDER); ActiveAccount activeAccount; if(email != null && rootFolder != null){ activeAccount = activeAccountRepository.switchAccount(email,rootFolder); }else{ activeAccount = activeAccountRepository.getActiveAccount(); } getActivity().runOnUiThread(new Runnable() { @Override public void run() { mDrawerAccountsService.overrideAccounts(activity, mAccountManager.getAccountsByType(AuthenticatorActivity.ARG_ACCOUNT_TYPE), mAccountManager, activity.getDrawerLayout()); mDrawerAccountsService.displayNavigation(); } }); new DrawerService(activity.getNavigationView(), activity.getDrawerLayout()).setNotesFromAccountClickListener(OverviewFragment.this); new AccountChangeThread(activeAccount).run(); }
Example 18
Source Project: fanfouapp-opensource File: PostMessageService.java License: Apache License 2.0 | 5 votes |
private void parseIntent(final Intent intent) { this.userId = intent.getStringExtra(Constants.EXTRA_ID); this.userName = intent.getStringExtra(Constants.EXTRA_USER_NAME); this.content = intent.getStringExtra(Constants.EXTRA_TEXT); if (AppContext.DEBUG) { log("parseIntent userId=" + this.userId); log("parseIntent userName=" + this.userName); log("parseIntent content=" + this.content); } }
Example 19
Source Project: Matisse-Kotlin File: PictureMultiCuttingActivity.java License: Apache License 2.0 | 4 votes |
/** * This method extracts {@link UCrop.Options #optionsBundle} from incoming intent * and setups Activity, {@link OverlayView} and {@link CropImageView} properly. */ @SuppressWarnings("deprecation") private void processOptions(@NonNull Intent intent) { // Bitmap compression options String compressionFormatName = intent.getStringExtra(UCropMulti.Options.EXTRA_COMPRESSION_FORMAT_NAME); Bitmap.CompressFormat compressFormat = null; if (!TextUtils.isEmpty(compressionFormatName)) { compressFormat = Bitmap.CompressFormat.valueOf(compressionFormatName); } mCompressFormat = (compressFormat == null) ? DEFAULT_COMPRESS_FORMAT : compressFormat; mCompressQuality = intent.getIntExtra(UCrop.Options.EXTRA_COMPRESSION_QUALITY, PictureMultiCuttingActivity.DEFAULT_COMPRESS_QUALITY); // Gestures options int[] allowedGestures = intent.getIntArrayExtra(UCropMulti.Options.EXTRA_ALLOWED_GESTURES); if (allowedGestures != null && allowedGestures.length == TABS_COUNT) { mAllowedGestures = allowedGestures; } // Crop image view options mGestureCropImageView.setMaxBitmapSize(intent.getIntExtra(UCropMulti.Options.EXTRA_MAX_BITMAP_SIZE, CropImageView.DEFAULT_MAX_BITMAP_SIZE)); mGestureCropImageView.setMaxScaleMultiplier(intent.getFloatExtra(UCropMulti.Options.EXTRA_MAX_SCALE_MULTIPLIER, CropImageView.DEFAULT_MAX_SCALE_MULTIPLIER)); mGestureCropImageView.setImageToWrapCropBoundsAnimDuration(intent.getIntExtra(UCropMulti.Options.EXTRA_IMAGE_TO_CROP_BOUNDS_ANIM_DURATION, CropImageView.DEFAULT_IMAGE_TO_CROP_BOUNDS_ANIM_DURATION)); // Overlay view options mOverlayView.setDragFrame(isDragFrame); mOverlayView.setFreestyleCropEnabled(intent.getBooleanExtra(UCropMulti.Options.EXTRA_FREE_STYLE_CROP, false)); circleDimmedLayer = intent.getBooleanExtra(UCropMulti.Options.EXTRA_CIRCLE_DIMMED_LAYER, OverlayView.DEFAULT_CIRCLE_DIMMED_LAYER); mOverlayView.setDimmedColor(intent.getIntExtra(UCropMulti.Options.EXTRA_DIMMED_LAYER_COLOR, getResources().getColor(R.color.ucrop_color_default_dimmed))); mOverlayView.setCircleDimmedLayer(circleDimmedLayer); mOverlayView.setShowCropFrame(intent.getBooleanExtra(UCropMulti.Options.EXTRA_SHOW_CROP_FRAME, OverlayView.DEFAULT_SHOW_CROP_FRAME)); mOverlayView.setCropFrameColor(intent.getIntExtra(UCropMulti.Options.EXTRA_CROP_FRAME_COLOR, getResources().getColor(R.color.ucrop_color_default_crop_frame))); mOverlayView.setCropFrameStrokeWidth(intent.getIntExtra(UCropMulti.Options.EXTRA_CROP_FRAME_STROKE_WIDTH, getResources().getDimensionPixelSize(R.dimen.ucrop_default_crop_frame_stoke_width))); mOverlayView.setShowCropGrid(intent.getBooleanExtra(UCropMulti.Options.EXTRA_SHOW_CROP_GRID, OverlayView.DEFAULT_SHOW_CROP_GRID)); mOverlayView.setCropGridRowCount(intent.getIntExtra(UCropMulti.Options.EXTRA_CROP_GRID_ROW_COUNT, OverlayView.DEFAULT_CROP_GRID_ROW_COUNT)); mOverlayView.setCropGridColumnCount(intent.getIntExtra(UCropMulti.Options.EXTRA_CROP_GRID_COLUMN_COUNT, OverlayView.DEFAULT_CROP_GRID_COLUMN_COUNT)); mOverlayView.setCropGridColor(intent.getIntExtra(UCropMulti.Options.EXTRA_CROP_GRID_COLOR, getResources().getColor(R.color.ucrop_color_default_crop_grid))); mOverlayView.setCropGridStrokeWidth(intent.getIntExtra(UCropMulti.Options.EXTRA_CROP_GRID_STROKE_WIDTH, getResources().getDimensionPixelSize(R.dimen.ucrop_default_crop_grid_stoke_width))); // Aspect ratio options float aspectRatioX = intent.getFloatExtra(UCropMulti.EXTRA_ASPECT_RATIO_X, 0); float aspectRatioY = intent.getFloatExtra(UCropMulti.EXTRA_ASPECT_RATIO_Y, 0); int aspectRationSelectedByDefault = intent.getIntExtra(UCropMulti.Options.EXTRA_ASPECT_RATIO_SELECTED_BY_DEFAULT, 0); ArrayList<AspectRatio> aspectRatioList = intent.getParcelableArrayListExtra(UCropMulti.Options.EXTRA_ASPECT_RATIO_OPTIONS); if (aspectRatioX > 0 && aspectRatioY > 0) { mGestureCropImageView.setTargetAspectRatio(aspectRatioX / aspectRatioY); } else if (aspectRatioList != null && aspectRationSelectedByDefault < aspectRatioList.size()) { mGestureCropImageView.setTargetAspectRatio(aspectRatioList.get(aspectRationSelectedByDefault).getAspectRatioX() / aspectRatioList.get(aspectRationSelectedByDefault).getAspectRatioY()); } else { mGestureCropImageView.setTargetAspectRatio(CropImageView.SOURCE_IMAGE_ASPECT_RATIO); } // Result bitmap max size options int maxSizeX = intent.getIntExtra(UCropMulti.EXTRA_MAX_SIZE_X, 0); int maxSizeY = intent.getIntExtra(UCropMulti.EXTRA_MAX_SIZE_Y, 0); if (maxSizeX > 0 && maxSizeY > 0) { mGestureCropImageView.setMaxResultImageSizeX(maxSizeX); mGestureCropImageView.setMaxResultImageSizeY(maxSizeY); } }
Example 20
Source Project: ProjectX File: LegacyPathSelectActivity.java License: Apache License 2.0 | 4 votes |
public static String getPath(Intent data) { return data == null ? null : data.getStringExtra(EXTRA_PATH); }