Example usage for android.os Bundle get

List of usage examples for android.os Bundle get

Introduction

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

Prototype

@Nullable
public Object get(String key) 

Source Link

Document

Returns the entry with the given key as an object.

Usage

From source file:com.example.office.ui.Office365DemoActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    try {/*from w ww.j a v  a  2 s.  c o  m*/
        Intent intent = getIntent();
        String action = intent.getAction();
        String type = intent.getType();

        //Processing system intent of sharing an image
        if (Intent.ACTION_SEND.equals(action) && type != null) {
            if (type.startsWith("image/")) {
                Bundle bundle = intent.getExtras();
                Uri uri = (Uri) bundle.get(Intent.EXTRA_STREAM);
                // Retrieving path to the image and attaching it to current intent
                attachImageToCurrentEvent(Utility.getRealPathFromURI(uri, this), type);
            }
        }

        if (savedInstanceState == null) {
            mSavedFragmentTag = null;
        } else {
            mSavedFragmentTag = savedInstanceState.getString(STATE_FRAGMENT_TAG);
        }

        setConfiguration();
    } catch (Exception e) {
        Logger.logApplicationException(e, getClass().getSimpleName() + ".onNewIntent(): Error.");
    }
}

From source file:edu.sfsu.csc780.chathub.ui.ChannelActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    Log.d(TAG, "onActivityResult: request=" + requestCode + ", result=" + resultCode);

    if (requestCode == REQUEST_PICK_IMAGE && resultCode == Activity.RESULT_OK) {
        // Process selected image here
        // The document selected by the user won't be returned in the intent.
        // Instead, a URI to that document will be contained in the return intent
        // provided to this method as a parameter.
        // Pull that URI using resultData.getData().
        if (data != null) {
            Uri uri = data.getData();//from  w  ww  .  j  a va 2  s.  co  m
            Log.i(TAG, "Uri: " + uri.toString());

            // Resize if too big for messaging
            Bitmap bitmap = getBitmapForUri(uri);
            Bitmap resizedBitmap = scaleImage(bitmap);
            if (bitmap != resizedBitmap) {
                uri = savePhotoImage(resizedBitmap);
            }

            createImageMessage(uri);
        } else {
            Log.e(TAG, "Cannot get image for uploading");
        }
    } else if (requestCode == REQUEST_TAKE_PHOTO && resultCode == RESULT_OK) {

        if (data != null && data.getExtras() != null) {
            Bundle extras = data.getExtras();
            Bitmap imageBitmap = (Bitmap) extras.get("data");
            Log.d(TAG, "imageBitmap size:" + imageBitmap.getByteCount());
            createImageMessage(savePhotoImage(imageBitmap));
        } else {
            Log.e(TAG, "Cannot get photo URI after taking photo");
        }
    } else if (requestCode == REQUEST_PREFERENCES) {
        if (DesignUtils.getPreferredTheme(this) != mSavedTheme) {
            DesignUtils.applyColorfulTheme(this);
            this.recreate();
        }
    }
}

From source file:edu.sfsu.csc780.chathub.ui.MainActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    Log.d(TAG, "onActivityResult: request=" + requestCode + ", result=" + resultCode);

    if (requestCode == REQUEST_PICK_IMAGE && resultCode == Activity.RESULT_OK) {
        // Process selected image here
        // The document selected by the user won't be returned in the intent.
        // Instead, a URI to that document will be contained in the return intent
        // provided to this method as a parameter.
        // Pull that URI using resultData.getData().
        if (data != null) {
            Uri uri = data.getData();/*from w ww. java 2  s.  c  o  m*/
            Log.i(TAG, "Uri: " + uri.toString());

            // Resize if too big for messaging
            Bitmap bitmap = getBitmapForUri(uri);
            Bitmap resizedBitmap = scaleImage(bitmap);
            if (bitmap != resizedBitmap) {
                uri = savePhotoImage(resizedBitmap);
            }

            createImageMessage(uri);
        } else {
            Log.e(TAG, "Cannot get image for uploading");
        }
    } else if (requestCode == REQUEST_PREFERENCES) {
        this.recreate();
    } else if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == Activity.RESULT_OK) {
        if (data != null) {
            Bundle extras = data.getExtras();
            if (extras != null) {
                Bitmap imageBitmap = (Bitmap) extras.get("data");
                Uri uri = savePhotoImage(imageBitmap);
                createImageMessage(uri);
            }
        }
    } else if (requestCode == REQUEST_VIDEO_CAPTURE && resultCode == Activity.RESULT_OK) {
        if (data != null) {
            Uri uri = data.getData();
            createVideoMessage(uri);
        }
    }
}

