List of usage examples for android.content Intent getExtras
public @Nullable Bundle getExtras()
From source file:com.karmick.android.citizenalert.alarm.AlarmAddActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); String contacts;//from w w w .j av a 2 s .c o m if (requestCode == GETCONTACTS) { if (resultCode == RESULT_OK) { Bundle extra = data.getExtras(); if (extra != null) { try { String names = ""; contacts = extra.getString("contacts"); Log.d(" Contacts >>", "" + contacts); if (contacts != null && !contacts.isEmpty()) { JSONArray jArr = new JSONArray(contacts); for (int i = 0; i < jArr.length(); i++) { JSONObject jObj = jArr.getJSONObject(i); contact_ids.add(Integer.parseInt(jObj.getString("id"))); names += jObj.getString("name") + " \n"; } alarm_contacts.setText(names); } } catch (JSONException e) { e.printStackTrace(); } } } } }
From source file:com.odoo.addons.sale.SalesDetail.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQUEST_ADD_ITEMS && resultCode == Activity.RESULT_OK) { lineValues.clear();// ww w .j a v a 2s. c om for (String key : data.getExtras().keySet()) { if (data.getExtras().getFloat(key) > 0) lineValues.put(key, data.getExtras().getFloat(key)); } OnProductChange onProductChange = new OnProductChange(); onProductChange.execute(lineValues); } }
From source file:com.cettco.buycar.activity.BargainActivity.java
protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (data == null) return;/* w w w. j a v a 2 s . c o m*/ //System.out.println("resultcode :" + resultCode + " requestcode:" //+ requestCode); Bundle b = data.getExtras(); switch (resultCode) { // resultCodeBRESULT_OK case RESULT_OK: // dataBIntent // int position = b.getInt("result"); if (requestCode == RESULT_COLOR) { colors = b.getStringArrayList("colors"); } else if (requestCode == RESULT_TIME) { getcarTimeSelection = b.getInt("result"); } else if (requestCode == RESULT_LOAN) { loanSelection = b.getInt("result"); } else if (requestCode == RESULT_LOCATION) { locationSelection = b.getInt("result"); } else if (requestCode == RESULT_PLATE) { plateSelection = b.getInt("result"); } else if (requestCode == RESULT_SHOP) { dealers = b.getStringArrayList("dealers"); //System.out.println("dealer size:" + dealers.size()); } break; default: break; } }
From source file:com.spondbob.bluetooth.BluetoothActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case 0://from w w w . j a va 2 s . c om if (resultCode == RESULT_OK) { Toast.makeText(this, "Bluetooth enabled", Toast.LENGTH_SHORT).show(); doDiscovery(); } else { Toast.makeText(this, "Bluetooth still disabled", Toast.LENGTH_SHORT).show(); } break; case 1: if (resultCode == RESULT_OK) { if (data.hasExtra("classId")) { doSendData(data.getExtras().getString("classId")); } else { Toast.makeText(this, "no selected class", Toast.LENGTH_SHORT).show(); } } break; } }
From source file:com.soomla.store.billing.google.GoogleIabHelper.java
/** * Workaround to bug where sometimes response codes come as Long instead of Integer *///w w w. j a v a2s . c om private int getResponseCodeFromIntent(Intent i) { Object o = i.getExtras().get(RESPONSE_CODE); if (o == null) { SoomlaUtils.LogError(TAG, "Intent with no response code, assuming OK (known issue)"); return IabResult.BILLING_RESPONSE_RESULT_OK; } else if (o instanceof Integer) return ((Integer) o).intValue(); else if (o instanceof Long) return (int) ((Long) o).longValue(); else { SoomlaUtils.LogError(TAG, "Unexpected type for intent response code."); SoomlaUtils.LogError(TAG, o.getClass().getName()); throw new RuntimeException("Unexpected type for intent response code: " + o.getClass().getName()); } }
From source file:com.mirasense.scanditsdk.plugin.ScanditSDK.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { ScanditSDKResultRelay.setCallback(null); if (resultCode == ScanditSDKActivity.SCAN || resultCode == ScanditSDKActivity.MANUAL) { String barcode = data.getExtras().getString("barcode"); String symbology = data.getExtras().getString("symbology"); JSONArray args = new JSONArray(); args.put(barcode);/*www. j a va 2 s .c om*/ args.put(symbology); mPendingOperation = false; mHandler.stop(); mCallbackContext.success(args); } else if (resultCode == ScanditSDKActivity.CANCEL) { mPendingOperation = false; mHandler.stop(); mCallbackContext.error("Canceled"); } }
From source file:org.rapidandroid.activity.FormReviewer.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { Bundle extras = null;/*from ww w . j ava2 s .c o m*/ super.onActivityResult(requestCode, resultCode, intent); if (intent != null) { extras = intent.getExtras(); switch (requestCode) { case ACTIVITY_FILE_BROWSE: // get the filename String filename = extras.getString("filename"); uploadFile(filename); break; default: break; } } }
From source file:co.uk.gauntface.mobile.devicelab.receiver.PushNotificationReceiver.java
@Override public void onReceive(Context context, Intent intent) { Log.v(C.TAG, "PushNotificationReceiver: Received Notification"); GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(context); String messageType = gcm.getMessageType(intent); if (GoogleCloudMessaging.MESSAGE_TYPE_SEND_ERROR.equals(messageType)) { //sendNotification("Send error: " + intent.getExtras().toString()); Log.e(C.TAG, "PushNotificationReceiver: MESSAGE_TYPE_SEND_ERROR"); } else if (GoogleCloudMessaging.MESSAGE_TYPE_DELETED.equals(messageType)) { Log.e(C.TAG, "PushNotificationReceiver: MESSAGE_TYPE_DELETED"); } else {/*from w w w. j a va 2s . c om*/ Bundle data = intent.getExtras(); if (data != null) { String dataString = data.getString("data"); Log.v(C.TAG, "PushNotificationReceiver: dataString = " + dataString); try { JSONObject dataObject = new JSONObject(dataString); String url = validateUrl(dataObject.optString("url")); String packageName = dataObject.optString("pkg"); if (url != null) { launchBrowserTask(context, url, packageName); } } catch (JSONException e) { Log.e(C.TAG, "PushNotificationReceiver: JSONException ", e); } } } setResultCode(Activity.RESULT_OK); }
From source file:com.jacr.instagramtrendreader.Main.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.activity_main); /* Customizing ActionBar */ Resources r = getResources(); ActionBar ab = super.getActionBar(false); ab.setIcon(r.getDrawable(R.drawable.ic_menu_home)); ab.setTitle(Util.getTitleActivity(getString(R.string.title_my_gallery_app))); /* Views *//* www . ja va 2 s . c o m*/ layoutThumbnail = (TableLayout) findViewById(R.id.layoutThumbnail); layoutThumbnail.setPadding(1, 1, 1, 1); /* Setting Viewpager and Indicator */ mPager = (ViewPager) findViewById(R.id.pagerMain); mAdapter = new ViewPagerAdapter<MainFragment>(getSupportFragmentManager()); mPager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageScrollStateChanged(int arg0) { } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageSelected(int arg0) { int key = feedReader.getListThumbnailKeys().get(arg0); feedReader.highlightThumbnail(key); } }); /* Receiver */ mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); Bundle extras = intent.getExtras(); if (action.contentEquals(ACTION_IMAGE_CLICK)) { int key = extras.getInt(ACTION_IMAGE_CLICK); if (key != -1) { Intent in = new Intent(Main.this, ImageDetails.class); Bundle b = new Bundle(); /* * Warning with Error FAILED BINDED TRANSACTION: it * happens When the transfer of "extras" out of memory. * in This case, when images are sent in intent. */ b.putSerializable(ImageDetails.KEY_THUMBNAIL_DATA, feedReader.getListThumbnailData()); b.putSerializable(ImageDetails.KEY_THUMBNAIL_KEYS, feedReader.getListThumbnailKeys()); b.putInt(ImageDetails.KEY_THUMBNAIL_ACTUAL_KEY, key); in.putExtras(b); startActivity(in); } } } }; IntentFilter filter = new IntentFilter(); filter.addAction(ACTION_IMAGE_CLICK); registerReceiver(mReceiver, filter); /* Load data from Instagram */ cargarFeedReader(); }
From source file:com.futurologeek.smartcrossing.crop.CropImageActivity.java
private void loadInput() { Intent intent = getIntent(); Bundle extras = intent.getExtras(); if (extras != null) { aspectX = extras.getInt(Crop.Extra.ASPECT_X); aspectY = extras.getInt(Crop.Extra.ASPECT_Y); maxX = extras.getInt(Crop.Extra.MAX_X); maxY = extras.getInt(Crop.Extra.MAX_Y); saveUri = extras.getParcelable(MediaStore.EXTRA_OUTPUT); }/*from ww w. java 2 s. c o m*/ sourceUri = intent.getData(); if (sourceUri != null) { exifRotation = CropUtil .getExifRotation(CropUtil.getFromMediaUri(this, getContentResolver(), sourceUri)); InputStream is = null; try { sampleSize = calculateBitmapSampleSize(sourceUri); is = getContentResolver().openInputStream(sourceUri); BitmapFactory.Options option = new BitmapFactory.Options(); option.inSampleSize = sampleSize; rotateBitmap = new RotateBitmap(BitmapFactory.decodeStream(is, null, option), exifRotation); } catch (IOException e) { Log.e("Error reading image: " + e.getMessage(), e); setResultException(e); } catch (OutOfMemoryError e) { Log.e("OOM reading image: " + e.getMessage(), e); setResultException(e); } finally { CropUtil.closeSilently(is); } } }