List of usage examples for android.os Bundle getString
@Nullable
public String getString(@Nullable String key)
From source file:net.heroicefforts.viable.android.rep.jira.JIRARepository.java
public JIRARepository(String appName, Activity act, Bundle metaData) //NOPMD throws CreateException { this(appName, metaData.getString("viable-provider-location")); }
From source file:oss.ridendivideapp.PlacesAutoCompleteActivity.java
@Override public void onCreate(Bundle savedInstanceState) { try {/* w w w .j a va 2 s . c o m*/ super.onCreate(savedInstanceState); setContentView(R.layout.give_ride_content); /* Creating DBAdapter instance */ gr_datasource = new DBAdapter(this); /* Get email ID from previous activity to maintain session */ Bundle extras = getIntent().getExtras(); if (extras != null) { str_usrid = extras.getString("usrid"); } buttonSubmit = (Button) findViewById(R.id.btn_gr_submit); buttonCancel = (Button) findViewById(R.id.btn_gr_cancel); /* Get radius and cost */ et_radius = (EditText) this.findViewById(R.id.txt_gr_radius); et_cost = (EditText) this.findViewById(R.id.txt_gr_cost); /* Adding PlacesAutoComplete adapter to the FROM autocomplete field */ gr_frm_acView = (AutoCompleteTextView) findViewById(R.id.txt_gr_from); gr_frm_adapter = new PlacesAutoCompleteAdapter(this, R.layout.frm_item_list); gr_frm_acView.setAdapter(gr_frm_adapter); gr_frm_acView.setOnItemClickListener(this); /* Adding PlacesAutoComplete adapter to the TO autocomplete field */ gr_to_acView = (AutoCompleteTextView) findViewById(R.id.txt_gr_to); gr_to_adapter = new PlacesAutoCompleteAdapter(this, R.layout.to_item_list); gr_to_acView.setAdapter(gr_to_adapter); gr_to_acView.setOnItemClickListener(this); /* Adding array adapter to spinner control for seats */ sp_seats = (Spinner) findViewById(R.id.spn_gr_seats); ArrayAdapter<String> seats_adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, str_seats); sp_seats.setAdapter(seats_adapter); /* Prompt a dialog box upon Date button click */ datePicker = (Button) findViewById(R.id.btn_gr_datepicker); datePicker.setText(dateFormatter.format(dateTime.getTime())); datePicker.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { showDialog(DIALOG_DATE); } }); /* Prompt a dialog box upon Time button click */ timePicker = (Button) findViewById(R.id.btn_gr_timepicker); timePicker.setText(timeFormatter.format(dateTime.getTime())); timePicker.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { showDialog(DIALOG_TIME); } }); buttonSubmit.setOnClickListener(buttonSubmitOnClickListener); buttonCancel.setOnClickListener(buttonCancelOnClickListener); sp_seats.setOnItemSelectedListener(spinnerseatsOnItemSelectedListener); } catch (Exception e) { Log.e("Places AutoComplete Activity OnCreate:", e.toString()); } }
From source file:fr.cph.chicago.core.activity.TrainMapActivity.java
@Override public void onRestoreInstanceState(final Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); line = savedInstanceState.getString(bundleTrainLine); }
From source file:com.facebook.android.Util.java
/** * Connect to an HTTP URL and return the response as a string. * * Note that the HTTP method override is used on non-GET requests. (i.e. * requests are made as "POST" with method specified in the body). * * @param url - the resource to open: must be a welformed URL * @param method - the HTTP method to use ("GET", "POST", etc.) * @param params - the query parameter for the URL (e.g. access_token=foo) * @return the URL contents as a String/*from ww w . j av a 2 s . c o m*/ * @throws MalformedURLException - if the URL format is invalid * @throws IOException - if a network problem occurs */ @Deprecated public static String openUrl(String url, String method, Bundle params) throws IOException { // random string as boundary for multi-part http post String strBoundary = "3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f"; String endLine = "\r\n"; OutputStream os; if (method.equals("GET")) { url = url + "?" + encodeUrl(params); } Utility.logd("Facebook-Util", method + " URL: " + url); HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection(); conn.setRequestProperty("User-Agent", System.getProperties().getProperty("http.agent") + " FacebookAndroidSDK"); if (!method.equals("GET")) { Bundle dataparams = new Bundle(); for (String key : params.keySet()) { Object parameter = params.get(key); if (parameter instanceof byte[]) { dataparams.putByteArray(key, (byte[]) parameter); } } // use method override if (!params.containsKey("method")) { params.putString("method", method); } if (params.containsKey("access_token")) { String decoded_token = URLDecoder.decode(params.getString("access_token")); params.putString("access_token", decoded_token); } conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + strBoundary); conn.setDoOutput(true); conn.setDoInput(true); conn.setRequestProperty("Connection", "Keep-Alive"); conn.connect(); os = new BufferedOutputStream(conn.getOutputStream()); try { os.write(("--" + strBoundary + endLine).getBytes()); os.write((encodePostBody(params, strBoundary)).getBytes()); os.write((endLine + "--" + strBoundary + endLine).getBytes()); if (!dataparams.isEmpty()) { for (String key : dataparams.keySet()) { os.write(("Content-Disposition: form-data; filename=\"" + key + "\"" + endLine).getBytes()); os.write(("Content-Type: content/unknown" + endLine + endLine).getBytes()); os.write(dataparams.getByteArray(key)); os.write((endLine + "--" + strBoundary + endLine).getBytes()); } } os.flush(); } finally { os.close(); } } String response = ""; try { response = read(conn.getInputStream()); } catch (FileNotFoundException e) { // Error Stream contains JSON that we can parse to a FB error response = read(conn.getErrorStream()); } return response; }
From source file:com.stikyhive.gcm.MyGcmListenerService.java
/** * Called when message is received.// w w w .java 2 s . c o m * * @param from SenderID of the sender. * @param data Data bundle containing message data as key/value pairs. * For Set of keys use data.keySet(). */ // [START receive_message] @Override public void onMessageReceived(String from, Bundle data) { sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); ws = new JsonWebService(); dbHelper = new DBHelper(getApplicationContext()); fileName = data.getString("fileName"); String message = data.getString("message"); this.msg = data.getString("msg"); int offerId = Integer.parseInt(data.getString("offerId")); int offerStatus = Integer.parseInt(data.getString("offerStatus")); String price = data.getString("price"); String rate = data.getString("rate"); String name = data.getString("name"); recipientStkid = data.getString("recipientStkid"); stkidCheck = sharedPreferences.getString("stkid", ""); chatRecipient = data.getString("chatRecipient"); chatRecipientUrl = data.getString("chatRecipientUrl"); senderToken = data.getString("senderToken"); recipientToken = data.getString("recipientToken"); ChattingActivity.firstConnect = true; Log.i(TAG, "recipient url : " + chatRecipientUrl); Log.i(TAG, "Message: " + message); //this.message = message; Log.i(TAG, "msg " + message); sharedPreferences.edit().putString("fileName", fileName).apply(); sharedPreferences.edit().putString("message", message).apply(); sharedPreferences.edit().putInt("offerId", offerId).apply(); sharedPreferences.edit().putInt("offerStatus", offerStatus).apply(); sharedPreferences.edit().putString("price", price).apply(); sharedPreferences.edit().putString("rate", rate).apply(); sharedPreferences.edit().putString("name", name).apply(); sharedPreferences.edit().putString("chatRecipientUrl", chatRecipientUrl).apply(); sharedPreferences.edit().putString("recipientStkid", recipientStkid).apply(); sharedPreferences.edit().putString("chatRecipientName", chatRecipient).apply(); sharedPreferences.edit().putString("stkidCheck", stkidCheck).apply(); sharedPreferences.edit().putString("senderToken", senderToken).apply(); // sharedPreferences.edit().putString("recipientToken", recipientToken).apply(); // Notify UI that registration has completed, so the progress indicator can be hidden. /*Intent registrationComplete = new Intent(QuickstartPreferences.REGISTRATION_COMPLETE); LocalBroadcastManager.getInstance(this).sendBroadcast(registrationComplete);*/ //sharedPreferences.edit().putBoolean(QuickstartPreferences.SENT_TOKEN_TO_SERVER, true).apply(); /** * Production applications would usually process the message here. * Eg: - Syncing with server. * - Store message in local database. * - Update UI. */ /** * In some cases it may be useful to show a notification indicating to the user * that a message was received. */ if (!checkApp()) { sendNotification(message); } }
From source file:ac.robinson.mediaphone.activity.NarrativeBrowserActivity.java
private void scrollToSelectedFrame(Bundle messageData) { String narrativeId = messageData.getString(getString(R.string.extra_parent_id)); String frameId = messageData.getString(getString(R.string.extra_internal_id)); if (narrativeId != null && frameId != null) { for (int i = 0, n = mNarratives.getChildCount(); i < n; i++) { final Object viewTag = mNarratives.getChildAt(i).getTag(); if (viewTag instanceof NarrativeViewHolder) { final NarrativeViewHolder holder = (NarrativeViewHolder) viewTag; if (narrativeId.equals(holder.narrativeInternalId)) { holder.frameList.scrollTo(frameId); break; }/*from ww w. j a va 2 s . co m*/ } } } }
From source file:ac.robinson.mediaphone.activity.NarrativeBrowserActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); UIUtilities.configureActionBar(this, false, true, R.string.narrative_list_header, 0); setContentView(R.layout.narrative_browser); // load previous id on screen rotation if (savedInstanceState != null) { mPreviousSavedState = savedInstanceState; // for horizontal scroll position loading (NarrativeAdapter) mCurrentSelectedNarrativeId = savedInstanceState.getString(getString(R.string.extra_internal_id)); // mScrollNarrativesToEnd = savedInstanceState.getInt(getString(R.string.extra_start_scrolled_to_end), 0); } else {//from ww w . j a va2 s . com // initialise preferences on first run, and perform an upgrade if applicable PreferenceManager.setDefaultValues(this, R.xml.preferences, true); UpgradeManager.upgradeApplication(NarrativeBrowserActivity.this); // delete old media on startup (but not on screen rotation) - immediate task so we don't block the queue runImmediateBackgroundTask(getMediaCleanupRunnable()); } initialiseNarrativesView(); }