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.rit.csh.androidwebnews.DisplayThreadsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    lastFetchedThreads = new ArrayList<PostThread>();
    sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
    hc = new HttpsConnector(this);
    dialog = new InvalidApiKeyDialog(this);
    Bundle extras = getIntent().getExtras();
    connectionDialog = new ConnectionExceptionDialog(this);
    if (extras != null) {
        newsgroupName = extras.getString("SELECTED_NEWSGROUP");
    } else {/*from  ww  w . ja v a 2s .  c o  m*/
        newsgroupName = "none";
    }

    threadsDirectMap = new ArrayList<PostThread>();

    newsgroupListMenu = new NewsgroupListMenu(this);
    newsgroupListMenu.checkEnabled();

    setContentView(R.layout.displaythreads_activity);

    if (!sharedPref.getString("newsgroups_json_string", "").equals("")) {
        newsgroupListMenu.update(hc.getNewsGroupFromString(sharedPref.getString("newsgroups_json_string", "")));
        hc.startUnreadCountTask();
    } else {
        hc.getNewsGroups();
    }

    hc.getNewsgroupThreads(newsgroupName, 20);
    setTitle(newsgroupName);
}

From source file:de.lebenshilfe_muenster.uk_gebaerden_muensterland.sign_browser.search.SignSearchActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    Log.d(TAG, "onCreate() " + this.hashCode());
    super.onCreate(savedInstanceState);
    setContentView(R.layout.search_activity);
    if (null != savedInstanceState) {
        this.query = savedInstanceState.getString(QUERY);
    } else {//from w  w w  . j  av a2 s  . c  o  m
        final Intent intent = getIntent();
        this.query = StringUtils
                .trimToEmpty(StringUtils.stripToEmpty(intent.getStringExtra(SearchManager.QUERY)));
        Validate.notNull(this.query, "The query supplied to this activity is null!");
    }
    setupRecyclerView();
    setupSupportActionBar();
    this.signSearchTask = new SearchSignsTask(this);
    this.signSearchTask.execute(this.query);
}

From source file:com.dahl.brendan.wordsearch.model.HighScore.java

public HighScore(Bundle bundle) {
    this.time = bundle.getLong(Constants.KEY_HIGH_SCORE_TIME);
    this.size = bundle.getInt(Constants.KEY_HIGH_SCORE_SIZE);
    this.theme = bundle.getString(Constants.KEY_HIGH_SCORE_THEME);
    this.wordCount = bundle.getInt(Constants.KEY_WORD_COUNT);
    this.name = bundle.getString(Constants.KEY_HIGH_SCORE_NAME);
    this.globalRank = bundle.getInt(Constants.KEY_GLOBAL_RANK);
    this.globalHighScore = bundle.getBoolean(Constants.KEY_GLOBAL_HIGH_SCORE);
    this.rank = bundle.getInt(Constants.KEY_RANK);
    this.score = bundle.getLong(Constants.KEY_HIGH_SCORE);
}

From source file:com.nononsenseapps.filepicker.sample.ftp.FtpPickerFragment.java

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

    Bundle args = getArguments();
    this.server = args.getString(KEY_FTP_SERVER);
    this.port = args.getInt(KEY_FTP_PORT);
    this.username = args.getString(KEY_FTP_USERNAME) != null ? args.getString(KEY_FTP_USERNAME) : "anonymous";
    this.password = args.getString(KEY_FTP_PASSWORD) != null ? args.getString(KEY_FTP_PASSWORD) : "anonymous";
    this.rootDir = args.getString(KEY_FTP_ROOTDIR) != null ? args.getString(KEY_FTP_ROOTDIR) : "/";
}

From source file:com.google.android.gcm.demo.logic.DeviceGroupsHelper.java

private List<String> bundleValues2Array(Bundle bundle) {
    ArrayList<String> values = new ArrayList<>();
    for (String key : bundle.keySet()) {
        values.add(bundle.getString(key));
    }/*  www  .j  av a 2  s .  c  om*/
    return values;
}

