Example usage for android.os Bundle getString

List of usage examples for android.os Bundle getString

Introduction

In this page you can find the example usage for android.os Bundle getString.

Prototype

@Nullable
public String getString(@Nullable String key) 

Source Link

Document

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Usage

From source file:de.appplant.cordova.plugin.notification.AbstractClearReceiver.java

/**
 * Called when the notification was cleared from the notification center.
 *
 * @param context//from  w ww .j a v a  2s  .c  o  m
 *      Application context
 * @param intent
 *      Received intent with content data
 */
@Override
public void onReceive(Context context, Intent intent) {
    Bundle bundle = intent.getExtras();
    JSONObject options;

    try {
        String data = bundle.getString(Options.EXTRA);
        options = new JSONObject(data);
    } catch (JSONException e) {
        e.printStackTrace();
        return;
    }

    Notification notification = new Builder(context, options).build();

    onClear(notification);
}

From source file:br.ajmarques.cordova.plugin.localnotification.ReceiverActivity.java

/** Called when the activity is first created. */
@Override/*from w  w w  . j  a v a  2  s .  co  m*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Intent intent = this.getIntent();
    Bundle bundle = intent.getExtras();

    try {
        JSONObject args = new JSONObject(bundle.getString(Receiver.OPTIONS));
        Options options = new Options(getApplicationContext()).parse(args);

        launchMainIntent();
        invokeBackgroundCallback(options);
    } catch (JSONException e) {
    }
}

From source file:com.google.samples.apps.friendlyping.gcm.MyGcmListenerService.java

private Ping getNewPing(Bundle data) throws JSONException {
    final Bundle notificationData = data.getBundle(PingKeys.NOTIFICATION);
    return new Ping(notificationData.getString(PingKeys.NOTIFICATION_BODY), data.getString(PingKeys.SENDER));
}

From source file:com.cssweb.android.quote.FLineActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bundle bundle = getIntent().getExtras();
    this.exchange = bundle.getString("exchange");
    this.stockcode = bundle.getString("stockcode");
    this.stockname = bundle.getString("stockname");
    setContentView(R.layout.zr_fundline_view);
    initTitle(R.drawable.njzq_title_left_back, 0, "");
    //setTitle("");
    ftrendView = (FTrendView) findViewById(R.id.zrviewftrend);
    ftrendView.setFocusable(true);//from ww  w. j ava  2s.c o  m
    ftrendView.requestFocus();
    showProgress();
}

From source file:com.manning.androidhacks.hack047.fragments.ColorFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final Bundle bundle = getArguments();
    if (bundle != null) {
        mColor = bundle.getInt(COLOR_KEY);
        mText = bundle.getString(TEXT_KEY);
    }/*from w  ww  . ja v  a  2 s . com*/
}

From source file:com.friedran.appengine.dashboard.client.AppEngineDashboardAuthenticator.java

protected void onGetAuthToken(Bundle bundle) {
    mAuthToken = bundle.getString(AccountManager.KEY_AUTHTOKEN);
    LogUtils.i("AppEngineDashboardAuthenticator", "onGetAuthToken: Got the auth token " + mAuthToken);

    if (mAuthToken == null) {
        // Failure, looks like an illegal account
        mPostAuthenticateCallback.run(false);
    } else {//from w ww. ja v a2s . c o  m
        new LoginToAppEngineTask().execute();
    }
}

From source file:com.idean.atthack.api.Param.java

public void addToJsonAsObject(JSONObject parent, Bundle params) {
    String defaultVal = params.getString(name());
    if (defaultVal == null) {
        Log.w(TAG, "Unable to add this param " + this + " as a JSON object");
        return;/*from w w w .ja v a2s.  c  o m*/
    }
    try {
        JSONObject obj = new JSONObject(defaultVal);
        parent.put(name(), obj);
    } catch (JSONException e) {
        try {
            JSONArray arr = new JSONArray(defaultVal);
            parent.put(name(), arr);
        } catch (JSONException e1) {
            Log.w(TAG, "Unable to parse as JSON " + defaultVal);
        }
    }

}

From source file:com.example.android.networkconnect.SimpleTextFragment.java

/**
 * Processes the arguments passed into this Fragment via setArguments method.
 * Currently the method only looks for text or a textID, nothing else.
 *///w  w w . j  av a2  s . c o  m
public void processArguments() {
    // For most objects we'd handle the multiple possibilities for initialization variables
    // as multiple constructors.  For Fragments, however, it's customary to use
    // setArguments / getArguments.
    if (getArguments() != null) {
        Bundle args = getArguments();
        if (args.containsKey(TEXT_KEY)) {
            mText = args.getString(TEXT_KEY);
            Log.d("Constructor", "Added Text.");
        } else if (args.containsKey(TEXT_ID_KEY)) {
            mTextId = args.getInt(TEXT_ID_KEY);
            mText = getString(mTextId);
        }
    }
}

From source file:edu.rowan.app.fragments.FoodCommentFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Bundle args = getArguments();
    foodEntryId = args.getString(FoodRatingFragment.FOOD_ENTRY_ID);
    userId = args.getString(FoodRatingFragment.USER_ID);
}

From source file:com.cssweb.android.quote.QuotePrice.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.zr_price_view);

    initTitle(R.drawable.njzq_title_left_back, 0, "");

    Bundle bundle = getIntent().getExtras();
    this.exchange = bundle.getString("exchange");
    this.stockcode = bundle.getString("stockcode");
    this.stockname = bundle.getString("stockname");

    setTitleText(stockname);/*from   w w w . j a va  2  s.  co m*/

    priceView = (PriceView) findViewById(R.id.zrviewprice);
    //priceView.setBackgroundResource(R.drawable.njzq_hqbj_fivequote_bg);
}