Example usage for android.content Intent putExtras

List of usage examples for android.content Intent putExtras

Introduction

In this page you can find the example usage for android.content Intent putExtras.

Prototype

public @NonNull Intent putExtras(@NonNull Bundle extras) 

Source Link

Document

Add a set of extended data to the intent.

Usage

From source file:com.amytech.android.library.views.imagechooser.api.VideoChooserManager.java

private String captureVideoPatchedMethodForGingerbread() throws Exception {
    try {//from   w  w w.j a v  a2s  .c  o  m
        Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
        if (extras != null) {
            intent.putExtras(extras);
        }
        startActivity(intent);
    } catch (ActivityNotFoundException e) {
        throw new Exception("Activity not found");
    }
    return null;
}

From source file:mad.codeforcommunity.CalendarView.java

public void loadEventView(View v) {
    TextView date = (TextView) v.findViewById(R.id.date);
    ImageView image = (ImageView) v.findViewById(R.id.date_icon);
    if (date instanceof TextView && !date.getText().equals("")) {
        if (image.getVisibility() == View.VISIBLE) {
            /*OLD CODE//from   w  w  w  .j  av  a2s.c o m
             * Intent intent = new Intent();
            String day = date.getText().toString();
            if(day.length()==1) {
              day = "0"+day;
            }
            // return chosen date as string format 
            intent.putExtra("date", android.text.format.DateFormat.format("yyyy-MM", month)+"-"+day);
            setResult(RESULT_OK, intent);
            finish();
             */

            Bundle extras = new Bundle();
            String day = date.getText().toString();
            if (day.length() == 1) {
                day = "0" + day;
            }
            // return chosen date as string format 
            extras.putString("date", android.text.format.DateFormat.format("yyyy-MM", month) + "-" + day);

            Intent intent = new Intent(CalendarView.this, EventView.class);
            intent.putExtras(extras);

            startActivity(intent);
        }

    }
}

From source file:com.epitrack.guardioes.view.base.BaseActivity.java

@Override
public void navigateTo(final Class<? extends Activity> activityClass, final Bundle bundle) {

    final Intent intent = new Intent(this, activityClass);

    intent.putExtras(bundle);

    startActivity(intent);//from w  ww .  j  a  v  a 2  s. c o  m
}

From source file:com.epitrack.guardioes.view.base.BaseActivity.java

@Override
public void navigateForResult(final Class<? extends Activity> activityClass, final int requestCode,
        final Bundle bundle) {

    final Intent intent = new Intent(this, activityClass);

    intent.putExtras(bundle);

    startActivityForResult(intent, requestCode);
}

From source file:be.evias.cloudLogin.cloudLoginMainActivity.java

private void processLogoutServerSide(final Account account) {
    new AsyncTask<String, Void, Intent>() {
        @Override//from  ww  w  . j  a  v a 2s .  c  o  m
        protected Intent doInBackground(String... params) {

            Bundle data = new Bundle();
            try {
                sServerAuthenticate.userSignOut(mContext, account.name);
                data.putString(AccountManager.KEY_ACCOUNT_NAME, account.name);

                Log.d("cloudLogin", "cloudloginMainActivity/logoutAccount: userSignOut successful.");
                showMessage(mContext.getString(R.string.message_logout_success), Toast.LENGTH_SHORT);
            } catch (Exception e) {
                Log.d("cloudLogin", "cloudloginMainActivity/logoutAccount: userSignOut error.");
                e.printStackTrace();
                data.putString(KEY_ERROR_MESSAGE, e.getMessage());
            }

            final Intent res = new Intent();
            res.putExtras(data);
            return res;
        }

        @Override
        protected void onPostExecute(Intent intent) {
            if (intent.hasExtra(KEY_ERROR_MESSAGE))
                Toast.makeText(getBaseContext(), intent.getStringExtra(KEY_ERROR_MESSAGE), Toast.LENGTH_SHORT)
                        .show();
            else
                finishLogout(intent);
        }
    }.execute();
}

From source file:com.bellman.bible.android.view.activity.search.SearchIndexProgressStatus.java

/**
 * check index exists and go to search screen if index exists
 * if no more jobs in progress and no index then error
 *///from w w w .ja  v  a2 s .c  o  m
