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.cssweb.android.base.DialogActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.zr_hq_mystock:
        if (!TradeUtil.checkUserLogin()) {
            FairyUI.switchToWnd(Global.QUOTE_USERSTK, Global.QUOTE_USERSTK, DialogActivity.this);
        } else {/*from w w  w .  j  a va  2 s  .  c  o  m*/
            FairyUI.switchToWnd(Global.QUOTE_USERSTK, null, null, null, DialogActivity.this);
        }
        break;
    case R.id.zr_hq_addstock:
        if (cssStock == null) {
            msg_info = "??";
            openDialog(msg_info);
        } else {
            if (!TradeUtil.checkUserLogin()) {
                FairyUI.switchToWnd(activityKind, activityKind, DialogActivity.this);
            } else {
                msg_info = StockPreference.shareStock(NameRule.getExchange(cssStock.getMarket()),
                        cssStock.getStkcode(), cssStock.getStkname(), DialogActivity.this);
                openDialog(msg_info);
            }
        }
        break;
    case R.id.zr_hq_quickbuy:
        buyStock();
        break;
    case R.id.zr_hq_quicksale:
        saleStock();
        break;
    case R.id.zr_hq_revocation:
        cancelStock();
        break;
    case R.id.zr_hq_gugle://???
        if (null == cssStock) {
            toast("??");
            return false;
        }
        Intent localIntent = new Intent();
        localIntent.putExtra("pos", Global.NJZQ_ZXLP_GG);
        localIntent.putExtra("stockcode", cssStock.getStkcode());
        localIntent.setClass(DialogActivity.this, WebViewDisplay.class);
        startActivity(localIntent);
        break;
    case R.id.zr_hq_fundtrade:
        if (TradeUser.getInstance().getLoginType() == 1 && TradeUtil.checkUserLogin()) {
            FairyUI.switchToWnd(Global.NJZQ_WTJY_TWO, 2, null, null, DialogActivity.this);
        } else {
            gotoLogin(Global.NJZQ_WTJY_TWO, Global.NJZQ_WTJY_TWO);
        }
        break;
    case R.id.zr_index:
        backIndex();
        break;
    case R.id.zr_hq_mystock_set:
        initStockBar();
        break;
    case R.id.zr_hq_remove:
        delMenuStock();
        break;
    case R.id.zr_hq_queryfund: //
        queryFund();
        break;

    case R.id.zr_hq_chicang://?
        if (TradeUser.getInstance().getLoginType() == 1 && TradeUtil.checkUserLogin()) {
            new AlertDialog.Builder(DialogActivity.this).setTitle(getResources().getString(R.string.alert_tip))
                    .setMessage(getResources().getString(R.string.importdata))
                    .setPositiveButton(getResources().getString(R.string.alert_dialog_ok),
                            new DialogInterface.OnClickListener() {
                                public void onClick(DialogInterface dialog, int whichButton) {
                                    addChiCang();
                                }
                            })
                    .setNegativeButton(getResources().getString(R.string.alert_dialog_cancel),
                            new DialogInterface.OnClickListener() {
                                public void onClick(DialogInterface dialog, int whichButton) {

                                }
                            })
                    .show();

        } else {
            gotoLogin(activityKind, activityKind);
        }
        break;
    case R.id.zr_hq_boom://?
        System.out.println("****" + "?");
        if (null == cssStock) {
            toast("??");
            return false;
        }
        Intent intent2StockRadar = new Intent(DialogActivity.this, StockRadar.class);
        Bundle StockRadarextras = new Bundle();
        StockRadarextras.putString("stockcode", cssStock.getStkcode());
        StockRadarextras.putString("stockname", cssStock.getStkname());
        //                StockRadarextras.putInt("exchange", cssStock.getExchange());
        StockRadarextras.putString("exchange", cssStock.getMarket());
        intent2StockRadar.putExtras(StockRadarextras);
        startActivity(intent2StockRadar);
        break;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.ebridgevas.android.ebridgeapp.messaging.mqttservice.MqttService.java

