List of usage examples for android.content Intent getStringExtra
public String getStringExtra(String name)
From source file:com.shanet.relayremote.Main.java
public void onNewIntent(Intent intent) { // When an NFC tag is being written, call the write tag function when an intent is // received that says the tag is within range of the device and ready to be written to Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG); String nfcMessage = intent.getStringExtra("nfcMessage"); if (nfcMessage != null) { NFC.writeTag(this, tag, nfcMessage); }/*from w ww.j a va 2 s.c o m*/ }
From source file:com.firesoft.member.Activity.C1_PublishOrderActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { ArrayList<Product> productArrayList; super.onActivityResult(requestCode, resultCode, data); if (requestCode == 1) { switch (resultCode) { case 1://from w ww.jav a 2 s. c o m String choose_name, choose_id; choose_name = data.getStringExtra("name"); choose_id = data.getStringExtra("uid"); mcard_jb.setText(choose_name); mcard_jbid.setText(choose_id); break; case 2: break; } } }
From source file:com.nbos.phonebook.sync.authenticator.AuthenticatorActivity.java
/** * {@inheritDoc}/*ww w . j a va 2 s. c o m*/ */ @Override public void onCreate(Bundle icicle) { Log.i(tag, "onCreate(" + icicle + ")"); super.onCreate(icicle); mAccountManager = AccountManager.get(this); Log.i(tag, "loading data from Intent"); final Intent intent = getIntent(); mUsername = intent.getStringExtra(PARAM_USERNAME); mAuthtokenType = intent.getStringExtra(PARAM_AUTHTOKEN_TYPE); mRequestNewAccount = mUsername == null; mConfirmCredentials = intent.getBooleanExtra(PARAM_CONFIRMCREDENTIALS, false); Log.i(tag, "request new: " + mRequestNewAccount + " ,ConfirmCredentials: " + mConfirmCredentials); requestWindowFeature(Window.FEATURE_LEFT_ICON); setContentView(R.layout.login_activity); getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, android.R.drawable.ic_dialog_alert); Spinner spinner = (Spinner) findViewById(R.id.spinner); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.country_code_array, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(this); setSpinnerCountry(spinner); mMessage = (TextView) findViewById(R.id.message); mUsernameEdit = (EditText) findViewById(R.id.username_edit); mPasswordEdit = (EditText) findViewById(R.id.password_edit); mPhoneEdit = (EditText) findViewById(R.id.phone_edit); getPhoneNumber(getApplicationContext()); mUsernameEdit.setText(mUsername); mMessage.setText(getMessage()); }
From source file:com.commonsware.android.EMusicDownloader.SingleAlbum.java
/** Called when the activity is first created. */ @Override/*from w w w . ja va 2 s.c om*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.singlealbum); version = android.os.Build.VERSION.SDK_INT; Intent myIntent = getIntent(); albumId = myIntent.getStringExtra("keyalbumid"); emusicURL = myIntent.getStringExtra("keyexturl"); album = myIntent.getStringExtra("keyalbum"); artist = myIntent.getStringExtra("keyartist"); thisActivity = this; genreLayout = (LinearLayout) findViewById(R.id.llgenre); artistLayout = (LinearLayout) findViewById(R.id.llartist); labelLayout = (LinearLayout) findViewById(R.id.lllabel); nameTextView = (TextView) findViewById(R.id.tname); artistTextView = (TextView) findViewById(R.id.tartist); genreTextView = (TextView) findViewById(R.id.tgenre); labelTextView = (TextView) findViewById(R.id.tlabel); Resources res = getResources(); if (version < 11) { genreLayout.setBackgroundDrawable(res.getDrawable(android.R.drawable.list_selector_background)); labelLayout.setBackgroundDrawable(res.getDrawable(android.R.drawable.list_selector_background)); artistLayout.setBackgroundDrawable(res.getDrawable(android.R.drawable.list_selector_background)); } else { genreLayout.setBackgroundResource(R.drawable.list_selector_holo_dark); labelLayout.setBackgroundResource(R.drawable.list_selector_holo_dark); artistLayout.setBackgroundResource(R.drawable.list_selector_holo_dark); } genreLayout.setFocusable(true); labelLayout.setFocusable(true); artistLayout.setFocusable(true); albumArt = (ImageView) findViewById(R.id.albumart); reviewsButton = (ImageView) findViewById(R.id.reviewsbutton); //sampleButton=(ImageView)findViewById(R.id.samplebutton); trackList = (ListView) findViewById(R.id.trklist); ratingBar = (RatingBar) findViewById(R.id.rbar); trackList.setOnItemClickListener(this); urlAddress = "http://api.emusic.com/album/info?" + Secrets.apikey + "&albumId=" + albumId + "&include=albumRating,label&imageSize=small"; //Log.d("EMD - ",urlAddress); getInfoFromXML(); }
From source file:com.pentacog.mctracker.MCServerTrackerActivity.java
/** * Used to collect new server data from the AddServer Activity * @see android.app.Activity#onActivityResult(int, int, android.content.Intent) */// w w w.java 2 s. co m @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == AddServerActivity.ADD_SERVER_ACTIVITY_ID && resultCode == RESULT_OK) { String serverName = data.getStringExtra(Server.SERVER_NAME); String serverAddress = data.getStringExtra(Server.SERVER_ADDRESS); String serverPort = data.getStringExtra(Server.SERVER_PORT); int serverId = data.getIntExtra(Server.SERVER_ID, -1); if (serverId == -1) { Server newServer = new Server(serverName, serverAddress); try { newServer.port = Integer.parseInt(serverPort); } catch (NumberFormatException e) { } getServerData(newServer); } else { Server server = serverList.getItem(serverId); server.name = serverName; server.address = serverAddress; try { server.port = Integer.parseInt(serverPort); } catch (NumberFormatException e) { } server.queried = false; serverList.sort(); } } super.onActivityResult(requestCode, resultCode, data); }
From source file:com.urcera.android.ttsearch.TTS_ListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.list);/* w w w .ja va2 s. co m*/ // Retrieve the data passed by the intent from MainActivity Intent intent = getIntent(); // Capture the intent that started this activity if (intent != null) // Confirms if this activity was started through an intent { String data = intent.getStringExtra(TTS_MainActivity.DATA); // Data from MainActivity if (data != null) // Checks if data has value { query = data; // Assigns to query the data value received from MainActivity } String myLatitude = intent.getStringExtra(TTS_MainActivity.LAT); // Latitude from MainActivity if (myLatitude != null) // Checks if myLatitude has value { gpsLatitude = myLatitude; // Assigns to gpsLatitude the value received from MainActivity } else { gpsLatitude = LAT_DEF; // Assigns to gpsLatitude a default value } String myLongitude = intent.getStringExtra(TTS_MainActivity.LON); // Longitude from MainActivity if (myLongitude != null) // Checks if myLongitude has value { gpsLongitude = myLongitude; // Assigns to gpsLongitude the value received from MainActivity } else { gpsLongitude = LON_DEF; // Assigns to gpsLongitude a default value } } // >>>>>>>>>> To work on the mobile device until I enable AsyncTask <<<<<<<<<<<< //StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitNetwork().build(); //StrictMode.setThreadPolicy(policy); // Configures the progress dialog that is displayed while downloading the JSON dialog = new ProgressDialog(this); dialog.setTitle("Progreso"); dialog.setMessage("Descargando ..."); dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); dialog.setCancelable(true); // Downloads JSON and generates the list new bgTask().execute(); }
From source file:com.paymaya.sdk.android.checkout.PayMayaCheckoutActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.paymaya_checkout_activity); Intent intent = getIntent(); Preconditions.checkNotNull(intent, "Missing intent."); Bundle bundle = intent.getBundleExtra(EXTRAS_CHECKOUT_BUNDLE); Preconditions.checkNotNull(bundle, "Missing bundle."); mCheckout = bundle.getParcelable(EXTRAS_CHECKOUT); Preconditions.checkNotNull(mCheckout, "Missing checkout object."); mClientKey = intent.getStringExtra(EXTRAS_CLIENT_KEY); Preconditions.checkNotNull(mClientKey, "Missing client key."); initialize();//www. java2 s . c o m requestCreateCheckout(); }
From source file:com.duy.pascal.interperter.libraries.android.connection.bluetooth.AndroidBluetoothLib.java
@SuppressWarnings("unused") @PascalMethod(description = "Connect to a device over Bluetooth. Blocks until the connection is established or fails.", returns = "True if the connection was established successfully.") public String bluetoothConnect( @PascalParameter(name = "uuid", description = "The UUID passed here must match the UUID used by the server device.") @RpcDefault(DEFAULT_UUID) String uuid, @PascalParameter(name = "address", description = "The user will be presented with a list of discovered devices to choose from if an address is not provided.") @RpcOptional String address) throws IOException { if (address == null) { Intent deviceChooserIntent = new Intent(); deviceChooserIntent.setComponent(Constants.BLUETOOTH_DEVICE_LIST_COMPONENT_NAME); Intent result = mAndroidFacade.startActivityForResult(deviceChooserIntent); if (result != null && result.hasExtra(Constants.EXTRA_DEVICE_ADDRESS)) { address = result.getStringExtra(Constants.EXTRA_DEVICE_ADDRESS); } else {/*from ww w . j a v a 2 s .c o m*/ return null; } } BluetoothDevice mDevice; BluetoothSocket mSocket; BluetoothConnection conn; mDevice = mBluetoothAdapter.getRemoteDevice(address); mSocket = mDevice.createRfcommSocketToServiceRecord(UUID.fromString(uuid)); // Always cancel discovery because it will slow down a connection. mBluetoothAdapter.cancelDiscovery(); mSocket.connect(); conn = new BluetoothConnection(mSocket); return addConnection(conn); }
From source file:com.android.idearse.Result.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case ZBAR_QR_SCANNER_REQUEST: if (resultCode == RESULT_OK) { Intent goToResult = new Intent(getApplicationContext(), Result.class); goToResult.putExtra("qr", data.getStringExtra(ZBarConstants.SCAN_RESULT)); startActivity(goToResult);//from w w w . j a va 2 s .c o m } else if (resultCode == RESULT_CANCELED && data != null) { String error = data.getStringExtra(ZBarConstants.ERROR_INFO); if (!TextUtils.isEmpty(error)) { Toast.makeText(this, error, Toast.LENGTH_SHORT).show(); } } break; } }
From source file:com.otaupdater.SettingsActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == PROKEY_REQ_CODE) { int responseCode = data.getIntExtra("RESPONSE_CODE", 0); String purchaseDataStr = data.getStringExtra("INAPP_PURCHASE_DATA"); //TODO need moar verification! if (resultCode == RESULT_OK) { if (responseCode == 0) { try { JSONObject purchaseData = new JSONObject(purchaseDataStr); if (purchaseData.getString("productId").equals(Config.PROKEY_SKU)) { cfg.setKeyPurchaseToken(purchaseData.getString("purchaseToken")); updateProKeySummary(); Toast.makeText(this, R.string.prokey_success, Toast.LENGTH_SHORT).show(); } else { Toast.makeText(this, R.string.prokey_error_other, Toast.LENGTH_SHORT).show(); }//from ww w . jav a2 s .c o m } catch (JSONException e) { Toast.makeText(this, R.string.prokey_error_other, Toast.LENGTH_SHORT).show(); } } else if (responseCode == 1) { Toast.makeText(this, R.string.prokey_error_cancelled, Toast.LENGTH_SHORT).show(); } else { Toast.makeText(this, R.string.prokey_error_other, Toast.LENGTH_SHORT).show(); } } else { Toast.makeText(this, R.string.prokey_error_other, Toast.LENGTH_SHORT).show(); } } }