List of usage examples for android.widget TextView setText
@android.view.RemotableViewMethod public final void setText(@StringRes int resid)
From source file:com.shearosario.tothepathandback.DisplayDirectionsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_display_directions); getActionBar().setDisplayHomeAsUpEnabled(true); Intent intent = getIntent();//from ww w. j a v a 2s. co m /*if(intent.hasExtra("origin")) { double[] temp = intent.getDoubleArrayExtra("origin"); origin = new LatLng (temp[0], temp[1]); } if (intent.hasExtra("destination")) { double[] temp = intent.getDoubleArrayExtra("destination"); destination = new LatLng (temp[0], temp[1]); }*/ String linkCollection = null; String nodeCollection = null; String points = null; if (intent.hasExtra("GuidanceLinkCollection")) linkCollection = intent.getStringExtra("GuidanceLinkCollection"); if (intent.hasExtra("GuidanceNodeCollection")) nodeCollection = intent.getStringExtra("GuidanceNodeCollection"); if (intent.hasExtra("shapePoints")) points = intent.getStringExtra("shapePoints"); gMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.directionsView)).getMap(); gMap.setMyLocationEnabled(false); gMap.setBuildingsEnabled(false); gMap.getUiSettings().setZoomControlsEnabled(false); TextView textView = (TextView) findViewById(R.id.osm_guidance); textView.setText(Html.fromHtml("Data provided by OpenStreetMap contributors " + "<a href=\"http://www.openstreetmap.org/copyright\">License</a>")); textView.setMovementMethod(LinkMovementMethod.getInstance()); textView = (TextView) findViewById(R.id.guidance_text); textView.setText( Html.fromHtml("Guidance Courtesy of " + "<a href=\"http://www.mapquest.com\">MapQuest</a>")); textView.setMovementMethod(LinkMovementMethod.getInstance()); PolylineOptions rectOptions = new PolylineOptions(); markers = new ArrayList<Marker>(); try { JSONArray jGuidanceLinkCollection = new JSONArray(linkCollection); JSONArray jGuidanceNodeCollection = new JSONArray(nodeCollection); JSONArray jShapePoints = new JSONArray(points); int lastIndex = 0; for (int i = 0; i < jGuidanceNodeCollection.length(); i++) { JSONObject nodeObject = jGuidanceNodeCollection.getJSONObject(i); JSONArray linkIds = nodeObject.getJSONArray("linkIds"); int linkIndex = 0; if (linkIds.length() != 0) linkIndex = linkIds.getInt(0); else continue; JSONObject linkObject = jGuidanceLinkCollection.getJSONObject(linkIndex); int shapeIndex = linkObject.getInt("shapeIndex"); // The index of a specific shape point is i/2, so multiply by 2 to get the beginning index in shapePoints // evens are lat and odds are lng double lat = jShapePoints.getDouble((shapeIndex * 2)); double lng = jShapePoints.getDouble((shapeIndex * 2) + 1); lastIndex = ((shapeIndex * 2) + 1); if (i == 0) { Marker temp = gMap .addMarker(new MarkerOptions().position(new LatLng(lat, lng)).title("Origin")); markers.add(temp); } else if (nodeObject.isNull("infoCollection") == false) { Marker temp = gMap.addMarker(new MarkerOptions().position(new LatLng(lat, lng)) .title(nodeObject.getJSONArray("infoCollection").getString(0))); markers.add(temp); } } for (int i = 0; i < lastIndex; i++) { double lat = jShapePoints.getDouble(i); i++; double lng = jShapePoints.getDouble(i); rectOptions.add(new LatLng(lat, lng)); } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } gMap.addPolyline(rectOptions); markersIndex = 0; gMap.moveCamera(CameraUpdateFactory.newLatLngZoom(markers.get(markersIndex).getPosition(), 17)); markers.get(markersIndex).showInfoWindow(); gMap.setOnMarkerClickListener(new OnMarkerClickListener() { @Override public boolean onMarkerClick(Marker arg0) { if (arg0 != null) { for (int i = 0; i < markers.size(); i++) { if (markers.get(i).equals(arg0)) { markersIndex = i; break; } } if (markersIndex == 0) { findViewById(R.id.button_nextStep).setEnabled(true); findViewById(R.id.button_previousStep).setEnabled(false); } else if (markersIndex == (markers.size() - 1)) { findViewById(R.id.button_nextStep).setEnabled(false); findViewById(R.id.button_previousStep).setEnabled(true); } else { findViewById(R.id.button_nextStep).setEnabled(true); findViewById(R.id.button_previousStep).setEnabled(true); } gMap.moveCamera(CameraUpdateFactory.newLatLngZoom(arg0.getPosition(), 17)); arg0.showInfoWindow(); return true; } return false; } }); }
From source file:com.gammalabs.wifianalyzer.wifi.AccessPointDetail.java
private void setViewVendorLong(@NonNull View view, @NonNull WiFiAdditional wiFiAdditional) { TextView textVendor = ((TextView) view.findViewById(R.id.vendorLong)); String vendor = wiFiAdditional.getVendorName(); if (StringUtils.isBlank(vendor)) { textVendor.setVisibility(View.GONE); } else {//from w ww .ja v a 2 s. c o m textVendor.setVisibility(View.VISIBLE); textVendor.setText(vendor.substring(0, Math.min(VENDOR_LONG_MAX, vendor.length()))); } }
From source file:com.example.premiereappandroid.BloaActivity.java
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { String name = null;/*from w w w .j ava2 s.c o m*/ if (cursor.moveToFirst()) { name = cursor.getString(App.IDX_USER_STATUS_USER_NAME); } TextView pseudo = (TextView) findViewById(R.id.editPseudo); pseudo.setText(name); }
From source file:com.example.savedollars.ProductTotalPriceDisplay.java
@Override protected void onCreate(Bundle savedInstanceState) { StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectDiskReads().detectDiskWrites() .detectNetwork().penaltyLog().build()); System.out.println("Inside Product price display class"); String barcodeNumber = (getIntent().getStringExtra("barcodeNumber")); /* If barcode number is scanned from main screen, Google API server * call is made to retrieve the product information. If we are * returning from existing view ( shipping, stocks) no server call * is made. We display the product information already stored in * JSONData/*from w ww .ja v a 2 s . c o m*/ */ System.out.println("Barcode number is " + barcodeNumber); if (barcodeNumber != null) { getProductDetails(barcodeNumber); } else { JSONData = (getIntent().getStringExtra("JsonData")); System.out.println("Inside product price , JSON Data is " + JSONData); parseJsonData(JSONData); } super.onCreate(savedInstanceState); System.out.println("Invoking pdttotalpriceview"); setContentView(R.layout.pdttotalpriceview); //Setting Product Name TextView productName = (TextView) findViewById(R.id.pdtNameTextView); productName.setText(pdtName); Iterator objMapIterator = sortedMap.entrySet().iterator(); int i = 0; System.out.println("3 Updating INFO totalCount:" + totalCount); PDT_INFO = new String[totalCount][2]; while (objMapIterator.hasNext()) { Map.Entry keyValuePairs = (Map.Entry) objMapIterator.next(); System.out.println("i = " + i); System.out.println("Save DDollars Merchant Name" + String.valueOf(keyValuePairs.getKey())); System.out.println("Save DDollars Merchant Price :" + String.valueOf(keyValuePairs.getValue())); PDT_INFO[i][0] = String.valueOf(keyValuePairs.getKey()); PDT_INFO[i][1] = "$" + String.valueOf(keyValuePairs.getValue()); System.out.println( "While Array Merchant Name:" + PDT_INFO[i][0] + "Array Merchant Price:" + PDT_INFO[i][1]); i++; } System.out.println("Total Updated Rows: " + i + " < totalCount:" + totalCount); ListViewAdapter listv = new ListViewAdapter(this, PDT_INFO); setListAdapter(listv); System.out.println("INFO Updated leter"); }
From source file:zjut.soft.finalwork.fragment.LeftFragment.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.left, null); iv1 = (ImageView) view.findViewById(R.id.left_iv1); iv2 = (ImageView) view.findViewById(R.id.left_iv2); iv3 = (ImageView) view.findViewById(R.id.left_iv3); iv4 = (ImageView) view.findViewById(R.id.left_iv4); iv5 = (ImageView) view.findViewById(R.id.left_iv5); headTV = (ImageView) view.findViewById(R.id.sliding_activity_head_view); headTV.setOnClickListener(new View.OnClickListener() { @Override//www . j a v a2 s . c o m public void onClick(View v) { Intent i = new Intent(getActivity(), BasicInfoUI.class); i.putExtra("myportrait", portraitBitmap); getActivity().startActivity(i); getActivity().overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); } }); TextView tv = (TextView) view.findViewById(R.id.sliding_activity_name_tv); YCApplication app = (YCApplication) this.getActivity().getApplication(); tv.setText(app.get("name").toString()); // // portrait = (ImageView) view.findViewById(R.id.sliding_activity_head_view); final String url = ((YCApplication) getActivity().getApplication()).get("selectedIp") + Constant.portraitContext; new Thread(new Runnable() { @Override public void run() { HttpGet get = new HttpGet(url); try { DefaultHttpClient client = ((YCApplication) getActivity().getApplicationContext()).getClient(); synchronized (client) { HttpResponse response = client.execute(get); HttpEntity entity = response.getEntity(); InputStream is = entity.getContent(); portraitBitmap = BitmapFactory.decodeStream(is); // is.close(); Message msg = mHandler.obtainMessage(); msg.obj = portraitBitmap; mHandler.sendMessage(msg); } } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }).start(); TextView username = (TextView) view.findViewById(R.id.sliding_activity_username_textview); username.setText(app.get("username").toString()); // userConfTV = (TextView) view.findViewById(R.id.sliding_activity_user_manage); // payQueryTV = (TextView) view.findViewById(R.id.sliding_activity_pay_query); // querySystemTV = (TextView) view.findViewById(R.id.sliding_activity_query_system); // aboutUsTV = (TextView) view.findViewById(R.id.sliding_activity_about_us); // unRegisterTV = (TextView) view.findViewById(R.id.sliding_activity_unregister_user); // classNameTV = (TextView) view.findViewById(R.id.sliding_activity_class_tv); // registTV = (TextView) view.findViewById(R.id.sliding_activity_regist_system); // pickCourseTV = (TextView) view.findViewById(R.id.sliding_activity_pick_course_system); // RatingTV = (TextView) view.findViewById(R.id.sliding_activity_student_rating); // return view; }
From source file:app.hanks.com.conquer.activity.LoginActivity.java
@Override protected void initTitleBar(ViewGroup rl_title, TextView tv_title, ImageButton ib_back, ImageButton ib_right, View shadow) {//from w ww . j a v a 2 s . c om tv_title.setText(getString(R.string.login)); }
From source file:com.cleanwiz.applock.ui.activity.SplashActivity.java
public void showUpdateDialog(String intro) { final AlertDialog updateDialogDlg = new AlertDialog.Builder(this).create(); updateDialogDlg.show();/*from w w w . jav a 2s .c o m*/ Window win = updateDialogDlg.getWindow(); win.setContentView(R.layout.dialog_update); TextView tvMsg = (TextView) win.findViewById(R.id.tvMsg); tvMsg.setText(intro); Button btOk = (Button) win.findViewById(R.id.btOk); ImageView closeImageView = (ImageView) win.findViewById(R.id.updateclose); closeImageView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub updateDialogDlg.dismiss(); SplashHandler handler = new SplashHandler(); Message msg = new Message(); msg.what = CHECKVERSION_CANCEL; handler.sendMessage(msg); } }); btOk.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { SplashHandler handler = new SplashHandler(); Message msg = new Message(); msg.what = CHECKVERSION_DOWN; handler.sendMessage(msg); } }); updateDialogDlg.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { // TODO Auto-generated method stub List<UpdateVersionManafer> updateVersionManafers = updateVersionManagerService.getVersionManafers(); for (UpdateVersionManafer updateVersionManafer : updateVersionManafers) { updateVersionManafer.setLasttipdate(new Date().getTime()); updateVersionManagerService.modifyTipsDate(updateVersionManafer); break; } SplashHandler handler = new SplashHandler(); Message msg = new Message(); msg.what = CHECKVERSION_CANCEL; handler.sendMessage(msg); } }); }
From source file:com.apptentive.android.sdk.module.engagement.interaction.view.TextModalInteractionView.java
@Override public void doOnCreate(final Activity activity, Bundle onSavedInstanceState) { activity.setContentView(R.layout.apptentive_textmodal_interaction_center); TextView title = (TextView) activity.findViewById(R.id.title); if (interaction.getTitle() == null) { title.setVisibility(View.GONE); } else {//from www . jav a 2 s . c om title.setText(interaction.getTitle()); } TextView body = (TextView) activity.findViewById(R.id.body); if (interaction.getBody() == null) { body.setVisibility(View.GONE); } else { body.setText(interaction.getBody()); } LinearLayout bottomArea = (LinearLayout) activity.findViewById(R.id.bottom_area); List<Action> actions = interaction.getActions().getAsList(); boolean vertical; if (actions != null && !actions.isEmpty()) { int totalChars = 0; for (Action button : actions) { totalChars += button.getLabel().length(); } if (actions.size() == 1) { vertical = false; } else if (actions.size() == 2) { vertical = totalChars > MAX_TEXT_LENGTH_FOR_TWO_BUTTONS; } else if (actions.size() == 3) { vertical = totalChars > MAX_TEXT_LENGTH_FOR_THREE_BUTTONS; } else if (actions.size() == 4) { vertical = totalChars > MAX_TEXT_LENGTH_FOR_FOUR_BUTTONS; } else { vertical = true; } if (vertical) { bottomArea.setOrientation(LinearLayout.VERTICAL); } else { bottomArea.setOrientation(LinearLayout.HORIZONTAL); } for (int i = 0; i < actions.size(); i++) { final Action buttonAction = actions.get(i); final int position = i; ApptentiveDialogButton button = new ApptentiveDialogButton(activity); button.setText(buttonAction.getLabel()); switch (buttonAction.getType()) { case dismiss: button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { JSONObject data = new JSONObject(); try { data.put(TextModalInteraction.EVENT_KEY_ACTION_ID, buttonAction.getId()); data.put(Action.KEY_LABEL, buttonAction.getLabel()); data.put(TextModalInteraction.EVENT_KEY_ACTION_POSITION, position); } catch (JSONException e) { Log.e("Error creating Event data object.", e); } EngagementModule.engageInternal(activity, interaction, TextModalInteraction.EVENT_NAME_DISMISS, data.toString()); activity.finish(); } }); break; case interaction: button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { LaunchInteractionAction launchInteractionButton = (LaunchInteractionAction) buttonAction; List<Invocation> invocations = launchInteractionButton.getInvocations(); String interactionIdToLaunch = null; for (Invocation invocation : invocations) { if (invocation.isCriteriaMet(activity)) { interactionIdToLaunch = invocation.getInteractionId(); break; } } Interaction invokedInteraction = null; if (interactionIdToLaunch != null) { Interactions interactions = InteractionManager.getInteractions(activity); if (interactions != null) { invokedInteraction = interactions.getInteraction(interactionIdToLaunch); } } JSONObject data = new JSONObject(); try { data.put(TextModalInteraction.EVENT_KEY_ACTION_ID, buttonAction.getId()); data.put(Action.KEY_LABEL, buttonAction.getLabel()); data.put(TextModalInteraction.EVENT_KEY_ACTION_POSITION, position); data.put(TextModalInteraction.EVENT_KEY_INVOKED_INTERACTION_ID, invokedInteraction == null ? JSONObject.NULL : invokedInteraction.getId()); } catch (JSONException e) { Log.e("Error creating Event data object.", e); } EngagementModule.engageInternal(activity, interaction, TextModalInteraction.EVENT_NAME_INTERACTION, data.toString()); if (invokedInteraction != null) { EngagementModule.launchInteraction(activity, invokedInteraction); } activity.finish(); } }); break; } bottomArea.addView(button); } } else { bottomArea.setVisibility(View.GONE); } }
From source file:com.example.healthplus.wifidirect.DeviceDetailFragment.java
public void sendFile() { String localIP = Utils.getLocalIPAddress(); // Trick to find the ip in the file /proc/net/arp String client_mac_fixed = new String(device.deviceAddress).replace("3a", "38"); Log.d(WiFiDirectActivity.TAG, "Client MAC fixed Richa: " + client_mac_fixed); String clientIP = Utils.getIPFromMac(client_mac_fixed); Log.d(WiFiDirectActivity.TAG, "Local IP Address Richa: " + localIP); Log.d(WiFiDirectActivity.TAG, "Client IP Address Richa: " + clientIP); // User has picked an image. Transfer it to group owner i.e peer using // FileTransferService. File root = android.os.Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); String path = root.getAbsolutePath() + "/healthplus/" + "request.json"; //Uri uri = new Uri.Builder().appendPath(path); //Log.d(WiFiDirectActivity.TAG, "URI richa: " + uri); TextView statusText = (TextView) mContentView.findViewById(R.id.status_text); statusText.setText("Sending: " + path); //Log.d(WiFiDirectActivity.TAG, "Intent----------- " + uri); Intent serviceIntent = new Intent(getActivity(), FileTransferService.class); Log.d(WiFiDirectActivity.TAG, "Reached here Richa before send"); serviceIntent.setAction(FileTransferService.ACTION_SEND_FILE); //Log.d(WiFiDirectActivity.TAG, "Reached here Richa after send"); //Log.d(WiFiDirectActivity.TAG, "Path : " + path); serviceIntent.putExtra(FileTransferService.EXTRAS_FILE_PATH, path); Log.d(WiFiDirectActivity.TAG, "Reached here Richa: put extra string to URI"); Log.d(WiFiDirectActivity.TAG, "Reached here Richa after send"); Log.d(WiFiDirectActivity.TAG, "Reached here Richa IP server =" + IP_SERVER); Log.d(WiFiDirectActivity.TAG, "Reached here Richa LOCAL IP =" + localIP); if (localIP.equals(IP_SERVER)) { Log.d(WiFiDirectActivity.TAG, "Reached here client IP1:" + clientIP); serviceIntent.putExtra(FileTransferService.EXTRAS_ADDRESS, clientIP); Log.d(WiFiDirectActivity.TAG, "Reached here client IP2:" + clientIP); } else {/* w w w . jav a 2s. co m*/ Log.d(WiFiDirectActivity.TAG, "Reached here IP server1:" + IP_SERVER); serviceIntent.putExtra(FileTransferService.EXTRAS_ADDRESS, IP_SERVER); Log.d(WiFiDirectActivity.TAG, "Reached here Extra address2:" + IP_SERVER); } serviceIntent.putExtra(FileTransferService.EXTRAS_PORT, PORT); Log.d(WiFiDirectActivity.TAG, "Reached here Richa service started"); getActivity().startService(serviceIntent); }
From source file:com.savedollars.ProductTotalPriceDisplay.java
@Override protected void onCreate(Bundle savedInstanceState) { StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectDiskReads().detectDiskWrites() .detectNetwork().penaltyLog().build()); String barcodeNumber = (getIntent().getStringExtra("barcodeNumber")); /*// www.j a v a 2s. c o m * If barcode number is scanned from main screen, Google API server call * is made to retrieve the product information. If we are returning from * existing view ( shipping, stocks) no server call is made. We display * the product information already stored in JSONData */ if (barcodeNumber != null) { getProductDetails(barcodeNumber); } else { JSONData = (getIntent().getStringExtra("JsonData")); parseJsonData(JSONData); } super.onCreate(savedInstanceState); if (totalCount == 0) { setContentView(R.layout.nopdtinfo); } else { setContentView(R.layout.pdttotalpriceview); // Setting Product Name TextView productName = (TextView) findViewById(R.id.pdtNameTextView); productName.setText(pdtName); Iterator objMapIterator = sortedMap.entrySet().iterator(); int rowIndex = 0; PDT_INFO = new String[totalCount][2]; while (objMapIterator.hasNext()) { Map.Entry keyValuePairs = (Map.Entry) objMapIterator.next(); PDT_INFO[rowIndex][0] = String.valueOf(keyValuePairs.getKey()); PDT_INFO[rowIndex][1] = "$" + String.valueOf(keyValuePairs.getValue()); rowIndex++; } ListViewAdapter listv = new ListViewAdapter(this, PDT_INFO); setListAdapter(listv); final ListView lv = getListView(); lv.setTextFilterEnabled(true); lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { lv.getItemAtPosition(position); String pdtKey = PDT_INFO[position][0]; String merchantLink = (String) merchantLinkMap.get(pdtKey); Uri uri = Uri.parse(merchantLink); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); } }); } }