List of usage examples for android.content Intent getStringExtra
public String getStringExtra(String name)
From source file:SearchResultActivity.java
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); if (Intent.ACTION_SEARCH.equals(getIntent().getAction())) { handleSearch(intent.getStringExtra(SearchManager.QUERY)); }// ww w . j ava2s. c o m }
From source file:com.prey.receivers.C2DMReceiver.java
private void handleRegistration(Context context, Intent intent) { String registration = intent.getStringExtra("registration_id"); if (intent.getStringExtra("error") != null) { PreyLogger.d("Couldn't register to c2dm: " + intent.getStringExtra("error")); PreyConfig.getPreyConfig(context).setRegisterC2dm(false); PreyConfig.getPreyConfig(context).setNotificationId(""); } else if (intent.getStringExtra("unregistered") != null) { // unregistration done, new messages from the authorized sender will // be rejected PreyLogger.d("Unregistered from c2dm: " + intent.getStringExtra("unregistered")); PreyConfig.getPreyConfig(context).setRegisterC2dm(false); PreyConfig.getPreyConfig(context).setNotificationId(""); } else if (registration != null) { //PreyLogger.d("Registration id: " + registration); new UpdateCD2MId().execute(registration, context); // Send the registration ID to the 3rd party site that is sending // the messages. // This should be done in a separate thread. // When done, remember that all registration is done. }/*from w ww . j ava 2 s .c o m*/ }
From source file:com.networkmanagerapp.SettingBackgroundUploader.java
/** * Performs the file upload in the background * @throws FileNotFoundException, IOException, both caught internally. * @param arg0 The intent to run in the background. *///from w ww . j av a 2s . c o m @Override protected void onHandleIntent(Intent arg0) { configFilePath = arg0.getStringExtra("CONFIG_FILE_PATH"); key = arg0.getStringExtra("KEY"); value = arg0.getStringExtra("VALUE"); mNM = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); showNotification(); try { fos = NetworkManagerMainActivity.getInstance().openFileOutput(this.configFilePath, Context.MODE_PRIVATE); String nameLine = "Name" + " = " + "\"" + this.key + "\"\n"; String valueLine = "Value" + " = " + "\"" + this.value + "\""; fos.write(nameLine.getBytes()); fos.write(valueLine.getBytes()); fos.close(); String password = PreferenceManager.getDefaultSharedPreferences(this).getString("password_preference", ""); File f = new File(NetworkManagerMainActivity.getInstance().getFilesDir() + "/" + this.configFilePath); HttpHost targetHost = new HttpHost( PreferenceManager.getDefaultSharedPreferences(this).getString("ip_preference", "192.168.1.1"), 1080, "http"); DefaultHttpClient client = new DefaultHttpClient(); client.getCredentialsProvider().setCredentials( new AuthScope(targetHost.getHostName(), targetHost.getPort()), new UsernamePasswordCredentials("root", password)); HttpPost httpPost = new HttpPost("http://" + PreferenceManager.getDefaultSharedPreferences(NetworkManagerMainActivity.getInstance()) .getString("ip_preference", "192.168.1.1") + ":1080/cgi-bin/upload.php"); MultipartEntity entity = new MultipartEntity(); entity.addPart("file", new FileBody(f)); httpPost.setEntity(entity); HttpResponse response = client.execute(httpPost); Log.d("upload", response.getStatusLine().toString()); } catch (FileNotFoundException e) { Log.e("NETWORK_MANAGER_XU_FNFE", e.getLocalizedMessage()); } catch (IOException e) { Log.e("NETWORK_MANAGER_XU_IOE", e.getLocalizedMessage()); } finally { mNM.cancel(R.string.upload_service_started); stopSelf(); } }
From source file:net.eledge.android.europeana.gui.notification.receiver.UrlButtonReceiver.java
@Override public void onReceive(Context context, Intent intent) { int notificationId = intent.getIntExtra(PARAM_NOTIFICATIONID, Config.NOTIFICATION_NEWBLOG); String url = intent.getStringExtra(PARAM_URL); if (StringUtils.isNoneBlank(url)) { try {//from w w w . java 2 s . co m PendingIntent.getActivity(context, 0, new Intent(Intent.ACTION_VIEW, Uri.parse(url)), PendingIntent.FLAG_UPDATE_CURRENT).send(); } catch (PendingIntent.CanceledException e) { Log.e(UrlButtonReceiver.class.getSimpleName(), e.getMessage(), e); } } final NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); nm.cancel(notificationId); }
From source file:com.hybris.mobile.app.commerce.activity.OrderDetailActivity.java
@Override protected void onResume() { super.onResume(); Intent intent = getIntent(); /// Search query, we redirect to the order details page if (intent != null && StringUtils.isNotBlank(intent.getStringExtra(SearchManager.QUERY))) { intent.putExtra(IntentConstants.ORDER_CODE, intent.getStringExtra(SearchManager.QUERY)); intent.putExtra(IntentConstants.ORDER_FROM_SEARCH, true); }/* w ww .j av a 2 s . c o m*/ }
From source file:com.parse.GCMService.java
private void handleGcmPushIntent(Intent intent) { String messageType = intent.getStringExtra("message_type"); if (messageType != null) { /*//from w w w. j av a2s .co m * The GCM docs reserve the right to use the message_type field for new actions, but haven't * documented what those new actions are yet. For forwards compatibility, ignore anything * with a message_type field. */ PLog.i(TAG, "Ignored special message type " + messageType + " from GCM via intent " + intent); } else { String pushId = intent.getStringExtra("push_id"); String timestamp = intent.getStringExtra("time"); String dataString = intent.getStringExtra("data"); String channel = intent.getStringExtra("channel"); JSONObject data = null; if (dataString != null) { try { data = new JSONObject(dataString); } catch (JSONException e) { PLog.e(TAG, "Ignoring push because of JSON exception while processing: " + dataString, e); return; } } PushRouter.getInstance().handlePush(pushId, timestamp, channel, data); } }
From source file:com.hybris.mobile.app.commerce.activity.OrderHistoryActivity.java
@Override protected void onResume() { super.onResume(); Intent intent = getIntent(); // Search query, we redirect to the order details page if (intent != null && StringUtils.isNotBlank(intent.getStringExtra(SearchManager.QUERY))) { Intent newIntent = new Intent(this, OrderDetailActivity.class); newIntent.putExtra(IntentConstants.ORDER_CODE, intent.getStringExtra(SearchManager.QUERY)); newIntent.putExtra(IntentConstants.ORDER_FROM_SEARCH, true); startActivity(newIntent);/*ww w . java 2 s .c o m*/ } }
From source file:blackman.matt.catalog.CatalogActivity.java
/** * Creates all the things on startup of the activity. * * @param savedInstanceState A saved state if this is being opened again. *///from ww w . jav a 2 s. co m @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_gallery); Intent intent = getIntent(); mBoardRoot = intent.getStringExtra(ARG_CATALOG_BOARD); String fileUrl = mBoardRoot + "/catalog.json"; //noinspection ConstantConditions getActionBar().setTitle("Catalog - /" + mBoardRoot + "/"); mPosts = new ArrayList<Post>(); CatalogLoader loader = new CatalogLoader(); loader.setNotifier(this); URL url; try { url = new URL("https", "8chan.co", fileUrl); loader.execute(url); } catch (MalformedURLException e) { e.printStackTrace(); } }
From source file:com.autburst.picture.facebook.PublishHandler.java
public void go() { Facebook fb = Session.restore(getActivity()).getFb(); AsyncFacebookRunner runner = new AsyncFacebookRunner(fb); Bundle params = new Bundle(); final Intent intent = getActivity().getIntent(); String message = intent.getStringExtra("message"); String link = intent.getStringExtra("link"); String name = intent.getStringExtra("name"); String caption = intent.getStringExtra("caption"); String description = intent.getStringExtra("description"); String picture = intent.getStringExtra("picture"); params.putString("message", message); params.putString("link", link); params.putString("name", name); params.putString("caption", caption); params.putString("description", description); params.putString("picture", picture); runner.request("me/feed", params, "POST", new AsyncRequestListener() { public void onComplete(JSONObject obj) { String html;//w w w. j a v a2 s . com Log.d(TAG, "onComplete"); getActivity().runOnUiThread(new Runnable() { @Override public void run() { getActivity().showDialog(FacebookActivity.POSTED); } }); } @Override public void onFacebookError(FacebookError e) { showProblem(); } @Override public void onFileNotFoundException(FileNotFoundException e) { showProblem(); } @Override public void onIOException(IOException e) { showProblem(); } @Override public void onMalformedURLException(MalformedURLException e) { showProblem(); } }); }
From source file:cn.count.easydrive366.signup.Step2Activity.java
@Override protected void onCreate(Bundle savedInstanceState) { this._isHideTitleBar = true; super.onCreate(savedInstanceState); setContentView(R.layout.modules_step2_activity); this.setupLeftButton(); this.setRightButtonInVisible(); this.setupPhoneButtonInVisible(); btnNext = (Button) findViewById(R.id.btn_ok); edtVIN = (EditText) findViewById(R.id.edt_vin); edtEngine_no = (EditText) findViewById(R.id.edt_engine_no); edtRegistration_date = (EditText) findViewById(R.id.edt_registration_date); edtOwner_name = (EditText) findViewById(R.id.edt_owner_name); edtOwner_license = (EditText) findViewById(R.id.edt_owner_license); btnNext.setOnClickListener(new OnClickListener() { @Override// w w w . java 2s . c o m public void onClick(View v) { nextStep(); } }); findViewById(R.id.row_registration_date).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { chooseDate(edtRegistration_date); } }); Intent intent = this.getIntent(); edtVIN.setText(intent.getStringExtra("vin")); edtEngine_no.setText(intent.getStringExtra("engine_no")); edtRegistration_date.setText(intent.getStringExtra("registration_date")); edtOwner_name.setText(intent.getStringExtra("owner_name")); edtOwner_license.setText(intent.getStringExtra("owner_license")); }