From source file:com.loadsensing.app.SensorsActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.sensor_list_view);

    // Get Intent parameters
    String XarxaSelected = "";
    Bundle extras = null;
    if (savedInstanceState == null) {
        extras = getIntent().getExtras();
        if (extras == null) {
            XarxaSelected = null;//www. ja v a  2 s. c  o  m
        } else {
            XarxaSelected = extras.getString("idxarxaselected");
        }
    } else {
        XarxaSelected = (String) savedInstanceState.getSerializable("XarxaSelected");
    }
    // adapter que mapeja la informaci del sensor amb els camps del layout
    SimpleAdapter adapter = new SimpleAdapter(this, list, R.layout.sensor_row_list_view,
            new String[] { "id", "sensor", "tipus", "descripcio", "poblacio", "canal" },
            new int[] { R.id.text1, R.id.text2, R.id.text3, R.id.text4, R.id.text5, R.id.text6 });

    SharedPreferences settings = getSharedPreferences("LoadSensingApp", Context.MODE_PRIVATE);
    String address = SERVER_HOST + "?IdXarxa=" + XarxaSelected + "&session="
            + settings.getString("session", "");
    Log.d(DEB_TAG, "Requesting to " + address);

    try {
        String jsonString = JsonClient.connectString(address);

        // Convertim la resposta string a un JSONArray
        JSONArray llistaSensorsArray = new JSONArray(jsonString);

        for (int i = 0; i < llistaSensorsArray.length(); i++) {
            JSONObject xarxaJSON = llistaSensorsArray.getJSONObject(i);
            sensors = new HashMap<String, String>();
            sensors.put("id", xarxaJSON.getString("id"));
            sensors.put("sensor", xarxaJSON.getString("sensor"));
            sensors.put("canal", xarxaJSON.getString("canal"));
            sensors.put("tipus", xarxaJSON.getString("tipus"));
            sensors.put("descripcio", xarxaJSON.getString("Descripcio"));
            sensors.put("poblacio", xarxaJSON.getString("Poblacio"));

            list.add(sensors);
        }

        setListAdapter(adapter);

    } catch (Exception ex) {
    }
}

From source file:de.wikilab.android.friendica01.FileUploadService.java

@Override
protected void onHandleIntent(Intent intent) {
    Log.i("Andfrnd/UploadFile", "onHandleIntent exec");

    NotificationManager mNotificationManager = (NotificationManager) getSystemService(
            Context.NOTIFICATION_SERVICE);

    //Instantiate the Notification:
    CharSequence tickerText = "Uploading...";
    Notification notification = new Notification(R.drawable.arrow_up, tickerText, System.currentTimeMillis());
    notification.flags |= Notification.FLAG_ONGOING_EVENT;

    //Define the Notification's expanded message and Intent:
    Context context = getApplicationContext();
    PendingIntent nullIntent = PendingIntent.getActivity(context, 0, new Intent(), 0);
    notification.setLatestEventInfo(context, "Upload in progress...", "You are notified here when it completes",
            nullIntent);/*from w  w w.  ja v  a2 s. co  m*/

    //Pass the Notification to the NotificationManager:
    mNotificationManager.notify(UPLOAD_PROGRESS_ID, notification);
    /*
    final TwLogin login = new TwLogin();
    login.initialize(FileUploadService.this);
    login.doLogin(FileUploadService.this, null, false);
            
    if (!login.isLoginOK()) {
       showFailMsg(FileUploadService.this, "Invalid login data or no network connection");
       return;
    }
    */
    Bundle intentPara = intent.getExtras();
    fileToUpload = (Uri) intentPara.getParcelable(Intent.EXTRA_STREAM);
    descText = intentPara.getString(EXTRA_DESCTEXT);
    subject = intentPara.getString(Intent.EXTRA_SUBJECT);

    if (targetFilename == null || targetFilename.equals(""))
        targetFilename = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(new Date()) + ".txt";

    String fileSpec = Max.getRealPathFromURI(FileUploadService.this, fileToUpload);

    String tempFile = Max.IMG_CACHE_DIR + "/imgUploadTemp_" + System.currentTimeMillis() + ".jpg";
    Max.resizeImage(fileSpec, tempFile, 1024, 768);

    try {
        Log.i("Andfrnd/UploadFile", "before uploadFile");
        final TwAjax uploader = new TwAjax(FileUploadService.this, true, true);
        uploader.addPostFile(new TwAjax.PostFile("media", targetFilename, tempFile));
        uploader.addPostData("status", descText);
        uploader.addPostData("title", subject);
        uploader.addPostData("source",
                "<a href='http://friendica-for-android.wiki-lab.net'>Friendica for Android</a>");
        uploader.uploadFile(Max.getServer(this) + "/api/statuses/update", null);
        Log.i("Andfrnd/UploadFile", "after uploadFile");
        Log.i("Andfrnd/UploadFile", "isSuccess() = " + uploader.isSuccess());
        Log.i("Andfrnd/UploadFile", "getError() = " + uploader.getError());

        mNotificationManager.cancel(UPLOAD_PROGRESS_ID);
        if (uploader.isSuccess() && uploader.getError() == null) {
            JSONObject result = null;
            try {
                Log.i("Andfrnd/UploadFile", "JSON RESULT: " + uploader.getHttpCode());
                result = (JSONObject) uploader.getJsonResult();

                String postedText = result.getString("text");
                showSuccessMsg(FileUploadService.this);

            } catch (Exception e) {
                String errMes = e.getMessage() + " | " + uploader.getResult();
                if (result != null)
                    try {
                        errMes = result.getString("error");
                    } catch (JSONException fuuuuJava) {
                    }

                showFailMsg(FileUploadService.this, errMes);

                e.printStackTrace();
            }
        } else if (uploader.getError() != null) {
            showFailMsg(FileUploadService.this, uploader.getError().toString());
        } else {
            showFailMsg(FileUploadService.this, uploader.getResult());
        }

    } finally {
        new File(tempFile).delete();
    }
}

