Example usage for android.os Bundle putString

List of usage examples for android.os Bundle putString

Introduction

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

Prototype

public void putString(@Nullable String key, @Nullable String value) 

Source Link

Document

Inserts a String value into the mapping of this Bundle, replacing any existing value for the given key.

Usage

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

protected void sendResult(String action, String cycle, File pdfFile) {
    Bundle extras = new Bundle();
    extras.putString(CYCLE_NAME, cycle);
    extras.putString(PDF_NAME, pdfFile.getName());
    if (pdfFile.exists()) {
        extras.putString(PDF_PATH, pdfFile.getAbsolutePath());
    }//from w  w w  .  ja va  2 s .  c o  m
    sendResult(action, extras);
}

From source file:com.normalexception.app.rx8club.task.PmTask.java

@Override
protected void onPostExecute(Void result) {
    try {//from  ww  w . java2s  .  c o  m
        mProgressDialog.dismiss();
        mProgressDialog = null;
    } catch (Exception e) {
        Log.w(TAG, e.getMessage());
    }

    Bundle args = new Bundle();
    args.putString("link", HtmlFormUtils.getResponseUrl());
    FragmentUtils.fragmentTransaction(sourceFragment.getActivity(), new PrivateMessageInboxFragment(), false,
            false, args);
}

From source file:com.kakao.PhotoKakaoStoryPostParamBuilder.java

/**
 *  ? ? Bundle ./*  w  w w .  java  2 s .c o  m*/
 * @return  ? ? Bundle 
 */
public Bundle build() throws KakaoParameterException {
    if (imageURLs.length() == 0)
        throw new KakaoParameterException(ERROR_CODE.CORE_PARAMETER_MISSING,
                "addImageURL(String) is required.");
    final Bundle parameters = super.build();
    if (content != null)
        parameters.putString(ServerProtocol.CONTENT_KEY, content);
    if (imageURLs.length() != 0)
        parameters.putString(ServerProtocol.IMAGE_URL_LIST_KEY, imageURLs.toString());
    return parameters;
}

From source file:com.easy.facebook.android.facebook.Facebook.java

public boolean sessionIsValid() {

    Bundle params = new Bundle();
    params.putString("format", "json");
    params.putString("access_token", getAccessToken());

    String jsonResponse;//  w w w.j av a2s  .  c  o m
    try {
        jsonResponse = Util.openUrl("https://graph.facebook.com/me/feed", "GET", params);

        JSONObject objectJSON = new JSONObject(jsonResponse);

        if (!objectJSON.isNull("error")) {
            Log.e("EasyFacebookAndroid", "Invalid EasyFacebookAndroid session");
            return false;
        }

        if (!objectJSON.isNull("data")) {
            return true;
        } else {
            Log.e("EasyFacebookAndroid", "Invalid EasyFacebookAndroid session");
            return false;
        }

    } catch (MalformedURLException e) {
        Log.e("EasyFacebookAndroid", e.toString());
        return false;
    } catch (IOException e) {
        Log.e("EasyFacebookAndroid", e.toString());
        return false;
    } catch (JSONException e) {
        Log.e("EasyFacebookAndroid", e.toString());
        return false;
    }

}

From source file:com.normalexception.app.rx8club.task.NewThreadTask.java

@Override
protected void onPostExecute(Void result) {
    try {//from  w w  w .j a va  2s.  c  om
        mProgressDialog.dismiss();
        mProgressDialog = null;
    } catch (Exception e) {
        Log.w(TAG, e.getMessage());
    }

    Bundle args = new Bundle();
    args.putString("link", HtmlFormUtils.getResponseUrl());
    args.putString("title", subject);
    args.putString("page", "1");

    // Create new fragment and transaction
    Fragment newFragment = ThreadFragment.newInstance();

    FragmentUtils.fragmentTransaction(sourceFragment.getActivity(), newFragment, true, true, args);
}

From source file:angel.zhuoxiu.library.pusher.PusherChannel.java