From source file:edgargtzg.popularmovies.DiscoverMoviesFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Fragment to handle menu events.
    setHasOptionsMenu(true);//from   w w  w.  j av  a 2 s  . c  o  m
    // The MovieItemAdapter will take data from a source and
    // use it to populate the GridView it's attached to.
    mMoviePosterAdapter = new MovieItemAdapter(getActivity(), // The current context (this activity)
            R.layout.grid_movie_item, new ArrayList<MovieItem>());
    if (savedInstanceState != null) {
        mListOfMovies = (ArrayList<MovieItem>) savedInstanceState.get(MOVIE_LIST_KEY);
        if (mListOfMovies != null) {
            mMoviePosterAdapter.addAll(mListOfMovies);
        }
    } else {
        mListOfMovies = new ArrayList<>();
        updateMovies(PreferenceManager.getDefaultSharedPreferences(getActivity())
                .getString(getString(R.string.pref_sortBy_list_key), getString(R.string.pref_most_popular)));
    }
}

From source file:com.zhihuigu.sosoOffice.RegisterThirdActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode != RESULT_OK) { //  RESULT_OK 
        Log.e(TAG, "ActivityResult resultCode error");
        return;//from  w ww. ja  va2 s  . c o m
    }
    Bitmap bm = null;
    // ContentProvider ContentResolver
    ContentResolver resolver = getContentResolver();
    // Activity
    if (requestCode == IMAGE_CODE) {//
        String imgPath = "";
        Uri originalUri = data.getData(); // uri
        //            bm = MediaStore.Images.Media.getBitmap(resolver, originalUri); // bitmap
        // 
        String[] proj = { MediaStore.Images.Media.DATA };
        // androidAndroid
        Cursor cursor = managedQuery(originalUri, proj, null, null, null);
        //            InputStream inputStream = resolver.openInputStream(originalUri);

        //  
        if (cursor == null) {
            imgPath = data.getDataString();
        } else {
            int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
            //  
            cursor.moveToFirst();
            // www.2cto.com
            imgPath = cursor.getString(column_index);
        }
        File fromFile = new File(imgPath);
        // 
        if (fromFile != null && fromFile.exists()) {
            fileName = CommonUtils.getFileName();// 
            File file = new File(SDCARD_ROOT_PATH + SAVE_PATH_IN_SDCARD);
            if (!file.exists()) {
                file.mkdirs();
            }
            sdcardTempFile = new File(SDCARD_ROOT_PATH + SAVE_PATH_IN_SDCARD, fileName);
            //               path = sdcardTempFile.getAbsolutePath();
            //               FileCopyUtil.copyfile(fromFile, sdcardTempFile, true);

            Bitmap bitmap = CommonUtils.getDrawable(fromFile.getAbsolutePath(),
                    MyApplication.getInstance(this).getScreenWidth(),
                    MyApplication.getInstance(this).getScreenHeight());
            if (bitmap != null) {
                bitmap = CommonUtils.RotateImg(fromFile.getAbsolutePath(), bitmap);//90
                boolean copy = CommonUtils.OutPutImage(sdcardTempFile, bitmap);
                if (copy) {
                    /*File oldFile = new File(path);
                    oldFile.delete();*/
                    path = sdcardTempFile.getAbsolutePath();
                }
            } else {
                Toast.makeText(this, "", 3000).show();
            }
        }
        bm = CommonUtils.getDrawable(path, photoView);
        if (bm != null) {
            photo_tag = true;
            bottomLinear.setVisibility(View.GONE);
            photoView.setImageBitmap(bm);
        } else {
            Toast.makeText(this, "", 3000).show();
        }

    } else if (requestCode == REQUEST_CODE_TAKE_PICTURE) {//   
        fileName = CommonUtils.getFileName();// 
        File file = new File(SDCARD_ROOT_PATH + SAVE_PATH_IN_SDCARD);
        if (!file.exists()) {
            file.mkdirs();
        }
        sdcardTempFile = new File(SDCARD_ROOT_PATH + SAVE_PATH_IN_SDCARD, fileName);
        if (CommonUtils.isHasSdcard()) {//   
            path = SDCARD_ROOT_PATH + SAVE_PATH_IN_SDCARD + MyApplication.getInstance(this).getFileName();
            Bitmap bitmap = CommonUtils.getDrawable(path, 500, 500);
            bitmap = CommonUtils.RotateImg(path, bitmap);//90
            boolean copy = CommonUtils.OutPutImage(sdcardTempFile, bitmap);
            if (copy) {
                File oldFile = new File(path);
                oldFile.delete();
                path = sdcardTempFile.getAbsolutePath();
            }

            bm = CommonUtils.getDrawable(path, photoView);
            photo_tag = true;
            bottomLinear.setVisibility(View.GONE);
            photoView.setImageBitmap(bm);
        } else { //    
            Bundle extras = data.getExtras();
            bm = (Bitmap) extras.get("data");
            photo_tag = true;
            bottomLinear.setVisibility(View.GONE);
            photoView.setImageBitmap(bm);
        }
    }
}

