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.prey.json.actions.Geofencing.java

public void stop(Context ctx, List<ActionResult> lista, JSONObject parameters) {

    Bundle bundle = new Bundle();

    bundle.putInt("type", ProxAlertActivity.STOP);

    Intent popup = new Intent(ctx, ProxAlertActivity.class);
    popup.putExtras(bundle);
    popup.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    ctx.startActivity(popup);//  w  w  w .  j  a v  a  2s  .  co m

    PreyLogger.i("Finish Geofencing stop");

}

From source file:ca.mudar.snoozy.ui.activity.BaseActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    if (item.getItemId() == android.R.id.home) {
        // Respond to the action bar's Up/Home button
        NavUtils.navigateUpFromSameTask(this);
        return true;
    } else if (item.getItemId() == R.id.action_settings) {
        Intent intent = new Intent(this, SettingsActivity.class);
        startActivity(intent);//  ww w  .  j  a va  2  s  .co m
        return true;
    } else if (item.getItemId() == R.id.action_about) {
        Intent intent = new Intent(this, AboutActivity.class);
        startActivity(intent);
        return true;
    } else if (item.getItemId() == R.id.action_eula) {
        Intent intent = new Intent(this, EulaActivity.class);
        startActivity(intent);
        return true;
    } else if (item.getItemId() == R.id.action_share) {
        /*
         Native sharing
          */
        final Bundle extras = new Bundle();
        extras.putString(Intent.EXTRA_SUBJECT, getResources().getString(R.string.share_intent_title));
        extras.putString(Intent.EXTRA_TEXT, Const.URL_PLAYSTORE);

        final Intent sendIntent = new Intent();
        sendIntent.putExtras(extras);
        sendIntent.setAction(Intent.ACTION_SEND);
        sendIntent.setType(this.SEND_INTENT_TYPE);
        startActivity(sendIntent);
    } else if (item.getItemId() == R.id.action_rate) {
        /*
         Launch Playstore to rate app
          */
        final Intent viewIntent = new Intent(Intent.ACTION_VIEW);
        viewIntent.setData(Uri.parse(Const.URL_PLAYSTORE));
        startActivity(viewIntent);
    }

    return super.onOptionsItemSelected(item);
}

From source file:com.prey.json.actions.Geofencing.java

public void start(Context ctx, List<ActionResult> lista, JSONObject parameters) {

    try {//from  ww  w  .java  2s  .  c  o m

        String origin = parameters.getString("origin");
        String[] centralPoints = origin.split(",");
        String longitude = centralPoints[0];
        String latitude = centralPoints[1];
        String radius = parameters.getString("radius");

        Bundle bundle = new Bundle();
        bundle.putDouble("longitude", Double.parseDouble(longitude));
        bundle.putDouble("latitude", Double.parseDouble(latitude));
        bundle.putFloat("radius", Float.parseFloat(radius));
        bundle.putInt("type", ProxAlertActivity.START);

        Intent popup = new Intent(ctx, ProxAlertActivity.class);
        popup.putExtras(bundle);
        popup.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        ctx.startActivity(popup);

        PreyLogger.i("Finish Geofencing start");

    } catch (JSONException e) {
        PreyLogger.e("Error en json:" + e.getMessage(), e);
        PreyWebServices.getInstance().sendNotifyActionResultPreyHttp(ctx,
                UtilJson.makeMapParam("start", "geofence", "failed", e.getMessage()));
    }

}

From source file:com.geekandroid.sdk.base.BaseFragment.java

public void startActivity(Class<?> cls, Bundle extras) {
    Intent intent = new Intent(getActivity(), cls);
    intent.putExtras(extras);
    startActivity(intent);//from  w w w. jav a 2s. com
}

From source file:com.geekandroid.sdk.base.BaseFragment.java

public void startActvityForResult(Class<?> cls, int requestCode, Bundle extras) {
    Intent intent = new Intent(getActivity(), cls);
    intent.putExtras(extras);
    startActivityForResult(intent, requestCode);
}

From source file:com.chess.genesis.activity.GameListFrag.java

