List of usage examples for android.content Intent putExtras
public @NonNull Intent putExtras(@NonNull Bundle extras)
From source file:com.firesoft.member.Activity.C0_ServiceListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.c0_service_list); mTitleTextView = (TextView) findViewById(R.id.top_view_title); mListView = (XListView) findViewById(R.id.c0_user_list); mListView.setXListViewListener(this, 0); mListView.setPullLoadEnable(true);/*w w w. j a va 2 s . c om*/ mListView.setPullRefreshEnable(true); mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (position - 1 >= 0 && position - 1 < mDataModel.dataList.size()) { SIMPLE_MEMBER member = mDataModel.dataList.get(position - 1); Intent intent_profile = new Intent(C0_ServiceListActivity.this, F0_ProfileActivity.class); Bundle bundle = new Bundle(); bundle.putSerializable("member", member); intent_profile.putExtras(bundle); startActivityForResult(intent_profile, REQUESTCODE1); C0_ServiceListActivity.this.overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out); } } }); mBackButton = (ImageView) findViewById(R.id.top_view_back); mBackButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); mShared = getSharedPreferences(MemberAppConst.USERINFO, 0); nShopid = mShared.getString("shopid", "0"); mDataModel = new MemberListModel(this); mDataModel.addResponseListener(this); mServiceType = new SERVICE_TYPE(); mTitleTextView.setText(""); mDataModel.fetPreService(nShopid, ENUM_SEARCH_ORDER.location_asc); mPublishButton = (TextView) findViewById(R.id.c0_publish_button1); mPublishButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent_profile = new Intent(C0_ServiceListActivity.this, C1_PublishOrderActivity.class); startActivity(intent_profile); C0_ServiceListActivity.this.overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out); } }); // initFilter(); EventBus.getDefault().register(this); LocationManager.getInstance().refreshLocation(); }
From source file:com.arthackday.killerapp.GCMIntentService.java
@Override protected void onMessage(Context ctxt, Intent message) { Log.i("REMOVE BEFORE COMMIT", "blahhhhhhh GCMessage"); Bundle extras = message.getExtras(); /*// ww w. j a va2 s. c o m * TO DO! CHANGE WHAT THE MESSAGES DO!! */ for (String key : extras.keySet()) { Log.i(getClass().getSimpleName(), String.format("onMessage: %s=%s", key, extras.getString(key))); if (key.equals(KillerConstants.EXTRA_KEY_AUDIO)) { Log.i("REMOVE BEFORE COMMIT", "blahhhhhhh pushAudio"); Intent i = new Intent(); Log.i("REMOVE BEFORE COMMIT", extras.getString(key)); Bundle bundle = new Bundle(); //Add your data to bundle bundle.putString(KillerConstants.EXTRA_KEY_AUDIO, extras.getString(key)); //Add the bundle to the intent i.putExtras(bundle); i.setClassName("com.arthackday.killerapp", "com.arthackday.killerapp.PushAudio"); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(i); } if (key.equals(KillerConstants.EXTRA_KEY_PUSHCALL)) { Log.i("REMOVE BEFORE COMMIT", "blahhhhhhh callnumber"); String number = extras.getString(KillerConstants.EXTRA_KEY_PUSHCALL); String uri = "tel:" + number.trim(); Intent intent = new Intent(Intent.ACTION_CALL); intent.setData(Uri.parse(uri)); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } } }
From source file:com.wglxy.example.dashL.SearchActivity.java
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // TODO get company ID/details Bundle args = new Bundle(); args.putParcelable(Constants.KEY_COMPANY_BUNDLE_ARGS, data.get(position)); Intent companyIntent = new Intent(SearchActivity.this, CompanyActivity.class); companyIntent.putExtras(args); startActivity(companyIntent);//from w w w . java 2 s . c o m }
From source file:com.cn21.speedtest.service.LogService.java
private void sendIntegrationBroadcast(boolean enable) { Intent intent = new Intent(Constants.ACTION_COMMAND); Bundle bundle = new Bundle(); bundle.putBoolean(Constants.EXTRA_ENABLED, enable); intent.putExtras(bundle); sendBroadcast(intent);/* w w w . j av a 2s .c o m*/ }
From source file:com.gaze.webpaser.StackWidgetService.java
public RemoteViews getViewAt(int position) { Log.i(LOG_TAG, "getViewAt " + position); // position will always range from 0 to getCount() - 1. // We construct a remote views item based on our widget item xml file, // and set the // text based on the position. RemoteViews rv = new RemoteViews(mContext.getPackageName(), R.layout.item_widget); rv.setTextViewText(R.id.textView_title, mlist.get(position).getTitle()); String time = Util.getFormatTime(mlist.get(position).getTime()); rv.setTextViewText(R.id.textView3_time, time); // Next, we set a fill-intent which will be used to fill-in the pending // intent template // which is set on the collection view in StackWidgetProvider. Bundle extras = new Bundle(); extras.putInt(StackWidgetProvider.EXTRA_ITEM, position); Intent fillInIntent = new Intent(); fillInIntent.putExtras(extras); rv.setOnClickFillInIntent(R.id.widget1, fillInIntent); // You can do heaving lifting in here, synchronously. For example, if // you need to // process an image, fetch something from the network, etc., it is ok to // do it here, // synchronously. A loading view will show up in lieu of the actual // contents in the // interim./*from w w w . j a va 2s .co m*/ // try { // System.out.println("Loading view " + position); // Thread.sleep(500); // } catch (InterruptedException e) { // e.printStackTrace(); // } Bitmap bitmap = getBitmap(GlobalData.baseUrl + mlist.get(position).getImagePath()); if (bitmap != null) rv.setImageViewBitmap(R.id.imageView1, bitmap); // Return the remote views object. return rv; }
From source file:com.QuarkLabs.BTCeClient.UpdateWidgetsTask.java
@Override protected void onPostExecute(JSONObject jsonObject) { if (jsonObject != null) { try {/* w w w .j a v a2 s .c om*/ Context context = mContext.get(); if (context == null) { return; } AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); for (int x : mMap.keySet()) { RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.appwidget_layout); double price = jsonObject.getJSONObject(mMap.get(x).replace("/", "_").toLowerCase(Locale.US)) .getDouble("last"); String priceString; if (price > 1) { priceString = (new DecimalFormat("#.##")).format(price); } else { priceString = String.valueOf(price); } views.setTextViewText(R.id.widgetCurrencyValue, priceString); views.setTextViewText(R.id.widgetPair, mMap.get(x)); String color = jsonObject.getJSONObject(mMap.get(x).replace("/", "_").toLowerCase(Locale.US)) .getString("color"); int colorValue = color.equals("green") ? Color.GREEN : Color.RED; views.setTextColor(R.id.widgetCurrencyValue, colorValue); Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE); Bundle bundle = new Bundle(); bundle.putIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS, appWidgetManager.getAppWidgetIds(new ComponentName(context, WidgetProvider.class))); intent.putExtras(bundle); PendingIntent pi = PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); views.setOnClickPendingIntent(R.id.widgetContainer, pi); SimpleDateFormat df = new SimpleDateFormat("EEE HH:mm", Locale.US); Calendar calendar = Calendar.getInstance(); views.setTextViewText(R.id.widgetDate, df.format(calendar.getTime())); appWidgetManager.updateAppWidget(x, views); } } catch (JSONException e) { e.printStackTrace(); } } }
From source file:com.equalsd.recon.UserActivity.java
protected void querySubmit() { AsyncHttpClient client = new AsyncHttpClient(); JSONObject jsonParams = new JSONObject(); final String[] status = new String[1]; try {// w w w. jav a 2s .co m jsonParams.put("username", login_name.getText().toString()); jsonParams.put("password", password.getText().toString()); jsonParams.put("email", email.getText().toString()); jsonParams.put("contact_name", user_name.getText().toString()); jsonParams.put("contact_phone", phone.getText().toString()); jsonParams.put("company_address", company_address.getText().toString()); jsonParams.put("company_name", company_name.getText().toString()); jsonParams.put("question", question.getText().toString()); jsonParams.put("answer", answer.getText().toString()); jsonParams.put("check", check.toString()); jsonParams.put("casp", casp.getText().toString()); } catch (JSONException e) { e.printStackTrace(); } StringEntity entity = null; try { entity = new StringEntity(jsonParams.toString(), null); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } client.post(getApplicationContext(), QUERY_URL, entity, "application/json", new JsonHttpResponseHandler() { @Override public void onStart() { // called before request is started } @Override public void onSuccess(int statusCode, Header[] headers, JSONObject jsonObject) { // called when response HTTP status is "200 OK" try { status[0] = jsonObject.get("status").toString(); Log.d("recon", status[0]); if (status[0].equals("login")) { login.allDelete(); //credit[0] = jsonObject.get("credit").toString(); //Log.d("recon", "credit " + credit[0]); ArrayList<AbstractMap.SimpleEntry<String, String>> pairs = new ArrayList<AbstractMap.SimpleEntry<String, String>>(); pairs.add(new AbstractMap.SimpleEntry("username", login_name.getText().toString())); pairs.add(new AbstractMap.SimpleEntry("password", password.getText().toString())); pairs.add(new AbstractMap.SimpleEntry("site", "")); pairs.add(new AbstractMap.SimpleEntry("type", "")); //pairs.add(new AbstractMap.SimpleEntry("credit", credit[0])); login.updateContact("login", 1, pairs); Bundle dataBundle = new Bundle(); dataBundle.putString("username", login_name.getText().toString()); dataBundle.putString("password", password.getText().toString()); dataBundle.putString("state", "default"); dataBundle.putString("actionable", "site"); dataBundle.putString("tracker", ""); dataBundle.putString("trackerType", ""); dataBundle.putStringArrayList("category", category); //dataBundle.putString("credit", credit[0]); Intent intent = new Intent(getApplicationContext(), com.equalsd.recon.List.class); intent.putExtras(dataBundle); startActivity(intent); } else if (status[0].equals("ok")) { Toast.makeText(getApplicationContext(), "Working...", Toast.LENGTH_LONG).show(); new RequestTask().execute("http://ada-veracity.com/signup-wrapContent.php?content=wrap"); clickWrapTitle = "License Agreement"; //alertDialogClick(); } else { Toast.makeText(getApplicationContext(), status[0], Toast.LENGTH_LONG).show(); } } catch (JSONException e) { Log.d("recon", String.valueOf(e)); } } @Override public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) { // called when response HTTP status is "4XX" (eg. 401, 403, 404) Log.d("recon", "error " + throwable); Toast.makeText(getApplicationContext(), "Error: " + statusCode + " Verify your Internet Connection is stable or working.", Toast.LENGTH_LONG).show(); } @Override public void onRetry(int retryNo) { // called when request is retried } }); }
From source file:ca.ualberta.cs.shoven_habittracker.MainActivity.java
@Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { Intent intent = new Intent(); intent.setClass(this, HabitHomepageActivity.class); Bundle bundle = new Bundle(); bundle.putInt("position", position); bundle.putString("activity", "MainActivity"); intent.putExtras(bundle); startActivity(intent);//from ww w . j ava2s .c o m }
From source file:br.ufsc.das.gtscted.shibbauth.ShibAuthenticationActivity.java
/** Called when the activity is first created. */ @Override/*from w w w . ja va 2s .c o 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.wikilab.android.friendica01.FileUploadService.java
private void showFailMsg(Context ctx, String txt) { NotificationManager mNotificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); Log.e("Andfrnd/UploadFile", "Upload FAILED: " + txt); //Instantiate the Notification: CharSequence tickerText = "Upload failed, please retry!"; Notification notification = new Notification(R.drawable.arrow_up, tickerText, System.currentTimeMillis()); notification.flags |= Notification.FLAG_AUTO_CANCEL; //Define the Notification's expanded message and Intent: Context context = getApplicationContext(); CharSequence contentTitle = "Upload failed, click to retry!"; CharSequence contentText = txt; Intent notificationIntent = new Intent(this, FriendicaImgUploadActivity.class); Bundle b = new Bundle(); b.putParcelable(Intent.EXTRA_STREAM, fileToUpload); b.putString(Intent.EXTRA_SUBJECT, subject); b.putString(EXTRA_DESCTEXT, descText); notificationIntent.putExtras(b); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent); //Pass the Notification to the NotificationManager: mNotificationManager.notify(UPLOAD_FAILED_ID, notification); //Toast.makeText(ctx, "Upload failed, please retry:\n" + txt, Toast.LENGTH_LONG).show(); }