List of usage examples for android.os Bundle getString
@Nullable
public String getString(@Nullable String key)
From source file:edu.rit.csh.androidwebnews.PostSwipeableActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ViewPager mViewPager;/*from www.ja v a2 s . c o m*/ setContentView(R.layout.activity_post_swipable); hc = new HttpsConnector(this); Bundle extras = getIntent().getExtras(); newsgroupName = extras.getString("SELECTED_NEWSGROUP"); id = extras.getInt("SELECTED_ID"); int selected_id = extras.getInt("GOTO_THIS"); fromSearch = extras.getBoolean("SEARCH_RESULTS"); ppa = new PostPagerAdapter(getSupportFragmentManager(), fromSearch); mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(ppa); dialog = new InvalidApiKeyDialog(this); mViewPager.setCurrentItem(selected_id); if (!fromSearch) { for (int x = 0; x < DisplayThreadsActivity.lastFetchedThreads.size(); x++) { if (DisplayThreadsActivity.lastFetchedThreads.get(x).getNumber() == id) { rootThread = DisplayThreadsActivity.lastFetchedThreads.get(x); break; } } } }
From source file:fib.lcfib.raco.Controladors.ControladorLoginRaco.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.vista_login); Bundle extras = getIntent().getExtras(); if (extras != null) { queEs = extras.getString("queEs"); }/*from w ww. j a v a2 s .c o m*/ loginDialog = new Dialog(this); showAddDialog(); }
From source file:gov.wa.wsdot.android.wsdot.ui.FerriesRouteAlertsBulletinsFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); Bundle args = activity.getIntent().getExtras(); mAlerts = args.getString("alert"); }
From source file:br.ufsc.das.gtscted.shibbauth.ShibAuthenticationActivity.java
/** Called when the activity is first created. */ @Override/*w ww . j av a 2s. co m*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.idp_selection); loginButton = (Button) findViewById(R.id.loginButton); backButton = (Button) findViewById(R.id.backButton); usernameTxt = (EditText) findViewById(R.id.usernameTxt); passwordTxt = (EditText) findViewById(R.id.passwordTxt); idpSpinner = (Spinner) findViewById(R.id.idpSpinner); //Configura o ArrayAdapter do spinner. ArrayAdapter<CharSequence> spinnerArrayAdapter; spinnerArrayAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item); spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); idpSpinner.setAdapter(spinnerArrayAdapter); // Obtm os parmetros passados pela Activity anterior // (no caso, a pgina do WAYF como uma String e o // nico cookie da Connection usada anteriormente) Bundle bundle = this.getIntent().getExtras(); String wayfHtml = bundle.getString("html_source"); final String wayfLocation = bundle.getString("wayf_location"); final SerializableCookie receivedCookie = (SerializableCookie) bundle.getSerializable("cookie"); //Obtm todos os tags de nome "option", que correspondem // aos IdPs, da pgina do WAYF. Document wayfDocument = Jsoup.parse(wayfHtml); idpElements = wayfDocument.select("option"); //Popula o spinner com os nomes dos IdPs encontrados. for (Element idpElement : idpElements) { String idpName = idpElement.text(); spinnerArrayAdapter.add(idpName); } // Obtm o caminho para o qual deve ser passado o IdP do usurio. formElements = wayfDocument.select("form"); for (Element formElement : formElements) { if (formElement.attr("id").equals("IdPList")) { wayfActionPath = formElement.attr("action"); } } loginButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Obtm a URL correspondente ao idP selecionado no spinner. int selectedIdpPosition = idpSpinner.getSelectedItemPosition(); Element selectedIdp = idpElements.get(selectedIdpPosition); selectedIdpUrl = selectedIdp.attr("value"); try { // Obtm os campos "username" e "password" fornecidos // pelo usurio e necessrios para a autenticao. String username = usernameTxt.getText().toString(); String password = passwordTxt.getText().toString(); // Cria um novo objeto Connection, e adiciona o // cookie passado pela Activity anterior. Connection connection = new Connection(); BasicClientCookie newCookie = new BasicClientCookie(receivedCookie.getName(), receivedCookie.getValue()); newCookie.setDomain(receivedCookie.getDomain()); connection.addCookie(newCookie); // Tenta realizar a autenticao no IdP selecionado. O resultado corresponde // pgina para a qual o cliente redirecionado em caso de autenticao // bem-sucedida. String authResult = connection.authenticate(wayfLocation, wayfActionPath, selectedIdpUrl, username, password); // Apenas mostra o recurso que o usurio queria acessar (neste caso, mostra a pg. de // "Homologao de atributos"). Intent newIntent = new Intent(ShibAuthenticationActivity.this.getApplicationContext(), TestActivity.class); Bundle bundle = new Bundle(); bundle.putString("arg", authResult); newIntent.putExtras(bundle); startActivity(newIntent); } catch (IOException e) { String message = "IOException - problema na conexo"; Toast toast = Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG); toast.show(); } catch (Exception e) { String message = "Exception - problema na autenticao"; Toast toast = Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG); toast.show(); } } }); backButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); }
From source file:de.badaix.snapcast.ClientSettingsFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle bundle = getArguments(); try {//from w w w. j a va 2 s . com client = new Client(new JSONObject(bundle.getString("client"))); } catch (JSONException e) { e.printStackTrace(); } clientOriginal = new Client(client.toJson()); final ArrayList<Stream> streams = new ArrayList<>(); try { JSONArray jsonArray = new JSONArray(bundle.getString("streams")); for (int i = 0; i < jsonArray.length(); i++) streams.add(new Stream(jsonArray.getJSONObject(i))); } catch (JSONException e) { e.printStackTrace(); } final CharSequence[] streamNames = new CharSequence[streams.size()]; final CharSequence[] streamIds = new CharSequence[streams.size()]; for (int i = 0; i < streams.size(); ++i) { streamNames[i] = streams.get(i).getName(); streamIds[i] = streams.get(i).getId(); } // Load the preferences from an XML resource addPreferencesFromResource(R.xml.client_preferences); prefName = (EditTextPreference) findPreference("pref_client_name"); prefName.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { prefName.setSummary((String) newValue); client.setName((String) newValue); return true; } }); prefStream = (ListPreference) findPreference("pref_client_stream"); prefStream.setEntries(streamNames); prefStream.setEntryValues(streamIds); for (int i = 0; i < streams.size(); ++i) { if (streamIds[i].equals(client.getConfig().getStream())) { prefStream.setSummary(streamNames[i]); prefStream.setValueIndex(i); break; } } prefStream.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { for (int i = 0; i < streams.size(); ++i) { if (streamIds[i].equals(newValue)) { prefStream.setSummary(streamNames[i]); client.getConfig().setStream(streamIds[i].toString()); prefStream.setValueIndex(i); break; } } return false; } }); prefMac = (Preference) findPreference("pref_client_mac"); prefIp = (Preference) findPreference("pref_client_ip"); prefHost = (Preference) findPreference("pref_client_host"); prefOS = (Preference) findPreference("pref_client_os"); prefVersion = (Preference) findPreference("pref_client_version"); prefLastSeen = (Preference) findPreference("pref_client_last_seen"); prefLatency = (EditTextPreference) findPreference("pref_client_latency"); prefLatency.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { String latency = (String) newValue; if (TextUtils.isEmpty(latency)) latency = "0"; prefLatency.setSummary(latency + "ms"); client.getConfig().setLatency(Integer.parseInt(latency)); return true; } }); update(); }
From source file:com.vsu.bruteremote.FileBrowser.java
/** * Called when the activity is first created. * @param savedInstanceState If the activity is being re-created from a previous * saved state, this is the state. *//*from www . ja va 2 s . co m*/ @Override public void onCreate(Bundle savedInstanceState) { if (D) Log.e(TAG, "+ ON CREATE +"); super.onCreate(savedInstanceState); Bundle extras = getIntent().getExtras(); String directory = ""; if (extras != null) { directory = extras.getString(EXTRA_STARTPATH); } // Render initial directory listing refreshData(directory); // Set result CANCELED in case the user backs out setResult(Activity.RESULT_CANCELED); }
From source file:com.arantius.tivocommander.Suggestions.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle bundle = getIntent().getExtras(); MindRpc.init(this, bundle); String collectionId = null;/*from w w w.j a v a2 s. com*/ if (bundle != null) { collectionId = bundle.getString("collectionId"); if (collectionId == null) { Utils.toast(this, "Oops; missing collection ID", Toast.LENGTH_SHORT); } else { getParent().setProgressBarIndeterminateVisibility(true); SuggestionsSearch request = new SuggestionsSearch(collectionId); MindRpc.addRequest(request, mSuggestionListener); } } Utils.log(String.format("Suggestions: collectionId:%s", collectionId)); }
From source file:com.notifry.android.C2DMReceiver.java
protected void onMessage(Context context, Intent intent) { Bundle extras = intent.getExtras(); // The server would have sent a message type. String type = extras.getString("type"); if (type.equals("message")) { // Fetch the message out into a NotifryMessage object. try {//from w w w . j a v a2 s.co m NotifryMessage message = NotifryMessage.fromC2DM(context, extras); Log.d("Notifry", "We've been notifried! " + message.getMessage()); // Persist this message to the database. message.save(context); // Send a notification to the notification service, which will then // dispatch and handle everything else. Intent intentData = new Intent(getBaseContext(), NotificationService.class); intentData.putExtra("messageId", message.getId()); intentData.putExtra("operation", "notifry"); startService(intentData); } catch (ParseException ex) { // Failed to parse a Long. Log.e(TAG, "Failed to parse a long - malformed message from server: " + ex.getMessage()); } catch (NotifryMessage.UnsourceableMessage ex) { // Hmm... a message there was no way to find a source for. // Don't do anything - but do log it. Long accountId = Long.parseLong(extras.getString("device_id")); Long sourceId = Long.parseLong(extras.getString("source_id")); Log.d(TAG, "Unsourceable message: source ID " + sourceId + " device ID " + accountId); } } else if (type.equals("refreshall")) { // Server says to refresh our list when we can. Typically means that // a source has been deleted. Make a note of it. Long serverAccountId = Long.parseLong(extras.getString("device_id")); NotifryAccount account = NotifryAccount.FACTORY.getByServerId(context, serverAccountId); // Assuming it was found... if (account != null) { account.setRequiresSync(true); account.save(context); } Log.d(TAG, "Server just asked us to refresh sources list - usually due to deletion."); } else if (type.equals("sourcechange")) { // Server says that a source has been created or updated. // We should pull a copy of it locally. Long serverSourceId = Long.parseLong(extras.getString("id")); Long serverDeviceId = Long.parseLong(extras.getString("device_id")); Intent intentData = new Intent(getBaseContext(), UpdaterService.class); intentData.putExtra("type", "sourcechange"); intentData.putExtra("sourceId", serverSourceId); intentData.putExtra("deviceId", serverDeviceId); startService(intentData); Log.d(TAG, "Server just asked us to update/create server source ID " + serverSourceId + " for server account ID " + serverDeviceId); } else if (type.equals("devicedelete")) { // Server says we've been deregistered. We should now clear our registration. Long deviceId = Long.parseLong(extras.getString("device_id")); NotifryAccount account = NotifryAccount.FACTORY.getByServerId(context, deviceId); // Check if it's NULL - it's possible we have a desync! if (account != null) { // Disable it, and clear the registration ID. account.setEnabled(false); account.setServerRegistrationId(null); account.setRequiresSync(true); // Save it back to the database. account.save(context); } Log.d(TAG, "Server just asked us to deregister! And should be done now."); } }
From source file:edu.cmu.sei.cloudlet.client.ska.adb.InDataService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { Log.v(TAG, "Received data."); Bundle extras = intent.getExtras(); Log.v(TAG, "Number of items: " + extras.size()); JSONObject jsonData = new JSONObject(); for (String key : extras.keySet()) { try {//w w w .j av a2s . c o m jsonData.put(key, extras.getString(key)); } catch (JSONException e) { e.printStackTrace(); } } String result = mDataHandler.handleData(jsonData, this); Log.v(TAG, "Writing result to file."); FileHandler.writeToFile(ADBConstants.OUT_FILE_PATH, result); Log.v(TAG, "Finished writing result to file."); // We don't need this service to run anymore. stopSelf(); return START_NOT_STICKY; }
From source file:net.idlesoft.android.apps.github.activities.BranchesList.java
@Override public void onCreate(final Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.branch_list); mPrefs = getSharedPreferences(Hubroid.PREFS_NAME, 0); mEditor = mPrefs.edit();/*from w w w .ja v a 2 s . c o m*/ mUsername = mPrefs.getString("username", ""); mPassword = mPrefs.getString("password", ""); mGapi.authenticate(mUsername, mPassword); mLoadView = getLayoutInflater().inflate(R.layout.loading_listitem, null); mBranchList = (ListView) findViewById(R.id.lv_branchList_list); mBranchList.setOnItemClickListener(mOnBranchListItemClick); ((ImageButton) findViewById(R.id.btn_search)).setOnClickListener(new OnClickListener() { public void onClick(final View v) { startActivity(new Intent(BranchesList.this, Search.class)); } }); final TextView title = (TextView) findViewById(R.id.tv_page_title); title.setText("Branches"); final Bundle extras = getIntent().getExtras(); if (extras != null) { mRepoName = extras.getString("repo_name"); mRepoOwner = extras.getString("repo_owner"); mGetBranchesTask = (GetBranchesTask) getLastNonConfigurationInstance(); if (mGetBranchesTask == null) { mGetBranchesTask = new GetBranchesTask(); } mGetBranchesTask.activity = this; if ((mGetBranchesTask.getStatus() == AsyncTask.Status.PENDING) && (mBranchListAdapter == null)) { mGetBranchesTask.execute(); } } }