From source file:com.wareninja.android.opensource.mongolab_sdk.common.WebService.java

public String getJsonFromParams2(Bundle params) {

    Map<String, Object> paramsMap = new LinkedHashMap<String, Object>();

    String valStr;/*from   ww  w  .  java 2 s .  c  om*/
    Object valObj;
    for (String key : params.keySet()) {

        valObj = params.get(key);
        if (valObj instanceof String) {

            // ugly check if the string value is JSONObj or JSONArr
            valStr = "" + valObj;
            // if (AppContext.isDebugMode()) Log.d(TAG, "valStr->"+valStr);
            valObj = null;
            try {
                valObj = new JSONObject(valStr);

                // note: very ugly hack just for tag loco part!
                if (valStr.contains("{") && valStr.contains("lat") && valStr.contains("lng")) {

                    LinkedHashMap<String, Object> tempMap = new LinkedHashMap<String, Object>();
                    tempMap.put("lng", ((JSONObject) valObj).get("lng"));
                    tempMap.put("lat", ((JSONObject) valObj).get("lat"));
                    JSONObject tempJson = new JSONObject(tempMap);

                    if (AppContext.isDebugMode())
                        Log.d(TAG, "tempJson->" + tempJson + "| len:" + tempJson.length());
                    if (AppContext.isDebugMode())
                        Log.d(TAG, "valObj(before)->" + valObj);

                    if (tempJson.length() > 0) {
                        valObj = tempJson;
                    }

                    if (AppContext.isDebugMode())
                        Log.d(TAG, "valObj(after)->" + valObj);
                }
            } catch (JSONException ex) {
                valObj = null;
            }

            if (valObj == null) {
                try {
                    valObj = new JSONArray(valStr);
                } catch (JSONException ex) {
                    valObj = null;
                }
            }
            if (valObj == null)
                valObj = valStr;
        }

        if (valObj != null)
            paramsMap.put(key, valObj);
    }

    return getJsonFromParams(paramsMap);
}

From source file:de.uhrenbastler.watchcheck.ui.LogDialog.java