protected void loadGame(final Bundle gamedata) {
    if (isTablet) {
        final boolean isOnline = gamedata.containsKey("gameid");
        final int gametype = Integer.parseInt(gamedata.getString("gametype"));
        final MenuBarFrag gameMenu = new MenuBarFrag();
        final BoardNavFrag gameNav = new BoardNavFrag();
        final GameFrag gameFrag = (gametype == Enums.GENESIS_CHESS) ? new GenGameFrag() : new RegGameFrag();
        gameFrag.setArguments(gamedata);
        gameFrag.setMenuBarFrag(gameMenu);

        // Pop game if already loaded
        fragMan.popBackStack(gameFrag.getBTag(), FragmentManager.POP_BACK_STACK_INCLUSIVE);

        FragmentTransaction ftrans = fragMan.beginTransaction()
                .replace(R.id.topbar02, gameMenu, gameMenu.getBTag())
                .replace(R.id.botbar02, gameNav, gameNav.getBTag())
                .replace(R.id.panel02, gameFrag, gameFrag.getBTag());

        // setup chat window
        if (isOnline) {
            final MenuBarFrag msgMenu = new MenuBarFrag();
            final BaseContentFrag msgFrag = new MsgBoxFrag();
            msgFrag.setArguments(gamedata);
            msgFrag.setMenuBarFrag(msgMenu);

            ftrans = ftrans.replace(R.id.topbar03, msgMenu, msgMenu.getBTag()).replace(R.id.panel03, msgFrag,
                    msgFrag.getBTag());//  w w  w.j a  v  a  2  s  .  co  m
        }
        ftrans.addToBackStack(gameFrag.getBTag()).commit();
    } else {
        final Intent intent = new Intent(act, Game.class);
        intent.putExtras(gamedata);
        startActivity(intent);
    }
}

From source file:com.nadmm.airports.aeronav.AeroNavService.java

protected void sendResult(String action, Bundle extras) {
    Intent result = new Intent();
    result.setAction(action);
    result.putExtras(extras);//  w w w.  j  a  v a2 s .  co m
    LocalBroadcastManager bm = LocalBroadcastManager.getInstance(this);
    bm.sendBroadcast(result);
}

From source file:com.facebook.internal.FacebookDialogFragment.java

private void onCompleteWebFallbackDialog(Bundle values) {
    FragmentActivity fragmentActivity = getActivity();

    Intent resultIntent = new Intent();
    resultIntent.putExtras(values == null ? new Bundle() : values);

    fragmentActivity.setResult(Activity.RESULT_OK, resultIntent);
    fragmentActivity.finish();//ww  w.  jav a  2  s  . c o m
}

From source file:com.aniruddhc.acemusic.player.Dialogs.BlacklistManagerDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    String[] blacklistManagerChoices = {
            getActivity().getResources().getString(R.string.manage_blacklisted_artists),
            getActivity().getResources().getString(R.string.manage_blacklisted_albums),
            getActivity().getResources().getString(R.string.manage_blacklisted_songs),
            getActivity().getResources().getString(R.string.manage_blacklisted_playlists) };

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    //Set the dialog title.
    builder.setTitle(R.string.blacklist_manager);
    builder.setItems(blacklistManagerChoices, new OnClickListener() {

        @Override/*from   www  .jav  a2 s .c o  m*/
        public void onClick(DialogInterface dialog, int which) {
            Bundle bundle = new Bundle();

            if (which == 0) {
                bundle.putString("MANAGER_TYPE", "ARTISTS");
            } else if (which == 1) {
                bundle.putString("MANAGER_TYPE", "ALBUMS");
            } else if (which == 2) {
                bundle.putString("MANAGER_TYPE", "SONGS");
            } else if (which == 3) {
                bundle.putString("MANAGER_TYPE", "PLAYLISTS");
            }

            dialog.dismiss();
            Intent intent = new Intent(getActivity(), BlacklistManagerActivity.class);
            intent.putExtras(bundle);
            startActivity(intent);

        }

    });

    return builder.create();
}

From source file:cn.jarlen.richcommon.ui.FragmentContainerActivity.java

@Override
public void finish() {
    Intent mIntent = new Intent();
    if (resultBundle != null)
        mIntent.putExtras(resultBundle);
    setResult(ACTIVITY_REULT, mIntent);/*w ww  . j  a  v a 2 s. c o m*/
    super.finish();
    overridePendingTransition(R.anim.anim_right_in, R.anim.anim_right_out);
}