/**
 * pass data back to the Activity, by building a suitable Intent object and
 * broadcasting it//from   w w w . j  av a  2  s .c om
 *
 * @param clientHandle
 *            source of the data
 * @param status
 *            OK or Error
 * @param dataBundle
 *            the data to be passed
 */
void callbackToActivity(String clientHandle, Status status, Bundle dataBundle) {
    // Don't call traceDebug, as it will try to callbackToActivity leading
    // to recursion.
    Intent callbackIntent = new Intent(MqttServiceConstants.CALLBACK_TO_ACTIVITY);
    if (clientHandle != null) {
        callbackIntent.putExtra(MqttServiceConstants.CALLBACK_CLIENT_HANDLE, clientHandle);
    }
    callbackIntent.putExtra(MqttServiceConstants.CALLBACK_STATUS, status);
    if (dataBundle != null) {
        callbackIntent.putExtras(dataBundle);
    }
    LocalBroadcastManager.getInstance(this).sendBroadcast(callbackIntent);
}

From source file:com.forum.fiend.osp.SettingsFragment.java

private void taglineEditor() {

    Intent myIntent = new Intent(getActivity(), New_Post.class);

    Bundle bundle = new Bundle();
    bundle.putString("postid", "0");
    bundle.putString("parent", "0");
    bundle.putString("category", "0");
    bundle.putString("subforum_id", (String) "0");
    bundle.putString("original_text", (String) "");
    bundle.putString("boxTitle", (String) "Signature Editor");
    bundle.putString("picture", (String) "0");
    bundle.putString("color", (String) background);
    bundle.putString("subject", (String) "");
    bundle.putInt("post_type", (Integer) 6);
    myIntent.putExtras(bundle);

    startActivity(myIntent);/*from   w w  w  .  j av  a 2s .  c om*/
}

From source file:br.com.android.cotuca.toptask.Activitys.MSimplesActivity.java

@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
    int id = item.getItemId();
    TarefaDAO tarefas = TarefaDAO.getInstance(this);

    if (id == R.id.acction_concluir_tarefa) {
        tarefas.concluirTarefa(tarefaSelecionada);
        tarefaSelecionada = null;/*from ww w  . j  av a2  s .c om*/
        this.selectItem(0);
        mode.finish();
        return true;

    } else if (id == R.id.acction_editar_tarefa) {
        Intent iEditar = new Intent(this, EditarTarefa.class);
        Bundle dados = new Bundle();

        dados.putInt(Tags.B_ACAO, Tags.ACAO_EDITAR);
        dados.putString(ContratoTarefas.Colunas.NOME, tarefaSelecionada.getNome());
        dados.putString(ContratoTarefas.Colunas.DESCRICAO, tarefaSelecionada.getDescricao());
        dados.putString(ContratoTarefas.Colunas.DATA_ENTREGA, tarefaSelecionada.getDataEntrega());
        dados.putInt(Tags.ID_TAREFA, tarefaSelecionada.getID());
        dados.putInt(ContratoTarefas.Colunas.PROJETO, idProjetoSelecionado);
        dados.putInt(ContratoTarefas.Colunas.DONO, idUsuarioSelecionado);

        dados.putInt(ContratoTarefas.Colunas.TEMPO_FEITO, tarefaSelecionada.getTempoFeito());
        dados.putInt(ContratoTarefas.Colunas.TEMPO_LIMITE, tarefaSelecionada.getTempoLimite());

        iEditar.putExtras(dados);

        startActivity(iEditar);

        tarefaSelecionada = null;
        this.selectItem(0);
        mode.finish();
        return true;

    } else if (id == R.id.acction_excluir_tarefa) {

        tarefas.delete(tarefaSelecionada);
        tarefaSelecionada = null;
        this.selectItem(0);

        mode.finish();
        return true;
    } else if (id == R.id.acction_fazendo_tarefa) {

        tarefas.fazendoTarefa(tarefaSelecionada);
        tarefaSelecionada = null;
        this.selectItem(0);
        mode.finish();
        return true;

    }

    return false;
}

