List of usage examples for android.content Intent getDataString
public @Nullable String getDataString()
From source file:tw.jwzhuang.ipcamviewer.devices.CaptureActivity.java
@Override protected void onResume() { super.onResume(); // CameraManager must be initialized here, not in onCreate(). This is // necessary because we don't // want to open the camera driver and measure the screen size if we're // going to show the help on // first launch. That led to bugs where the scanning rectangle was the // wrong size and partially // off screen. cameraManager = new CameraManager(getApplication()); viewfinderView = (ViewfinderView) findViewById(R.id.viewfinder_view); viewfinderView.setCameraManager(cameraManager); handler = null;/* w w w.j av a2 s. c om*/ lastResult = null; resetStatusView(); SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view); SurfaceHolder surfaceHolder = surfaceView.getHolder(); if (hasSurface) { // The activity was paused but not stopped, so the surface still // exists. Therefore // surfaceCreated() won't be called, so init the camera here. initCamera(surfaceHolder); } else { // Install the callback and wait for surfaceCreated() to init the // camera. surfaceHolder.addCallback(this); surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); } inactivityTimer.onResume(); Intent intent = getIntent(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); copyToClipboard = prefs.getBoolean(Contant.KEY_COPY_TO_CLIPBOARD, true) && (intent == null || intent.getBooleanExtra(Intents.Scan.SAVE_HISTORY, true)); source = IntentSource.NONE; decodeFormats = null; characterSet = null; if (intent != null) { String action = intent.getAction(); String dataString = intent.getDataString(); if (Intents.Scan.ACTION.equals(action)) { // Scan the formats the intent requested, and return the result // to the calling activity. source = IntentSource.NATIVE_APP_INTENT; decodeFormats = DecodeFormatManager.parseDecodeFormats(intent); if (intent.hasExtra(Intents.Scan.WIDTH) && intent.hasExtra(Intents.Scan.HEIGHT)) { int width = intent.getIntExtra(Intents.Scan.WIDTH, 0); int height = intent.getIntExtra(Intents.Scan.HEIGHT, 0); if (width > 0 && height > 0) { cameraManager.setManualFramingRect(width, height); } } } else if (dataString != null && dataString.contains(PRODUCT_SEARCH_URL_PREFIX) && dataString.contains(PRODUCT_SEARCH_URL_SUFFIX)) { // Scan only products and send the result to mobile Product // Search. source = IntentSource.PRODUCT_SEARCH_LINK; sourceUrl = dataString; decodeFormats = DecodeFormatManager.PRODUCT_FORMATS; } else if (isZXingURL(dataString)) { // Scan formats requested in query string (all formats if none // specified). // If a return URL is specified, send the results there. // Otherwise, handle it ourselves. source = IntentSource.ZXING_LINK; sourceUrl = dataString; Uri inputUri = Uri.parse(sourceUrl); inputUri.getQueryParameter(RETURN_URL_PARAM); decodeFormats = DecodeFormatManager.parseDecodeFormats(inputUri); } characterSet = intent.getStringExtra(Intents.Scan.CHARACTER_SET); } }
From source file:com.hybris.mobile.activity.OrderDetailActivity.java
private void handleIntent(Intent intent) { if (Hybris.isUserLoggedIn()) { if (intent.hasExtra("orderDetails")) { ((TextView) findViewById(R.id.lbl_thankYou)).setVisibility(View.VISIBLE); ((TextView) findViewById(R.id.lbl_orderConfirmation)).setVisibility(View.VISIBLE); // TODO setmOrderDetails(JsonUtils.fromJson(intent.getStringExtra("orderDetails"), CartOrder.class)); }// w w w . ja v a 2 s.co m if (intent.hasExtra(DataConstants.ORDER_ID)) { setmOrderID(intent.getStringExtra(DataConstants.ORDER_ID)); } // Call from another application (QR Code) else if (StringUtils.equals(intent.getAction(), Intent.ACTION_VIEW)) { setmOrderID(RegexUtil.getOrderIdFromHybrisPattern(intent.getDataString())); } } // User not logged in, redirection to the login page else { Intent loginIntent = new Intent(this, LoginActivity.class); // Call from another application (QR Code) if (StringUtils.equals(intent.getAction(), Intent.ACTION_VIEW)) { loginIntent.putExtra(DataConstants.ORDER_ID, RegexUtil.getOrderIdFromHybrisPattern(intent.getDataString())); } loginIntent.putExtra(DataConstants.INTENT_DESTINATION, DataConstants.INTENT_ORDER_DETAILS); loginIntent.putExtras(intent); startActivity(loginIntent); } }
From source file:com.stfalcon.contentmanager.ContentManager.java
private void handleFileContent(final Intent intent) { List<String> uris = new ArrayList<>(); if (intent.getDataString() != null) { String uri = intent.getDataString(); uris.add(uri);/*www . java 2 s. co m*/ } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { if (intent.getClipData() != null) { ClipData clipData = intent.getClipData(); for (int i = 0; i < clipData.getItemCount(); i++) { ClipData.Item item = clipData.getItemAt(i); Log.d("TAG", "Item [" + i + "]: " + item.getUri().toString()); uris.add(item.getUri().toString()); } } } if (intent.hasExtra("uris")) { ArrayList<Uri> paths = intent.getParcelableArrayListExtra("uris"); for (int i = 0; i < paths.size(); i++) { uris.add(paths.get(i).toString()); } } //TODO Handle multiple file choose processFile(uris.get(0)); }
From source file:com.zhongsou.souyue.activity.SplashActivity.java
/** * ??//from ww w . ja v a 2s . c om * * @return */ private boolean isFromWX() { boolean is = false; Intent intent = this.getIntent(); if (null == intent) is = false; String str = intent.getDataString() == null ? "" : intent.getDataString(); LogDebugUtil.v(LOG_TAG, "isFromWX.datastring=" + str); if (StringUtils.isNotEmpty(ShareApi.WEIXIN_APP_ID) && str.contains(ShareApi.WEIXIN_APP_ID)) { is = true; } return is; }
From source file:de.tap.easy_xkcd.Activities.MainActivity.java
private void handleIntent(Intent intent) { android.support.v4.app.FragmentManager fm = getSupportFragmentManager(); switch (intent.getAction()) { case Intent.ACTION_VIEW: //Get the ComicBrowserFragment and update it if (intent.getDataString().contains("what")) { MenuItem item = mNavView.getMenu().findItem(R.id.nav_whatif); selectDrawerItem(item, false); WhatIfActivity.WhatIfIndex = getNumberFromUrl(intent.getDataString(), 1); Intent whatIf = new Intent(MainActivity.this, WhatIfActivity.class); prefHelper.setLastWhatIf(WhatIfActivity.WhatIfIndex); startActivity(whatIf);/*from w w w.j a v a 2 s .c o m*/ } else { MenuItem item = mNavView.getMenu().findItem(R.id.nav_browser); selectDrawerItem(item, false); ComicFragment comicFragment = (ComicFragment) getSupportFragmentManager() .findFragmentByTag(BROWSER_TAG); comicFragment.lastComicNumber = getNumberFromUrl(intent.getDataString(), 0); comicFragment.scrollTo(comicFragment.lastComicNumber - 1, false); } break; case COMIC_INTENT: int number = getIntent().getIntExtra("number", 0); ComicFragment fragment = (ComicFragment) fm.findFragmentByTag(BROWSER_TAG); fragment.lastComicNumber = number; if (fragment instanceof ComicBrowserFragment) mProgress = ProgressDialog.show(this, "", this.getResources().getString(R.string.loading_comics), true); fragment.updatePager(); break; case WHATIF_INTENT: MenuItem item = mNavView.getMenu().findItem(R.id.nav_whatif); selectDrawerItem(item, false); WhatIfActivity.WhatIfIndex = intent.getIntExtra("number", 1); Intent whatIf = new Intent(MainActivity.this, WhatIfActivity.class); prefHelper.setLastWhatIf(WhatIfActivity.WhatIfIndex); startActivity(whatIf); break; } }
From source file:com.ibuildapp.romanblack.WebPlugin.WebPlugin.java
private void processResultV21(Intent data, int requestCode) { String dataString = data.getDataString(); Uri[] results = new Uri[] { Uri.parse(dataString) }; mUploadMessageV21.onReceiveValue(results); mUploadMessageV21 = null;//from w w w . j av a2s. c om return; }
From source file:com.juick.android.ThreadActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { if ((requestCode == ACTIVITY_ATTACHMENT_IMAGE || requestCode == ACTIVITY_ATTACHMENT_VIDEO)) { if (data != null) { attachmentUri = data.getDataString(); } else if (NewMessageActivity.getPhotoCaptureFile().exists()) { attachmentUri = Uri.fromFile(NewMessageActivity.getPhotoCaptureFile()).toString(); }/*from w w w .ja v a 2 s . c o m*/ if (requestCode == ACTIVITY_ATTACHMENT_IMAGE) { NewMessageActivity.maybeResizePicture(this, attachmentUri, new Utils.Function<Void, String>() { @Override public Void apply(String s) { attachmentUri = s; bAttach.setSelected(attachmentUri != null); return null; } }); } attachmentMime = (requestCode == ACTIVITY_ATTACHMENT_IMAGE) ? "image/jpeg" : "video/3gpp"; bAttach.setSelected(attachmentUri != null); } } }
From source file:org.openhab.habdroid.ui.OpenHABWidgetListActivity.java
/** * This method is called when activity receives a new intent while running *///from w w w.j a v a 2 s. c om @Override public void onNewIntent(Intent newIntent) { Log.d(TAG, "New intent received = " + newIntent.toString()); if (newIntent.getDataString() != null) { onNfcTag(newIntent.getDataString(), true); } }
From source file:de.ub0r.android.callmeter.ui.PlansFragment.java
@Override public void onClick(final View v) { switch (v.getId()) { case R.id.import_default: final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(this.getString(R.string.url_rulesets))); try {//from w ww . j av a 2 s .c o m startActivity(intent); } catch (ActivityNotFoundException e) { Log.e(TAG, "no activity to load url", e); Toast.makeText(getActivity(), "no activity to load url: " + intent.getDataString(), Toast.LENGTH_LONG).show(); } break; default: break; } }
From source file:org.deviceconnect.android.message.DevicePluginContext.java
/** * Device Connect Manager????????./*from www .j a v a2 s .c o m*/ * @param intent intent * @return ?true????false */ private boolean checkManagerUninstall(final Intent intent) { return Intent.ACTION_PACKAGE_FULLY_REMOVED.equals(intent.getAction()) && intent.getExtras().getBoolean(Intent.EXTRA_DATA_REMOVED) && intent.getDataString().contains("package:org.deviceconnect.android.manager"); }