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:com.partypoker.poker.engagement.reach.EngagementReachAgent.java

/**
 * GCM & ADM push payload values are always strings unfortunately. We have to parse numbers.
 * @param bundle bundle.//from w ww. j a  v a  2s . c  o m
 * @param key key to extract
 * @return string value parsed as a Long. If key is missing or not a long, returns null.
 */
private static Long parseLong(Bundle bundle, String key) {
    try {
        return Long.parseLong(bundle.getString(key));
    } catch (RuntimeException e) {
        return null;
    }
}

From source file:net.idlesoft.android.apps.github.activities.NetworkList.java

@Override
public void onCreate(final Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.network);//from   w w  w .ja v a  2 s. com

    mPrefs = getSharedPreferences(Hubroid.PREFS_NAME, 0);

    mUsername = mPrefs.getString("username", "");
    mPassword = mPrefs.getString("password", "");

    mGapi.authenticate(mUsername, mPassword);

    ((ImageButton) findViewById(R.id.btn_search)).setOnClickListener(new OnClickListener() {
        public void onClick(final View v) {
            startActivity(new Intent(NetworkList.this, Search.class));
        }
    });

    mListView = (ListView) findViewById(R.id.lv_network_list);
    mListView.setOnItemClickListener(mOnForkListItemClick);

    mAdapter = new ForkListAdapter(NetworkList.this, mListView);

    final Bundle extras = getIntent().getExtras();
    if (extras != null) {
        mRepositoryName = extras.getString("repo_name");
        mRepositoryOwner = extras.getString("username");

        final TextView title = (TextView) findViewById(R.id.tv_page_title);
        title.setText("Network");
    }
}

From source file:com.citrus.sdk.fragments.DebitCard.java

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    returnView = inflater.inflate(R.layout.activity_debit_card, container, false);

    Bundle data = getArguments();

    paymentType = data.getString(Constants.PAY_TYPE);

    initEditText();/*from   w  w w  . java2  s .  c om*/

    initSubmitButton();

    return returnView;
}

From source file:com.liferay.alerts.service.PushNotificationService.java

@Override
protected void onHandleIntent(Intent intent) {
    GoogleCloudMessaging gcm = GCMUtil.getGoogleCloudMessaging(this);

    String type = gcm.getMessageType(intent);
    Bundle extras = intent.getExtras();

    if (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(type) && !extras.isEmpty()) {

        try {/*from  w w  w  . ja v a2 s.  com*/
            User user = new User(extras.getString("fromUser"));
            Alert alert = new Alert(user, extras.getString(Alert.PAYLOAD));

            _insert(user, alert);
            _addCard(alert);
        } catch (JSONException je) {
        }
    }

    PushNotificationReceiver.completeWakefulIntent(intent);
}

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  va  2 s  .  c o m*/
        }
        ftrans.addToBackStack(gameFrag.getBTag()).commit();
    } else {
        final Intent intent = new Intent(act, Game.class);
        intent.putExtras(gamedata);
        startActivity(intent);
    }
}

From source file:net.idlesoft.android.apps.github.activities.tabs.MyRepos.java

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

    final SharedPreferences prefs = getSharedPreferences(Hubroid.PREFS_NAME, 0);
    mUsername = prefs.getString("username", "");
    mPassword = prefs.getString("password", "");

    mGapi.authenticate(mUsername, mPassword);

    mListView = (ListView) getLayoutInflater().inflate(R.layout.tab_listview, null);
    mListView.setOnItemClickListener(mOnListItemClick);

    setContentView(mListView);/*from   w  w w.  j  a  v  a2s .  c  om*/

    mAdapter = new RepositoriesListAdapter(MyRepos.this, mListView);

    final Bundle extras = getIntent().getExtras();
    if (extras != null) {
        mTarget = extras.getString("target");
    }
    if ((mTarget == null) || mTarget.equals("")) {
        mTarget = mUsername;
    }

    mTask = (MyReposTask) getLastNonConfigurationInstance();
    if ((mTask == null) || (mTask.getStatus() == AsyncTask.Status.FINISHED)) {
        mTask = new MyReposTask();
    }
    mTask.activity = this;
    if (mTask.getStatus() == AsyncTask.Status.PENDING) {
        mTask.execute();
    }
}