public LogDialog(Context context, Bundle logData) {
    super(context);

    setContentView(R.layout.log_dialog);
    setTitle(getContext().getString(R.string.enterLog));
    setCancelable(true);/*  w w w . j a v a 2s  . c om*/

    Button buttonSave = (Button) findViewById(R.id.buttonSave);
    buttonSave.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            makeLogEntry();
            saved = true;
            dismiss();
        }
    });

    watchId = logData.getInt(ATTR_WATCH_ID);
    deviation = logData.getDouble(ATTR_DEVIATION);
    modeNtp = logData.getBoolean(ATTR_MODE_NTP);
    localTime = (GregorianCalendar) logData.get(ATTR_LOCAL_TIME);
    ntpTime = (GregorianCalendar) logData.get(ATTR_NTP_TIME);
    lastLog = (Log) logData.get(ATTR_LAST_LOG);

    Logger.debug("watchId=" + watchId + ", deviation=" + deviation + ", modeNtp=" + modeNtp + ", localTime="
            + localTime.getTime() + ", ntpTime=" + (ntpTime != null ? ntpTime.getTime() : "NULL") + ", lastLog="
            + lastLog);

    TextView textDeviation = (TextView) findViewById(R.id.textViewDeviationValue);
    DecimalFormat df = new DecimalFormat("#.#");

    textDeviation.setText(
            (deviation > 0 ? "+" : deviation < 0 ? "-" : "+-") + df.format(Math.abs(deviation)) + " sec.");

    positionSpinner = (Spinner) findViewById(R.id.logSpinnerPosition);
    ArrayAdapter<?> positionAdapter = ArrayAdapter.createFromResource(getContext(), R.array.positions,
            android.R.layout.simple_spinner_item);
    positionAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    positionSpinner.setAdapter(positionAdapter);

    if (lastLog != null && lastLog.getPosition() != null)
        positionSpinner.setSelection(ArrayUtils.indexOf(POSITIONARR, lastLog.getPosition()));
    else
        positionSpinner.setSelection(0);

    temperatureSpinner = (Spinner) findViewById(R.id.logSpinnerTemperature);
    ArrayAdapter<?> temperatureAdapter = ArrayAdapter.createFromResource(getContext(), R.array.temperatures,
            android.R.layout.simple_spinner_item);
    temperatureAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    temperatureSpinner.setAdapter(temperatureAdapter);

    if (lastLog != null)
        temperatureSpinner.setSelection(ArrayUtils.indexOf(TEMPARR, lastLog.getTemperature()));
    else
        temperatureSpinner.setSelection(0);

    comment = (EditText) findViewById(R.id.logComment);

    startFlag = (CheckBox) findViewById(R.id.logCheckBoxNewPeriod);
    startFlag.setChecked(lastLog == null);
    startFlag.setEnabled(lastLog != null);
}

From source file:com.hanuor.sapphire.utils.intentation.IntentationPrime.java

