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:edu.mines.letschat.MainActivity.java

@Override
public void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    Log.v(TAG, "In on new intent");
    Bundle extras = intent.getExtras();
    if (extras != null) {
        string = extras.getString(EXTRA_NOTIFICATION_RETRIEVE);
        if (string != null) {
            //            users.clear();
            //            new GetUsers(new OnTaskCompleted() {
            //               @Override
            //               public void onTaskCompleted() {
            Intent tent = new Intent(MainActivity.this, MessageActivity.class);
            tent.putExtra(MainActivity.EXTRA_DEVICE_ID, string);
            tent.putExtra(MainActivity.EXTRA_SENDER_ID, regid);
            for (Entry<String, String> entry : map.entrySet()) {
                if (string.equals(entry.getValue())) {
                    String username = entry.getKey();
                    Log.v(TAG, username);
                    tent.putExtra(MainActivity.EXTRA_USER_NAME, username);
                }/*from w  w w .ja v a 2s .  c  o m*/
            }
            startActivity(tent);
            //               }
            //            }).execute();
        }
    }
}

From source file:com.bakhtiyor.android.tumblr.TumblrService.java

@Override
public void onStart(Intent intent, int startId) {
    super.onStart(intent, startId);
    Bundle extras = intent.getExtras();
    if (Intent.ACTION_SEND.equals(intent.getAction()) && (extras != null)) {
        if (extras.containsKey(KEY_EMAIL) && extras.containsKey(KEY_PASSWORD) && extras.containsKey(KEY_CAPTION)
                && extras.containsKey(KEY_IS_PRIVATE) && extras.containsKey(KEY_FILENAME)) {
            String email = extras.getString(KEY_EMAIL);
            String password = extras.getString(KEY_PASSWORD);
            String caption = extras.getString(KEY_CAPTION);
            boolean isPrivate = extras.getBoolean(KEY_IS_PRIVATE);
            String filename = extras.getString(KEY_FILENAME);
            uploadPhoto(email, password, caption, isPrivate, filename);
        }/*from w  w w .  ja  va2  s . c om*/
    }
    stopSelf(startId);
}

From source file:br.com.anteros.social.instagram.AnterosInstagramSession.java

private boolean checkTokenError(Bundle result) {
    if (result != null && result.containsKey(ERROR_CODE) && result.getString(ERROR_CODE).contains("400")
            && result.getString(ERROR_CODE).contains("OAuth")) {
        restart = true;//from ww  w  . j av a  2s. c  o  m
        requestBundle = result;
        requestBundle.remove(ERROR_CODE);
        requestBundle.remove(AnterosInstagramAsyncTask.RESULT_ERROR);
        login();
        return true;
    }
    return false;
}

From source file:it.unipr.ce.dsg.gamidroid.activities.SensorDataViewActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.sensor_data);

    mContext = this;

    overridePendingTransition(R.anim.animate_left_in, R.anim.animate_left_out);

    Button backButton = (Button) findViewById(R.id.backButtonSensor);

    backButton.setOnClickListener(new View.OnClickListener() {

        @Override//w w w.j  a  v  a 2s  . c o  m
        public void onClick(View v) {

            stopThread();

            GamiNode.getAndroidGamiNode(mContext).getRfm().stopTemperatureNotificationLookup();

            onBackPressed();
        }
    });

    stopThread = false;

    Bundle b = getIntent().getExtras();

    location = new Location();
    location.setBuilding(new Building(b.getString("Building")));
    location.setFloor(new Floor(b.getString("Floor")));
    location.setRoom(new Room(b.getString("Room")));
    location.setSensor(new Sensor(b.getString("Sensor")));

    sensorName = b.getString("Sensor");

    String buildingToShow = b.getString("Building");
    if (buildingToShow.length() > 28)
        buildingToShow = buildingToShow.substring(0, 28) + "...";
    String floorToShow = getResources().getString(R.string.floor) + b.getString("Floor");
    if (floorToShow.length() > 28)
        floorToShow = floorToShow.substring(0, 28) + "...";
    String roomToShow = b.getString("Room");
    if (roomToShow.length() > 28)
        roomToShow = roomToShow.substring(0, 28) + "...";

    titleTv = (TextView) findViewById(R.id.SensorResumeText);
    titleTv.setText(buildingToShow + "\n" + floorToShow + "\n" + roomToShow);
    titleTv.setTextSize(15);

    GamiNode.getAndroidGamiNode(mContext).getRfm().startTemperatureNotificationLookup(
            location.getBuilding().getValue(), location.getFloor().getValue(), location.getRoom().getValue(),
            location.getSensor().getValue());

    SharedPreferences sharedPreferences = mContext.getSharedPreferences(Constants.PREFERENCES,
            Context.MODE_PRIVATE);
    String currentNetwork = sharedPreferences.getString(Constants.NETWORK, "");

    if (currentNetwork.equalsIgnoreCase(Constants.CHORD)) {
        GamiNode.addChordResourceListener(this);
    } else if (currentNetwork.equalsIgnoreCase(Constants.MESH)) {
        GamiNode.addMeshResourceListener(this);
    }

    // Initialize sensor data graph
    graphViewSeries = new GraphViewSeries(new GraphViewData[] {});
    graphView = new LineGraphView(this, "Sensor Readings");
    graphView.setPadding(3, 0, 0, 0);
    graphView.getGraphViewStyle().setGridColor(Color.BLACK);
    graphView.getGraphViewStyle().setHorizontalLabelsColor(Color.BLACK);
    graphView.getGraphViewStyle().setVerticalLabelsColor(Color.BLACK);
    graphView.getGraphViewStyle().setTextSize(16);
    graphView.getGraphViewStyle().setVerticalLabelsWidth(40); // width of the vertical labels

    Date d = new Date();
    String s = (String) DateFormat.format("H:m:s ", d.getTime());

    System.out.println(s);

    // Array of strings that are the horizontal labels
    hLabels = new String[] { s };
    graphView.setHorizontalLabels(hLabels);

    // graphView.getGraphViewStyle().setVerticalLabelsWidth(200);

    graphView.addSeries(graphViewSeries); // data
    graphView.setViewPort(0, 4);
    graphView.setScalable(false);
    graphView.setScrollable(true);
    graphView.setManualYAxisBounds(45, 0);
    // graphView.getGraphViewStyle().setNumVerticalLabels(45 / 5);
    graphView.getGraphViewStyle().setNumHorizontalLabels(10);

    layout = (LinearLayout) findViewById(R.id.graph);
    layout.addView(graphView);
}