From source file:org.hfoss.posit.android.functionplugin.reminder.SetReminder.java

/**
 * Invoked when the Reminder plugin is selected from the FindActivity menu. Used
 * here to retrieve the Find's lat, long, and date from the FindActivity view.
 * // w  w  w. jav a 2s .  c  om
 * @param context, the calling Activity
 * @param find, the current Find
 * @param view, the FindActivity's content view
 * @param intent, the Intent that is passed to the menu activity
 */
public void menuItemSelectedCallback(Context context, Find find, View view, Intent intent) {
    Bundle bundle = new Bundle();
    TextView tv = (TextView) view.findViewById(R.id.timeValueTextView);
    bundle.putString("Date", tv.getText().toString());

    tv = (TextView) view.findViewById(R.id.longitudeValueTextView);
    bundle.putDouble("FindsLongitude", Double.parseDouble(tv.getText().toString()));
    tv = (TextView) view.findViewById(R.id.latitudeValueTextView);
    bundle.putDouble("FindsLatitude", Double.parseDouble(tv.getText().toString()));
    intent.putExtras(bundle);
}

From source file:com.test.onesignal.GenerateNotificationRunner.java

@Test
@Config(shadows = { ShadowGcmBroadcastReceiver.class })
public void shouldPreventOtherGCMReceiversWhenSettingEnabled() throws Exception {
    OneSignal.setInFocusDisplaying(OneSignal.OSInFocusDisplayOption.InAppAlert);
    OneSignal.startInit(blankActivity).filterOtherGCMReceivers(true).init();
    threadAndTaskWait();/*from   w ww . j a va 2s .  c  om*/

    Intent intentGcm = new Intent();
    intentGcm.setAction("com.google.android.c2dm.intent.RECEIVE");
    intentGcm.putExtra("message_type", "gcm");
    Bundle bundle = getBaseNotifBundle();
    bundle.putString("o", "[{\"n\": \"text1\", \"i\": \"id1\"}]");
    intentGcm.putExtras(bundle);

    GcmBroadcastReceiver gcmBroadcastReceiver = new GcmBroadcastReceiver();
    gcmBroadcastReceiver.onReceive(blankActivity, intentGcm);

    Assert.assertNull(ShadowGcmBroadcastReceiver.lastResultCode);
    Assert.assertTrue(ShadowGcmBroadcastReceiver.calledAbortBroadcast);
}

From source file:com.test.onesignal.GenerateNotificationRunner.java

@Test
@Config(shadows = { ShadowGcmBroadcastReceiver.class })
public void shouldSetButtonsCorrectly() throws Exception {
    Intent intentGcm = new Intent();
    intentGcm.setAction("com.google.android.c2dm.intent.RECEIVE");
    intentGcm.putExtra("message_type", "gcm");
    Bundle bundle = getBaseNotifBundle();
    bundle.putString("o", "[{\"n\": \"text1\", \"i\": \"id1\"}]");
    intentGcm.putExtras(bundle);

    GcmBroadcastReceiver gcmBroadcastReceiver = new GcmBroadcastReceiver();
    gcmBroadcastReceiver.onReceive(blankActivity, intentGcm);

    Intent intent = Shadows.shadowOf(blankActivity).getNextStartedService();
    Assert.assertEquals("com.onesignal.GcmIntentService", intent.getComponent().getClassName());

    JSONObject jsonPayload = new JSONObject(intent.getStringExtra("json_payload"));

    Assert.assertEquals(null, jsonPayload.optString("o", null));
    JSONObject customJson = new JSONObject(jsonPayload.optString("custom"));
    JSONObject additionalData = new JSONObject((customJson.getString("a")));
    Assert.assertEquals("id1", additionalData.getJSONArray("actionButtons").getJSONObject(0).getString("id"));
}