@Override
protected void jobFinished(Progress jobJustFinished) {
    // give the document up to 12 secs to reload - the Progress declares itself finished before the index status has been changed
    int attempts = 0;
    while (!IndexStatus.DONE.equals(documentBeingIndexed.getIndexStatus()) && attempts++ < 6) {
        CommonUtils.pause(2);
    }

    // if index is fine then goto search
    if (IndexStatus.DONE.equals(documentBeingIndexed.getIndexStatus())) {
        Log.i(TAG, "Index created");
        Intent intent = null;
        if (StringUtils.isNotEmpty(getIntent().getStringExtra(SearchControl.SEARCH_TEXT))) {
            // the search string was passed in so execute it directly
            intent = new Intent(this, SearchResults.class);
            intent.putExtras(getIntent().getExtras());
        } else {
            // just go to the normal Search screen
            intent = new Intent(this, Search.class);
        }
        startActivity(intent);
        finish();
    } else {
        // if jobs still running then just wait else error

        if (isAllJobsFinished()) {
            Log.e(TAG, "Index finished but document's index is invalid");
            Dialogs.getInstance().showErrorMsg(R.string.error_occurred);
        }
    }
}

From source file:fi.mikuz.boarder.gui.internet.Login.java

private void logout() {
    Bundle bundle = new Bundle();
    bundle.putSerializable(InternetMenu.LOGIN_KEY, null);

    Intent intent = new Intent();
    intent.putExtras(bundle);

    bundle.putString(InternetMenu.ACCOUNT_MESSAGE_KEY, "");
    setResult(RESULT_OK, intent);//from w  w  w  .jav  a 2  s  . com
    try {
        finish();
    } catch (Throwable e) {
        Log.e(TAG, "Couldn't finish", e);
    }
}

From source file:net.bible.android.view.activity.search.SearchIndexProgressStatus.java

/**
 * check index exists and go to search screen if index exists 
 * if no more jobs in progress and no index then error
 *
 *//*www  .j  a v a2s  . c  o  m*/
@Override
protected void jobFinished(Progress jobJustFinished) {
    // give the document up to 12 secs to reload - the Progress declares itself finished before the index status has been changed
    int attempts = 0;
    while (!IndexStatus.DONE.equals(documentBeingIndexed.getIndexStatus()) && attempts++ < 6) {
        CommonUtils.pause(2);
    }

    // if index is fine then goto search
    if (IndexStatus.DONE.equals(documentBeingIndexed.getIndexStatus())) {
        Log.i(TAG, "Index created");
        Intent intent = null;
        if (StringUtils.isNotEmpty(getIntent().getStringExtra(SearchControl.SEARCH_TEXT))) {
            // the search string was passed in so execute it directly
            intent = new Intent(this, SearchResults.class);
            intent.putExtras(getIntent().getExtras());
        } else {
            // just go to the normal Search screen
            intent = new Intent(this, Search.class);
        }
        startActivity(intent);
        finish();
    } else {
        // if jobs still running then just wait else error

        if (isAllJobsFinished()) {
            Log.e(TAG, "Index finished but document's index is invalid");
            showErrorMsg(R.string.error_occurred);
        }
    }
}

From source file:com.android.managedprovisioning.DeviceOwnerProvisioningActivity.java

private void startDeviceOwnerProvisioningService() {
    Intent intent = new Intent(this, DeviceOwnerProvisioningService.class);
    intent.putExtras(getIntent());
    startService(intent);/*from  w  w  w  . ja va 2  s  .co  m*/
}

From source file:com.foi.air1603.sport_manager.sevices.MyFirebaseMessagingService.java

/**
 * Create and show a simple notification containing the received FCM message.
 *
 * @param messageBody FCM message body received.
 *//*ww w  . j  a  v a2  s .  co m*/
private void sendNotification(Map<String, String> messageBody) {
    Intent intent = new Intent(this, MainActivity.class);

    Bundle bundle = new Bundle();
    bundle.putString("user", messageBody.get("user"));
    bundle.putString("reservation_id", messageBody.get("reservation_id"));
    intent.putExtras(bundle);

    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
            PendingIntent.FLAG_ONE_SHOT);

    // messageBody se sastoji od: user, reservation_id
    Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
            .setSmallIcon(R.mipmap.ic_event_white_48dp).setColor(getResources().getColor(R.color.green))
            .setContentTitle("Novi invite!")
            .setContentText(messageBody.get("user") + " te pozvao u novi termin!").setAutoCancel(true)
            .setSound(defaultSoundUri).setContentIntent(pendingIntent);

    if (MainActivity.user == null || MainActivity.user.hide_notifications == 0) {
        return;
    }

    NotificationManager notificationManager = (NotificationManager) getSystemService(
            Context.NOTIFICATION_SERVICE);

    notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());

    // PAZI! nisam siguran je li se i MainActivity:handleSystemTrayNotification() koristi

}