From source file:com.itude.mobile.mobbl.core.model.MBElement.java

private MBElement(Parcel in) {
    _values = new HashMap<String, String>();

    Bundle valueBundle = in.readBundle();

    for (String key : valueBundle.keySet()) {
        _values.put(key, valueBundle.getString(key));
    }/*w w  w.  j  a v  a  2  s  .c  o  m*/

    _definition = in.readParcelable(MBElementDefinition.class.getClassLoader());
}

From source file:fr.cph.chicago.core.activity.BusActivity.java

@Override
protected final void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    App.checkBusData(this);
    if (!this.isFinishing()) {
        setContentView(R.layout.activity_bus);
        ButterKnife.bind(this);

        if (busStopId == null || busRouteId == null || bound == null || busStopName == null
                || busRouteName == null || boundTitle == null) {
            final Bundle extras = getIntent().getExtras();
            busStopId = extras.getInt(bundleBusStopId);
            busRouteId = extras.getString(bundleBusRouteId);
            bound = extras.getString(bundleBusBound);
            boundTitle = extras.getString(bundleBusBoundTitle);
            busStopName = extras.getString(bundleBusStopName);
            busRouteName = extras.getString(bundleBusRouteName);
            latitude = extras.getDouble(bundleBusLatitude);
            longitude = extras.getDouble(bundleBusLongitude);
        }//from   w  w w . ja  v  a  2s . c  o m

        final Position position = new Position();
        position.setLatitude(latitude);
        position.setLongitude(longitude);

        isFavorite = isFavorite();

        mapImage.setColorFilter(grey_5);
        directionImage.setColorFilter(grey_5);
        favoritesImageContainer.setOnClickListener(v -> switchFavorite());

        if (isFavorite) {
            favoritesImage.setColorFilter(yellowLineDark);
        } else {
            favoritesImage.setColorFilter(grey_5);
        }
        scrollView.setOnRefreshListener(() -> new LoadStationDataTask().execute());
        streetViewImage.setOnClickListener(new GoogleStreetOnClickListener(latitude, longitude));
        mapContainer.setOnClickListener(new GoogleMapOnClickListener(latitude, longitude));
        walkContainer.setOnClickListener(new GoogleMapDirectionOnClickListener(latitude, longitude));

        busRouteNameView2.setText(busRouteName + " (" + boundTitle + ")");

        // Load google street picture and data
        createGoogleStreetObservable(position.getLatitude(), position.getLongitude());
        subscribeToGoogleStreet(streetViewImage, streetViewText);
        new LoadStationDataTask().execute();

        setToolBar();

        // Google analytics
        Util.trackScreen(getApplicationContext(), analyticsBusDetails);
    }
}

From source file:fr.cph.chicago.core.activity.BusActivity.java

@Override
public void onRestoreInstanceState(final Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    busStopId = savedInstanceState.getInt(bundleBusStopId);
    busRouteId = savedInstanceState.getString(bundleBusRouteId);
    bound = savedInstanceState.getString(bundleBusBound);
    boundTitle = savedInstanceState.getString(bundleBusBoundTitle);
    busStopName = savedInstanceState.getString(bundleBusStopName);
    busRouteName = savedInstanceState.getString(bundleBusRouteName);
    latitude = savedInstanceState.getDouble(bundleBusLatitude);
    longitude = savedInstanceState.getDouble(bundleBusLongitude);
}