From source file:rpassmore.app.fillthathole.ViewHazardActivity.java

public void locateClickHandler(View view) {
    // display location map activity
    Intent myIntent = new Intent(view.getContext(), LocationActivity.class);

    Bundle bundle = new Bundle();
    if (hazard.getState() != Hazard.State.UNSUBMITTED) {
        bundle.putBoolean(LocationActivity.LOCATION_CAN_DRAG, false);
    } else {/*from  ww  w  . j  a va 2s  . c  om*/
        bundle.putBoolean(LocationActivity.LOCATION_CAN_DRAG, true);
    }

    if (hazard.getLattitude() != null && hazard.getLongitude() != null) {
        bundle.putLong(LocationActivity.LOCATION_LAT, (long) (hazard.getLattitude() * 1E6));
        bundle.putLong(LocationActivity.LOCATION_LONG, (long) (hazard.getLongitude() * 1E6));
        bundle.putBoolean(LocationActivity.LOCATION_CAN_CREATE, false);
    } else {
        bundle.putBoolean(LocationActivity.LOCATION_CAN_CREATE, true);
    }

    myIntent.putExtras(bundle);
    startActivityForResult(myIntent, LOCATION_MAP_ACTIVITY);
}

From source file:edu.cwru.apo.APO.java

public void onRestRequestComplete(API.Methods method, JSONObject result) {
    // check and see if the splash screen has been shown for the minimum amount of time
    // NOTE: This would probably be better done with a timer.  Need to change this
    while (Auth.getTimestamp() - STARTTIME < SPLASHTIME) {
        // do nothing.  This is probably not the right way to do this
    }//  www.jav a  2 s.co  m

    // set the next activity to default Login
    Intent nextActivity = new Intent(APO.this, Login.class);
    Bundle extras = new Bundle();

    if (method == Methods.checkCredentials) {
        if (result != null) {
            try {
                if (result.getString("requestStatus").compareTo("valid") == 0) {
                    //change the nextActivity to Home
                    Auth.loggedIn = true;
                    nextActivity = new Intent(APO.this, Home.class);
                } else if (result.getString("requestStatus").compareTo("No response") == 0) {
                    extras.putString("msg", "Could not contact web server. Please check your connection");
                } else {
                    extras.putString("msg", "Invalid credentials");
                }

            } catch (JSONException e) {
                extras.putString("msg", "JSON error: Invalid JSON response");
                e.printStackTrace();
            }
        } else {
            extras.putString("msg", "JSON error: No JSON Object to read");
        }
    } else {
        extras.putString("msg", "Invalid method called");
    }

    nextActivity.putExtras(extras);

    // start the next activity
    APO.this.startActivity(nextActivity);
    finish();
}

From source file:com.piggate.sdk.Piggate.java

public void postNotification(String title, String msg, Class myClass, int resource, Bundle extras,
        Boolean force) {/*from   ww  w. j a  v a 2 s . c  o m*/
    if (!getApplicationContext().getPackageName()
            .equalsIgnoreCase(((ActivityManager) getApplicationContext()
                    .getSystemService(getApplicationContext().ACTIVITY_SERVICE)).getRunningAppProcesses()
                            .get(0).processName)
            || force) {

        Intent notifyIntent = new Intent(_context, myClass);
        if (extras != null)
            notifyIntent.putExtras(extras);
        notifyIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);

        PendingIntent pendingIntent = PendingIntent.getActivities(_context, 0, new Intent[] { notifyIntent },
                PendingIntent.FLAG_UPDATE_CURRENT);
        Notification notification = new Notification.Builder(_context).setSmallIcon(resource)
                .setContentTitle(title).setContentText(msg).setAutoCancel(true).setContentIntent(pendingIntent)
                .build();
        notification.defaults |= Notification.DEFAULT_SOUND;
        notification.defaults |= Notification.DEFAULT_LIGHTS;
        notificationManager.notify(123, notification);
    }
}