From source file:com.lepin.activity.CarpoolWithCalendarActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ViewInjectUtil.inject(CarpoolWithCalendarActivity.this);
    Bundle bundle = getIntent().getExtras();
    carpoolProgramPassengerId = bundle.getString(Constant.CARPOOLPROGRAMPASSENGERID);
    isDriver = bundle.getBoolean(Constant.IS_DRIVER);
    setTitleText();/*from  w  w  w .  j  a  v a 2s.  c  o  m*/
    initView();

}

From source file:com.geekandroid.sdk.sample.JPushReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    Bundle bundle = intent.getExtras();
    Log.d(TAG, "[JPushReceiver] onReceive - " + intent.getAction() + ", extras: " + printBundle(bundle));

    if (JPushInterface.ACTION_REGISTRATION_ID.equals(intent.getAction())) {
        String regId = bundle.getString(JPushInterface.EXTRA_REGISTRATION_ID);
        Log.d(TAG, "[JPushReceiver] Registration Id : " + regId);
        //send the Registration Id to your server...

    } else if (JPushInterface.ACTION_MESSAGE_RECEIVED.equals(intent.getAction())) {
        Log.d(TAG, "[JPushReceiver] ???: "
                + bundle.getString(JPushInterface.EXTRA_MESSAGE));
        processCustomMessage(context, bundle);

    } else if (JPushInterface.ACTION_NOTIFICATION_RECEIVED.equals(intent.getAction())) {
        Log.d(TAG, "[JPushReceiver] ??");
        int notifactionId = bundle.getInt(JPushInterface.EXTRA_NOTIFICATION_ID);
        Log.d(TAG, "[JPushReceiver] ??ID: " + notifactionId);

    } else if (JPushInterface.ACTION_NOTIFICATION_OPENED.equals(intent.getAction())) {
        Log.d(TAG, "[JPushReceiver] ");
        JPushImpl.getInstance().clearAllNotifications();

        //Activity
        Intent i = new Intent(context, JPushOpenActivity.class);
        i.putExtras(bundle);/*from  ww  w .j av  a 2  s  .  c o m*/
        //i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
        context.startActivity(i);

    } else if (JPushInterface.ACTION_RICHPUSH_CALLBACK.equals(intent.getAction())) {
        Log.d(TAG, "[JPushReceiver] RICH PUSH CALLBACK: "
                + bundle.getString(JPushInterface.EXTRA_EXTRA));
        //? JPushInterface.EXTRA_EXTRA ??Activity ..

    } else if (JPushInterface.ACTION_CONNECTION_CHANGE.equals(intent.getAction())) {
        boolean connected = intent.getBooleanExtra(JPushInterface.EXTRA_CONNECTION_CHANGE, false);
        Log.w(TAG, "[JPushReceiver]" + intent.getAction() + " connected state change to " + connected);
    } else {
        Log.d(TAG, "[JPushReceiver] Unhandled intent - " + intent.getAction());
    }
}

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

@Override
public void onRestoreInstanceState(final Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    if (savedInstanceState.containsKey("titleText")) {
        ((EditText) findViewById(R.id.et_create_issue_title))
                .setText(savedInstanceState.getString("titleText"));
    }/*from   w ww .  jav  a 2 s  . c  o m*/
    if (savedInstanceState.containsKey("bodyText")) {
        ((EditText) findViewById(R.id.et_create_issue_body)).setText(savedInstanceState.getString("bodyText"));
    }
}