List of usage examples for android.content Intent getParcelableExtra
public <T extends Parcelable> T getParcelableExtra(String name)
From source file:com.facebook.share.DeviceShareDialog.java
@Override protected void registerCallbackImpl(final CallbackManagerImpl callbackManager, final FacebookCallback<Result> callback) { callbackManager.registerCallback(getRequestCode(), new CallbackManagerImpl.Callback() { @Override//from www . j a v a 2 s .c om public boolean onActivityResult(int resultCode, Intent data) { if (data.hasExtra("error")) { FacebookRequestError error = data.getParcelableExtra("error"); callback.onError(error.getException()); return true; } callback.onSuccess(new Result()); return true; } }); }
From source file:com.frankegan.sqrshare.MainActivity.java
/** * A helper method for when an app shares an {@link android.content.Intent} to be opened by our app. * It changes the {@link android.widget.ImageView} to the image of the given intent. * * @param intent The {@link android.content.Intent} of the image to be displayed. *///from ww w . jav a 2 s.c o m private void handleSentImage(Intent intent) { Uri imageUri = intent.getParcelableExtra(Intent.EXTRA_STREAM); if (imageUri != null) try { holder = SqrBitmapGenerator.generate(this, imageUri); } catch (IOException e) { e.printStackTrace(); Log.i("frankegan", "IOException" + e.toString()); } else Log.i("frankegan", "bad intent"); }
From source file:com.liferay.alerts.activity.MainActivity.java
private void _registerAddCardReceiver() { _receiver = new BroadcastReceiver() { @Override// w ww. j ava 2 s . c o m public void onReceive(final Context context, Intent intent) { final Alert alert = intent.getParcelableExtra(Alert.ALERT); _alerts.add(alert); _addCard(alert); if (_paused) { AlertDAO dao = AlertDAO.getInstance(context); List<Alert> alerts = dao.getUnread(); NotificationUtil.notify(context, alerts); } else { NotificationUtil.cancel(context); } } }; _getBroadcastManager().registerReceiver(_receiver, new IntentFilter(ADD_CARD)); }
From source file:by.gdgminsk.animationguide.ContactDetailsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && getResources().getBoolean(R.bool.translucent_status)) { int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; getWindow().getDecorView().setSystemUiVisibility(flags); }//from w w w. java 2 s.co m setContentView(R.layout.activity_contact_details); mCurrentOrientation = getResources().getConfiguration().orientation; boolean land = mCurrentOrientation == Configuration.ORIENTATION_LANDSCAPE; if (savedInstanceState == null) { mInitialOrientation = mCurrentOrientation; } else { mInitialOrientation = savedInstanceState.getInt(KEY_INITIAL_ORIENTATION); } Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar ab = getSupportActionBar(); // getSupportActionBar() can't return null here because we set it one row above //noinspection ConstantConditions ab.setDisplayHomeAsUpEnabled(true); Intent intent = getIntent(); Contact contact = intent.getParcelableExtra(EXTRA_CONTACT); if (contact == null) { Log.e(LOG_TAG, "contact is not provided"); finish(); return; } mAppBarLayout = (AppBarLayout) findViewById(R.id.app_bar); mOverlay = findViewById(R.id.overlay); mPhotoView = (ImageView) findViewById(R.id.contact_photo); RecyclerView detailsList = (RecyclerView) findViewById(R.id.details_list); detailsList.setAdapter(new ContactDetailsAdapter(contact, this)); if (!land) { ObservableCollapsingToolbarLayout collapsingToolbar = (ObservableCollapsingToolbarLayout) findViewById( R.id.toolbar_layout); collapsingToolbar.setOnScrollListener(mOnScrollListener); mPhotoView.setOnClickListener(mPhotoClickListener); } ab.setTitle(contact.getName()); loadPhoto(contact); }
From source file:com.citrus.sample.PaymentPage.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); TransactionResponse transactionResponse = data .getParcelableExtra(Constants.INTENT_EXTRA_TRANSACTION_RESPONSE); if (transactionResponse != null) { //Log.d("Citrus", "transactionResponse :: " + transactionResponse.toString()); // Logger.d("transactionResponse ::" +transactionResponse.toString()); }//from www.j a v a 2 s . c o m }
From source file:com.sean.takeastand.alarmprocess.AlarmReceiver.java
@Override public void onReceive(Context context, Intent intent) { Log.i(TAG, "AlarmReceiver received alarm intent"); mContext = context;/* w w w .j a v a 2 s . co m*/ FixedAlarmSchedule currentAlarmSchedule = intent.getParcelableExtra(Constants.ALARM_SCHEDULE); if (currentAlarmSchedule != null) { if (!hasEndTimePassed(currentAlarmSchedule.getEndTime())) { Intent serviceStartIntent = new Intent(mContext, AlarmService.class); serviceStartIntent.putExtra(Constants.ALARM_SCHEDULE, currentAlarmSchedule); mContext.startService(serviceStartIntent); } else { //-1 indicates that there is no currently running scheduled alarm Utils.setRunningScheduledAlarm(mContext, -1); Log.i(TAG, context.getString(R.string.alarm_day_over)); Utils.setImageStatus(mContext, Constants.NO_ALARM_RUNNING); endAlarmService(); Utils.endSession(mContext); endSessionAnalytics(currentAlarmSchedule); } } else { //Unscheduled alarms Intent serviceStartIntent = new Intent(mContext, AlarmService.class); mContext.startService(serviceStartIntent); } }
From source file:com.orangelabs.rcs.ri.messaging.filetransfer.FileTransferIntentService.java
private void handleUndeliveredFileTransfer(Intent intent, String transferId) { ContactId contact = intent.getParcelableExtra(FileTransferIntent.EXTRA_CONTACT); if (contact == null) { if (LogUtils.isActive) { Log.e(LOGTAG, "Cannot read contact for ftId=".concat(transferId)); }/*from w w w .jav a 2 s . c o m*/ return; } if (LogUtils.isActive) { Log.d(LOGTAG, "Undelivered file transfer ID=" + transferId + " for contact " + contact); } forwardUndeliveredFileTransferToUi(intent, contact, transferId); }
From source file:com.example.popularmovies.MovieDetailActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_movie_detail); mContext = getApplicationContext();/* w w w .java 2s . c om*/ Intent receivedIntent = getIntent(); if (receivedIntent == null || !receivedIntent.hasExtra(Intent.EXTRA_STREAM)) { showError(); } mMovieSelected = (Movie) receivedIntent.getParcelableExtra(Intent.EXTRA_STREAM); if (mMovieSelected == null) { showError(); } TMDBUtils.fetchImage(mContext, ((ImageView) findViewById(R.id.iv_movie_backdrop)), mMovieSelected.getPosterPath(), TMDBUtils.IMAGE_SIZE.w780); ((TextView) findViewById(R.id.tv_movie_title)).setText(mMovieSelected.getTitle()); ((TextView) findViewById(R.id.tv_movie_release_date)).setText(mMovieSelected.getReleaseDate()); ((TextView) findViewById(R.id.tv_movie_vote_average)) .setText(Double.toString(mMovieSelected.getVoteAverage())); ((TextView) findViewById(R.id.tv_movie_plot_synopsis)).setText(mMovieSelected.getOverview()); }
From source file:com.github.marcosalis.kraken.utils.network.NetworkBroadcastReceiver.java
private void logNetworkInfo(@Nonnull Intent intent) { if (DroidConfig.DEBUG) { // debugging network info final NetworkInfo otherNetworkInfo = (NetworkInfo) intent .getParcelableExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO); final String reason = intent.getStringExtra(ConnectivityManager.EXTRA_REASON); final boolean failover = intent.getBooleanExtra(ConnectivityManager.EXTRA_IS_FAILOVER, false); Log.i(TAG,//from ww w . ja v a 2s .com "Network info: " + " otherNetworkInfo = " + (otherNetworkInfo == null ? "[none]" : otherNetworkInfo) + ", failover=" + failover + ", reason=" + reason); } }
From source file:com.locadz.AdUnitAllocationService.java
@Override protected void onHandleIntent(Intent intent) { AdUnitContext adUnitContext = (AdUnitContext) intent .getParcelableExtra(IntentConstants.EXTRA_ADUNIT_CONTEXT); AdUnitAllocation adUnitAllocation = getAdUnitAllocation(adUnitContext); if (adUnitAllocation != null) { Ration ration = getRandomRation(adUnitAllocation.getRations()); // send response through broadcast mechanism. // all active LocadzLayout will receive this message, they have to filter message by themselves. Intent response = new Intent(IntentConstants.ACTION_SHOW_AD); response.putExtra(IntentConstants.EXTRA_ADUNIT_ID, adUnitContext.getAdUnitId()); response.putExtra(IntentConstants.EXTRA_RATION, ration); response.putExtra(IntentConstants.EXTRA_EXTRA, adUnitAllocation.getExtra()); sendBroadcast(response);/*from w w w . ja v a 2 s .c o m*/ } }