List of usage examples for android.content Intent getParcelableExtra
public <T extends Parcelable> T getParcelableExtra(String name)
From source file:com.github.pockethub.ui.issue.IssuesFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK && requestCode == ISSUE_FILTER_EDIT && data != null) { IssueFilter newFilter = (IssueFilter) data.getParcelableExtra(EXTRA_ISSUE_FILTER); if (!filter.equals(newFilter)) { filter = newFilter;//from w w w . j ava 2 s . c o m updateFilterSummary(); pager.reset(); refreshWithProgress(); return; } } if (requestCode == ISSUE_VIEW) { notifyDataSetChanged(); forceRefresh(); return; } if (requestCode == ISSUE_CREATE && resultCode == RESULT_OK) { Issue created = data.getParcelableExtra(EXTRA_ISSUE); forceRefresh(); startActivityForResult(IssuesViewActivity.createIntent(created, repository), ISSUE_VIEW); return; } super.onActivityResult(requestCode, resultCode, data); }
From source file:eu.andlabs.studiolounge.gcp.GCPService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { log("on startCommand id=" + startId + " flags=" + flags); mApp = (Messenger) intent.getParcelableExtra("messenger"); packagename = intent.getExtras().getString("packageName"); mName = intent.getExtras().getString("name"); if (mSocketIO.isConnected() && loggedIn) mSocketIO.emit("state"); else// www . ja va 2s. c om connect(); return START_NOT_STICKY; }
From source file:com.microblink.barcode.MenuActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == MY_REQUEST_CODE && resultCode == BaseScanActivity.RESULT_OK) { // First, obtain recognition result RecognitionResults results = data.getParcelableExtra(BaseScanActivity.EXTRAS_RECOGNITION_RESULTS); showResults(results);/* w w w . j a v a 2 s .c om*/ } }
From source file:com.auth0.lock.core.AuthenticationReceiver.java
@Override public final void onReceive(Context context, Intent intent) { if (LockBaseActivity.CANCEL_ACTION.equals(intent.getAction())) { callback.onUserCanceled();//from w ww. j a v a2s . c om } if (LockBaseActivity.CHANGE_PASSWORD_ACTION.equals(intent.getAction())) { callback.onUserChangedPassword(); } if (LockBaseActivity.AUTHENTICATION_ACTION.equals(intent.getAction())) { UserProfile profile = intent .getParcelableExtra(LockBaseActivity.AUTHENTICATION_ACTION_PROFILE_PARAMETER); Token token = intent.getParcelableExtra(LockBaseActivity.AUTHENTICATION_ACTION_TOKEN_PARAMETER); if (token == null && profile == null) { callback.onUserSignedUp(); } else { callback.onUserAuthenticated(profile, token); } } broadcastManager.unregisterReceiver(this); }
From source file:de.j4velin.wifiAutoOff.Locations.java
@Override protected void onActivityResult(int requestCode, int resultCode, final Intent data) { if (requestCode == REQUEST_LOCATION) { if (resultCode == RESULT_OK) { LatLng location = data.getParcelableExtra("location"); String locationName = "UNKNOWN"; if (Geocoder.isPresent()) { Geocoder gc = new Geocoder(this); try { List<Address> result = gc.getFromLocation(location.latitude, location.longitude, 1); if (result != null && !result.isEmpty()) { Address address = result.get(0); locationName = address.getAddressLine(0); if (address.getLocality() != null) { locationName += ", " + address.getLocality(); }//from w ww . j a v a2 s.c o m } } catch (IOException e) { if (BuildConfig.DEBUG) Logger.log(e); e.printStackTrace(); } } Database db = Database.getInstance(this); db.addLocation(locationName, location); db.close(); locations.add(new Location(locationName, location)); mAdapter.notifyDataSetChanged(); } } else if (requestCode == REQUEST_BUY) { if (resultCode == RESULT_OK) { if (data.getIntExtra("RESPONSE_CODE", 0) == 0) { try { JSONObject jo = new JSONObject(data.getStringExtra("INAPP_PURCHASE_DATA")); PREMIUM_ENABLED = jo.getString("productId").equals("de.j4velin.wifiautomatic.billing.pro") && jo.getString("developerPayload").equals(getPackageName()); getSharedPreferences("settings", Context.MODE_PRIVATE).edit() .putBoolean("pro", PREMIUM_ENABLED).commit(); if (PREMIUM_ENABLED) { Toast.makeText(this, "Thank you!", Toast.LENGTH_SHORT).show(); } } catch (Exception e) { if (BuildConfig.DEBUG) Logger.log(e); Toast.makeText(this, e.getClass().getName() + ": " + e.getMessage(), Toast.LENGTH_LONG) .show(); } } } } else { super.onActivityResult(requestCode, resultCode, data); } }
From source file:com.facebook.notifications.internal.activity.CardActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); appEventsLogger = new AppEventsLogger(this); Intent intent = getIntent(); campaignIdentifier = intent.getStringExtra(EXTRA_CAMPAIGN_IDENTIFIER); String payloadString = intent.getStringExtra(EXTRA_CARD_PAYLOAD); CardConfiguration configuration = intent.getParcelableExtra(EXTRA_CONFIGURATION); AssetManager assetManager = intent.getParcelableExtra(EXTRA_ASSET_MANAGER); ContentManager contentManager = intent.getParcelableExtra(EXTRA_CONTENT_MANAGER); assetManager = assetManager != null ? assetManager : new AssetManager(); contentManager = contentManager != null ? contentManager : new ContentManager(); assetManager.setContext(this); contentManager.setContext(this); this.assetManager = assetManager; this.contentManager = contentManager; try {/*from w ww .j av a 2 s . c om*/ configurationPayload = new JSONObject(payloadString); } catch (JSONException ex) { Log.e(LOG_TAG, "Error parsing JSON payload", ex); } if (configuration == null) { beginLoadingContent(); } else { displayConfiguration(configuration); } appEventsLogger.logPushOpen(campaignIdentifier); }
From source file:com.demo.firebase.MainActivity.java
private void onUploadResultIntent(Intent intent) { // Got a new intent from MyUploadService with a success or failure mDownloadUrl = intent.getParcelableExtra(MyUploadService.EXTRA_DOWNLOAD_URL); mFileUri = intent.getParcelableExtra(MyUploadService.EXTRA_FILE_URI); updateUI(mAuth.getCurrentUser());// ww w.ja v a 2 s . c om }
From source file:com.pixby.texo.MainActivity.java
private void handleImageOpenIntent(Intent intent) { if (intent != null) { Tracker.trackSimpleEvent(this, Tracker.Event.LOAD_IMAGE); Uri imageUri = intent.getParcelableExtra(Intent.EXTRA_STREAM); loadImage(imageUri, mStageView); mEditPresenter.setImageChanged(true); }/*from w w w .j av a 2s .c o m*/ }
From source file:com.tangyu.component.service.sync.TYSyncService.java
@Override protected void onHandleIntent(Intent intent) { if (intent == null) return;//from w ww . java2s. c om if (!intent.hasExtra(INTENT_CONFIG)) { throw new NullPointerException( "Not found the key of INTENT_DATA in intent extra, It's couldn't be null"); } mConfig = intent.getParcelableExtra(INTENT_CONFIG); mData = intent.getParcelableArrayListExtra(INTENT_DATA); if (null == mData) { mData = new LinkedList(); } if (!isHandleIntent(intent)) return; onPreExecute(mConfig, mData); TYResponseResult responseResult = executeByModel(mConfig, mData); onPostExecute(responseResult); Intent responseIntent = new Intent(ACTION_TYSYNC_RESPONSE); responseIntent.putExtra(INTENT_RESPONSE_SUCCESS, responseResult.isSuccess); responseIntent.putExtra(INTENT_RESPONSE_CONTENT, responseResult.content); sendBroadcast(responseIntent); // Util.v("Action = " + ACTION_TYSYNC_RESPONSE); }
From source file:com.pileproject.drive.setting.machine.BluetoothMachineSelectFragment.java
private void subscribeBluetoothDiscovery() { mSubscriptions.add(/* w ww .j av a 2 s . com*/ RxBluetoothBroadcastReceiver.bluetoothDeviceFound(getActivity()).subscribeOn(Schedulers.newThread()) // should run on UI thread (main thread) to change UI components .observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<Intent>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { } @Override public void onNext(Intent intent) { BluetoothDevice bluetoothDevice = intent .getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); if (bluetoothDevice.getBondState() == BluetoothDevice.BOND_BONDED) { return; } BluetoothMachineListAdapter adapter = (BluetoothMachineListAdapter) mNewDevicesListView .getAdapter(); if (adapter.contains(bluetoothDevice)) { return; } adapter.add(bluetoothDevice); adapter.notifyDataSetChanged(); } })); mSubscriptions.add(RxBluetoothBroadcastReceiver.bluetoothDiscoveryFinished(getActivity()) .observeOn(AndroidSchedulers.mainThread()).subscribeOn(Schedulers.newThread()) .subscribe(new Observer<Intent>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { } @Override public void onNext(Intent intent) { // enable continuous discovering BluetoothAdapter.getDefaultAdapter().startDiscovery(); } })); }