From source file:fr.cph.chicago.activity.BusBoundActivity.java

@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    mBusRouteId = savedInstanceState.getString("busRouteId");
    mBusRouteName = savedInstanceState.getString("busRouteName");
    mBound = savedInstanceState.getString("bound");
}

From source file:net.reichholf.dreamdroid.activities.ScreenShotActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    super.onCreate(savedInstanceState);
    setTitle(getText(R.string.app_name) + " - " + getText(R.string.screenshot));

    mImageView = new ImageView(this);
    setContentView(mImageView);//from w  w  w .ja  v a2 s. co  m
    mImageView.setBackgroundColor(Color.BLACK);

    Bundle extras = getIntent().getExtras();

    if (extras == null) {
        extras = new Bundle();
    }

    mType = extras.getInt(KEY_TYPE, TYPE_ALL);
    mFormat = extras.getInt(KEY_FORMAT, FORMAT_PNG);
    mSize = extras.getInt(KEY_SIZE, 720);
    mFilename = extras.getString(KEY_FILENAME);

    reload();
}

From source file:com.surveyorexpert.TalkToMe.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.talk_main);//from w  w w .j ava2s.  c om

    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
    String online = preferences.getString("ONLINE", "");
    if (!online.equalsIgnoreCase("")) {
        ONLINE = online;
    }
    String PhotoPath = preferences.getString("PhotoPath", "");
    if (!PhotoPath.equalsIgnoreCase("")) {
        mPhotoPath = PhotoPath;
    }
    String ServerPhotoPath = preferences.getString("ServerPhotoPath", "");
    if (!ServerPhotoPath.equalsIgnoreCase("")) {
        mServerPhotoPath = ServerPhotoPath;
    }

    setTitle("mServerPhotoPath  " + mServerPhotoPath);

    Bundle extras = getIntent().getExtras();

    if (extras != null) {
        domain = extras.getString("domain");
        project = extras.getString("project");
        resource = extras.getString("resource");
        nbcMarker = extras.getString("nbcMarker");
        nbcDescription = extras.getString("nbcDescription");
        userName = extras.getString("userName");
        user_id = extras.getString("user_id");
        severity = extras.getString("severity");
        costEst = extras.getString("costEst");
        version = extras.getString("version");
        strLongitude = extras.getString("strLongitude");
        strLatitude = extras.getString("strLatitude");
        section = extras.getString("section");
        element = extras.getString("element");
        childPos = ""; //extras.getString("childPos");
        parentPos = ""; //extras.getString("parentPos");            
    }

    //     File imgFile = new  File("/sdcard/Images/test_image.jpg");
    //  File imgFile = new  File("/storage/emulated/0/1405349215602.jpg");
    String path = Environment.getExternalStorageDirectory() + "/DCIM/Camera/1405349215602.jpg";

    /*
      Toast.makeText(TalkToMe.this,
      "mServerPhotoPath =  " + mServerPhotoPath
        , Toast.LENGTH_LONG).show();
      */

    /*
    Toast.makeText(getBaseContext(),
      "mPhotoPath =  " + mPhotoPath, 
      "mServerPhotoPath =  " + mServerPhotoPath, 
       Toast.LENGTH_LONG).show(); 
       */

    File imgFile = new File(mPhotoPath);

    if (imgFile.exists()) {
        Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
        ImageView myImage = (ImageView) findViewById(R.id.finalImg);
        myImage.setImageBitmap(myBitmap);
        //         Toast.makeText(getBaseContext(),"Set File " , Toast.LENGTH_LONG).show(); 
    } else {
        Toast.makeText(getBaseContext(), "Not found " + imgFile.getName(), Toast.LENGTH_LONG).show();
    }

    speak = (Button) findViewById(R.id.bt_speak);
    speak.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            sendRecognizeIntent();
        }
    });
    speak.setEnabled(false);

    confirm = (Button) findViewById(R.id.btWriteToServer);
    confirm.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            new PostComment().execute();

            Toast.makeText(getBaseContext(),
                    "TalkToMe Send to Server : " + "\nmPhotoPath : " + mPhotoPath + "\nsection : " + section
                            + "\nelement : " + element + "\ngotMessage : " + gotMessage + "\ndomain : " + domain
                            + "\nproject : " + project + "\nresource : " + resource + "\nnbcMarker : "
                            + nbcMarker + "\nnbcDescription : " + nbcDescription + "\nuserName : " + userName
                            + "\nuser_id : " + user_id + "\nseverity : " + severity + "\ncostEst : " + costEst
                            + "\nversion : " + version + "\nstrLongitude : " + strLongitude + "\nstrLatitude : "
                            + strLatitude,
                    Toast.LENGTH_LONG).show();

        }
    });
    //  confirm.setEnabled(false);

    result = (TextView) findViewById(R.id.tv_result);
    //   message = (TextView)findViewById(R.id.tvTalkMessage);
    //    message.setText(mServerPhotoPath);      
    tts = new TextToSpeech(this, this);
}