public String intentToJSON(Context con, Intent intent) throws JsonProcessingException {

    ObjectMapper mapper = new ObjectMapper();
    String getContextName = null;
    String getClassName = null;/*from ww w  .  j a v  a  2s.  c  o m*/
    try {
        getClassName = intent.getComponent().getClassName();
        getContextName = con.getPackageName();
    } catch (Exception e) {
        e.printStackTrace();

    }
    HashMap<String, String> makeInsideJsonArray = new HashMap<String, String>();

    HashMap<String, String> hashMap = new HashMap<String, String>();
    hashMap.put("className", getClassName);
    hashMap.put("context", getContextName);
    Bundle bundle = intent.getExtras();
    if (bundle != null) {
        Set<String> keys = bundle.keySet();
        Iterator<String> it = keys.iterator();
        Log.d("SappsnoopDog", "" + keys.size());
        while (it.hasNext()) {
            String key = it.next();

            Log.d("Sapptagdog", "TYPE   " + bundle.get(key).toString());
            Log.d("NERVE", "" + bundle.get(key).getClass().getAnnotations());

            String type = bundle.get(key).getClass().getSimpleName();
            Log.d("SappDogTAG", key + " OF TYPE " + type);
            switch (type) {
            case "String":
                makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + bundle.get(key).toString());
                Log.d("SappDogTAG", "bool array");
                break;
            case "String[]":
                makeInsideJsonArray.put(key,
                        type + LibraryDatabase.JSONSEPERATOR + bundle.get(key).toString().replace(" ", ""));
                Log.d("SappDogTAG", "bool array");
                break;
            case "Integer":
                makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + bundle.get(key).toString());

                Log.d("SappDogTAG", "bool array");
                break;
            case "Double":
                makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + bundle.get(key).toString());
                Log.d("SappDogTAG", "bool array");
                break;
            case "double[]":

                double[] newDouble = (double[]) bundle.get(key);
                String fromDouble = Arrays.toString(newDouble);
                makeInsideJsonArray.put(key,
                        type + LibraryDatabase.JSONSEPERATOR + fromDouble.replace(" ", ""));
                Log.d("SappDogTAG", "bool array");
                break;
            case "int[]":
                int[] newArray = (int[]) bundle.get(key);
                String fromArray = Arrays.toString(newArray);
                makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + fromArray.replace(" ", ""));
                Log.d("SappDogTAG", "bool array");
                break;
            case "Boolean":
                makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + bundle.get(key).toString());
                Log.d("SappDogTAG", "bool array");
                break;
            case "boolean[]":

                boolean[] newBool = (boolean[]) bundle.get(key);
                String fromBool = Arrays.toString(newBool);
                makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + fromBool.replace(" ", ""));
                Log.d("SappDogTAG", "bool array");
                break;
            case "Char":
                makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + bundle.get(key).toString());
                Log.d("SappDogTAG", "bool array");
                break;
            case "char[]":

                char[] newChar = (char[]) bundle.get(key);
                String fromChar = Arrays.toString(newChar);
                makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + fromChar.replace(" ", ""));
                Log.d("SappDogTAG", "bool array");
                break;
            case "CharSequence":
                makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + bundle.get(key).toString());
                Log.d("SappDogTAG", "bool array");
                break;
            case "charsequence[]":

                makeInsideJsonArray.put(key,
                        type + LibraryDatabase.JSONSEPERATOR + bundle.get(key).toString().replace(" ", ""));
                Log.d("SappDogTAG", "bool array");
                break;
            case "Byte":
                makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + bundle.get(key).toString());
                Log.d("SappDogTAG", "bool array");
                break;
            case "byte[]":

                byte[] newByte = (byte[]) bundle.get(key);
                String fromByte = Arrays.toString(newByte);
                makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + fromByte.replace(" ", ""));
                Log.d("SappDogTAG", "bool array");
                break;
            case "Float":
                makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + bundle.get(key).toString());
                Log.d("SappDogTAG", "bool array");
                break;
            case "float[]":

                float[] newFloat = (float[]) bundle.get(key);
                String fromFloat = Arrays.toString(newFloat);
                makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + fromFloat.replace(" ", ""));
                Log.d("SappDogTAG", "bool array");
                break;
            case "Short":
                makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + bundle.get(key).toString());
                Log.d("SappDogTAG", "bool array");
                break;
            case "short[]":

                short[] newShort = (short[]) bundle.get(key);
                String fromShort = Arrays.toString(newShort);
                fromShort = fromShort.replace(" ", "");
                makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + fromShort.replace(" ", ""));
                Log.d("SappDogTAG", "bool array");
                break;
            case "Long":
                makeInsideJsonArray.put(key, type + LibraryDatabase.JSONSEPERATOR + bundle.get(key).toString());
                Log.d("SappDogTAG", "bool array");
                break;
            case "long[]":

                long[] newLong = (long[]) bundle.get(key);
                String fromLong = Arrays.toString(newLong);
                makeInsideJsonArray.put(key,
                        type + LibraryDatabase.JSONSEPERATOR + bundle.get(key).toString().replace(" ", ""));
                Log.d("SappDogTAG", "bool array");
                break;

            case "ArrayList":
                ArrayList<Object> obj = (ArrayList<Object>) bundle.get(key);
                Object[] objArr = obj.toArray();
                if (objArr[0] instanceof Integer) {
                    ArrayList<Integer> newIntegerArray = bundle.getIntegerArrayList(key);
                    makeInsideJsonArray.put(key, type + "Integer" + LibraryDatabase.JSONSEPERATOR
                            + newIntegerArray.toString().replace(" ", ""));

                } else if (objArr[0] instanceof String) {
                    ArrayList<String> newStringArray = bundle.getStringArrayList(key);

                    makeInsideJsonArray.put(key, type + "String" + LibraryDatabase.JSONSEPERATOR
                            + newStringArray.toString().replace(" ", ""));

                }
                break;

            default:
                // whatever
            }

            hashMap.put(key, bundle.get(key).toString());
        }
    }
    String passArray = mapper.writeValueAsString(makeInsideJsonArray);
    hashMap.put("intentExtras", passArray);
    Log.d("GOGTAD", "" + passArray);

    String intentString = mapper.writeValueAsString(intent);
    Log.d("IntentString", "" + mapper.writeValueAsString(hashMap));
    StringBuilder a1S = new StringBuilder(mapper.writeValueAsString(hashMap));
    a1S.deleteCharAt(mapper.writeValueAsString(hashMap).length() - 1);
    a1S.append(",");
    String s1t = a1S.toString();

    StringBuilder sb = new StringBuilder(intentString);
    sb.deleteCharAt(0);
    String retrString = sb.toString();
    StringBuilder newS = new StringBuilder();
    newS.append(s1t);
    newS.append(retrString);
    Log.d("Insnsns", newS.toString());
    return newS.toString();
}