public void dispatchEvents(String eventName, String eventData) {
    Bundle data = new Bundle();
    data.putString("eventName", eventName);
    data.putString("eventData", eventData);
    data.putString("channelName", mName);
    Message msg = Message.obtain();/*from  ww w . j a  v a  2 s.  co  m*/
    msg.setData(data);

    for (PusherCallback callback : mGlobalCallbacks) {
        callback.sendMessage(msg);
    }

    /* do we have a callback bound to that event? */
    if (mLocalCallbacks.containsKey(eventName)) {
        /* execute each callback */
        for (PusherCallback callback : mLocalCallbacks.get(eventName)) {
            callback.sendMessage(msg);
        }
    }

}

From source file:com.group7.dragonwars.MapSelectActivity.java

@Override
public final void onItemClick(final AdapterView<?> parent, final View v, final int position, final long id) {
    if (position < mapInfo.size()) {
        Intent intent = new Intent(this, PlayerSelectActivity.class);
        Bundle b = new Bundle();
        b.putString("mapFileName", mapInfo.get(position).getPath());
        b.putString("mapName", mapInfo.get(position).getName());

        int numPlayers = mapInfo.get(position).getPlayers();
        b.putBooleanArray("isAi", new boolean[numPlayers]);
        // boolean defaults to false, what could possibly go wrong?
        b.putInt("numPlayers", numPlayers);

        /* Make a fake player list for now, again */
        String[] playerNames = new String[numPlayers];

        for (Integer i = 0; i < numPlayers; ++i) {
            playerNames[i] = ("Player " + (i + 1));
        }/*w ww  .  j a  v a2  s .  c  o  m*/

        b.putStringArray("playerNames", playerNames);

        intent.putExtras(b);
        startActivity(intent);
    }
}

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

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

    // removes title bar on app, making image full screen
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);

    setContentView(R.layout.splash_screen);

    // load keys if they exist
    Auth.loadKeys(getSharedPreferences(APO.PREF_FILE_NAME, MODE_PRIVATE));

    API api = new API(this);
    if (!api.callMethod(Methods.checkCredentials, this, (String[]) null)) {
        Intent loginIntent = new Intent(APO.this, Login.class);
        Bundle extras = new Bundle();
        extras.putString("msg", "No saved credentials");
        loginIntent.putExtras(extras);//w  w w  .  j  a v a 2  s  . co  m
        APO.this.startActivity(loginIntent);
        finish();
    }

}

From source file:MyWeatherService.java

void sendWeatherToClient(String actualWeatherString) {
    Bundle reply = new Bundle();
    reply.putString("weather", actualWeatherString);
    Message replyMessage = Message.obtain();
    replyMessage.setData(reply);//from   ww  w .  ja v a 2  s. c o  m
    try {
        messengerToClient.send(replyMessage);
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}

From source file:com.group7.dragonwars.GameActivity.java

public final void endGame() {
    setContentView(R.layout.loading_screen);
    Intent intent = new Intent(this, Results.class);
    Bundle b = new Bundle();
    b.putString("winnerName", state.getWinner().getName());
    b.putInt("turns", state.getTurns());
    Statistics stats = state.getStatistics();
    Double damageDealt = stats.getStatistic("Damage dealt");
    Double damageReceived = stats.getStatistic("Damage received");
    Double distanceTravelled = stats.getStatistic("Distance travelled");
    Integer goldCollected = stats.getStatistic("Gold received").intValue();
    Integer unitsKilled = stats.getStatistic("Units killed").intValue();
    Integer unitsMade = stats.getStatistic("Units produced").intValue();

    Database db = new Database(getApplicationContext());
    db.AddEntry(damageDealt, damageReceived, distanceTravelled, goldCollected, unitsKilled, unitsMade);
    db.Close();// w  ww .j  a v a 2s .co m

    for (Map.Entry<String, Double> ent : stats.getEntrySet()) {
        b.putDouble(ent.getKey(), ent.getValue().doubleValue());
    }

    intent.putExtras(b);
    startActivity(intent);
    finish();
}