From source file:com.arantius.tivocommander.ExploreCommon.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bundle bundle = getIntent().getExtras();
    if (MindRpc.init(this, bundle))
        return;//from   w w  w . j a  va  2 s  .  c o m

    if (bundle != null) {
        mCollectionId = bundle.getString("collectionId");
        mContentId = bundle.getString("contentId");
        mOfferId = bundle.getString("offerId");
        mRecordingId = bundle.getString("recordingId");
    }

    if (getParent() == null) {
        Utils.logError("Null getParent() in ExploreCommon.onCreate() ?!");
        Utils.toast(this, R.string.unexpected_please_report, Toast.LENGTH_LONG);
        finish();
        return;
    }

    getParent().setProgressBarIndeterminateVisibility(true);
    MindRpcRequest req = getRequest();
    MindRpc.addRequest(req, mListener);
}

From source file:com.ntsync.android.sync.activities.VerifyPaymentProgressDialog.java

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

    Bundle args = getArguments();
    String priceId = args.getString(PARAM_PRICEID);
    String jsonProofOfPayment = args.getString(PARAM_PROOFOFPAYMENT);
    String accountName = args.getString(PARAM_ACCOUNTNAME);
    AccountManager acM = AccountManager.get(this.getActivity());
    Account account = new Account(accountName, Constants.ACCOUNT_TYPE);

    // Retain to keep Task during conf changes
    setRetainInstance(true);/*from w  w  w .  jav  a 2  s .  c  o m*/
    setCancelable(false);

    verifyTask = new VerifyPaymentTask(priceId, jsonProofOfPayment, account, acM);
    verifyTask.execute();
}

From source file:net.idlesoft.android.apps.github.activities.tabs.WatchedRepos.java

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

    final SharedPreferences prefs = getSharedPreferences(Hubroid.PREFS_NAME, 0);
    mUsername = prefs.getString("username", "");
    mPassword = prefs.getString("password", "");

    mGapi.authenticate(mUsername, mPassword);

    mListView = (ListView) getLayoutInflater().inflate(R.layout.tab_listview, null);
    mListView.setOnItemClickListener(mOnListItemClick);

    setContentView(mListView);//from  ww  w  . j a va 2 s  .c  o  m

    mAdapter = new RepositoriesListAdapter(WatchedRepos.this, mListView);

    final Bundle extras = getIntent().getExtras();
    if (extras != null) {
        mTarget = extras.getString("target");
    }
    if ((mTarget == null) || mTarget.equals("")) {
        mTarget = mUsername;
    }

    mTask = (WatchedReposTask) getLastNonConfigurationInstance();
    if ((mTask == null) || (mTask.getStatus() == AsyncTask.Status.FINISHED)) {
        mTask = new WatchedReposTask();
    }
    mTask.activity = this;
    if (mTask.getStatus() == AsyncTask.Status.PENDING) {
        mTask.execute();
    }
}

From source file:it.uniroma2.foundme.studente.FollowCourseActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_follow_course);
    context = this;

    swipeFollow = (SwipeRefreshLayout) findViewById(R.id.swipe_follow);
    swipeFollow.setEnabled(false);/*w w w  .j av  a2  s  .  com*/

    Bundle passed = getIntent().getExtras();
    Sid = passed.getString(Variables_it.ID);

    lvTuttiCorsi = (ListView) findViewById(R.id.lvTuttiCorsi);
    etFilter = (EditText) findViewById(R.id.etFilter);

    try {
        getCourse(true);
    } catch (ExecutionException e) {
        e.printStackTrace();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}