From source file:com.mikecorrigan.bohrium.pubsub.RegistrationClient.java

@SafeVarargs
private final void handleAuthToken(AccountManagerFuture<Bundle>... tokens) {
    Log.v(TAG, "handleAuthToken");

    try {/*w ww. ja  v a2  s.  c o m*/
        Bundle result = tokens[0].getResult();

        Intent intent = (Intent) result.get(AccountManager.KEY_INTENT);
        if (intent != null) {
            Log.i(TAG, "Launch activity before getting authToken: intent=" + intent);

            setStateAndNotify(REGISTRATION_STATE_REGISTERING, REGISTRATION_SUBSTATE_PROMPTING_USER);

            intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_NEW_TASK);
            notifyLaunchIntent(intent);
            return;
        }

        String authToken = result.getString(AccountManager.KEY_AUTHTOKEN);
        if (mNeedInvalidate) {
            mNeedInvalidate = false;

            Log.i(TAG, "Invalidating token and starting over.");

            // Invalidate auth token.
            AccountManager mgr = AccountManager.get(this);
            mgr.invalidateAuthToken(mConfiguration.getString(ACCOUNT_TYPE, DEFAULT_ACCOUNT_TYPE), authToken);

            setStateAndNotify(REGISTRATION_STATE_REGISTERING, REGISTRATION_SUBSTATE_INVALIDATED_AUTH_TOKEN);

            // Initiate the request again.
            requestAuthToken();
            return;
        } else {
            Log.i(TAG, "Received authToken=" + authToken);
            mConfiguration.putString(AUTH_TOKEN, authToken);
            setStateAndNotify(REGISTRATION_STATE_REGISTERING, REGISTRATION_SUBSTATE_HAVE_AUTH_TOKEN);

            // Move on to the next step, request auth cookie.
            requestAuthCookie();
            return;
        }
    } catch (Exception e) {
        Log.e(TAG, "Exception " + e);
        Log.e(TAG, Log.getStackTraceString(e));
    }

    setStateAndNotify(REGISTRATION_STATE_ERROR, REGISTRATION_SUBSTATE_ERROR_AUTH_TOKEN);
}

From source file:com.wareninja.android.opensource.mongolab_sdk.common.WebService.java

public String webGet(String methodName, Bundle params) {
    Map<String, String> reqParams = new HashMap<String, String>();

    // TODO: do checks to avoid fups!
    for (String key : params.keySet()) {
        // reqParams.put(key, params.getString(key));
        reqParams.put(key, params.get(key) + "");
    }/*from www.  j av  a  2  s .co m*/

    return webGet(methodName, reqParams);
}