List of usage examples for android.widget TextView getText
@ViewDebug.CapturedViewProperty
public CharSequence getText()
From source file:com.ymt.demo1.plates.exportConsult.ExportConsultMainActivity.java
protected void initView() { TextView moreExpert = (TextView) findViewById(R.id.more_export); moreExpert.setOnClickListener(this); TextView dutyTime = (TextView) findViewById(R.id.nearly_export); String str = dutyTime.getText().toString(); dutyTime.setText(str + "(" + getDay() + ")"); initTodTomExport();//from w w w .j a v a 2s. com initNearlyHotConsult(); initOnDutyExpertView(); }
From source file:com.ess.tudarmstadt.de.sleepsense.mgraph.SleepEstimGPlotFragment.java
private void dateBackAndForth(boolean back) { TextView atDate = (TextView) rootView.findViewById(R.id.at_date); String newDate = atDate.getText().toString(); if (back) {/*from w w w . j a va2 s . c o m*/ newDate = getDate(-1, atDate.getText().toString()); } else { newDate = getDate(1, atDate.getText().toString()); } redrawCharts(newDate); }
From source file:com.xengar.android.booksearch.ui.BookDetailActivity.java
private void setShareIntent() { ImageView ivImage = (ImageView) findViewById(R.id.ivBookCover); final TextView tvTitle = (TextView) findViewById(R.id.tvTitle); // Get access to the URI for the bitmap Uri bmpUri = getLocalBitmapUri(ivImage); // Construct a ShareIntent with link to image Intent shareIntent = new Intent(); // Construct a ShareIntent with link to image shareIntent.setAction(Intent.ACTION_SEND); shareIntent.setType("*/*"); shareIntent.putExtra(Intent.EXTRA_TEXT, (String) tvTitle.getText()); shareIntent.putExtra(Intent.EXTRA_STREAM, bmpUri); // Launch share menu startActivity(Intent.createChooser(shareIntent, "Share Image")); }
From source file:com.agateau.equiv.ui.MealItemDetailActivity.java
private void updateQuantityEdits(TextView from, TextView to, float ratio) { if (mUpdating) { return;//from w w w. j a v a 2 s .c o m } mUpdating = true; try { float quantity; try { quantity = Float.valueOf(from.getText().toString()); } catch (NumberFormatException e) { to.setText(""); return; } String txt = FormatUtils.naturalRound(Locale.ENGLISH, quantity * ratio); to.setText(txt); } finally { updateMenuItems(); mUpdating = false; } }
From source file:com.example.android.bluetoothchat.BluetoothFragment.java
/** * Set up the UI and background operations for chat. *//*from ww w . j ava 2 s . c o m*/ private void setupChat() { Log.d(TAG, "setupChat()"); // Initialize the array adapter for the conversation thread mConversationArrayAdapter = new ArrayAdapter<String>(getActivity(), R.layout.message); mConversationView.setAdapter(mConversationArrayAdapter); // Initialize the compose field with a listener for the return key mOutEditText.setOnEditorActionListener(mWriteListener); // Initialize the send button with a listener that for click events mSendButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Send a message using content of the edit text widget View view = getView(); if (null != view) { TextView textView = (TextView) view.findViewById(R.id.edit_text_out); String message = textView.getText().toString(); sendMessage(message); } } }); // Initialize the BluetoothChatService to perform bluetooth connections mChatService = new BluetoothService(getActivity(), mHandler); // Initialize the buffer for outgoing messages mOutStringBuffer = new StringBuffer(""); }
From source file:com.gsbabil.antitaintdroid.UtilityFunctions.java
public int captureBitmapCache(String in) { TextView tv = (TextView) MyApp.context.findViewById(R.id.ocrTextview); String tvText = tv.getText().toString(); float tvTextSize = tv.getTextSize(); int tvColor = tv.getCurrentTextColor(); Bitmap bitmap = null;/*from w w w .j a v a 2 s . co m*/ tv.setTextSize(36); tv.setTextColor(Color.CYAN); tv.setTypeface(Typeface.SANS_SERIF); tv.setText(in); while (bitmap == null) { // http://stackoverflow.com/questions/2339429/android-view-getdrawingcache-returns-null-only-null tv.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); tv.layout(0, 0, tv.getMeasuredWidth(), tv.getMeasuredHeight()); tv.setDrawingCacheEnabled(true); tv.buildDrawingCache(true); bitmap = Bitmap.createBitmap(tv.getDrawingCache()); tv.destroyDrawingCache(); tv.setDrawingCacheEnabled(false); } FileOutputStream fos = null; int res = -1; try { fos = new FileOutputStream(currentDirectory() + "/files/" + MyApp.SCREENSHOT_FILENAME); if (fos != null) { bitmap.compress(Bitmap.CompressFormat.JPEG, 90, fos); fos.close(); res = 0; } } catch (Throwable e) { Log.i(MyApp.TAG, e.getMessage().toString()); res = -1; } tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, tvTextSize); tv.setTypeface(Typeface.MONOSPACE); tv.setText(tvText); tv.setTextColor(tvColor); return res; }
From source file:com.dattasmoon.pebble.plugin.NotificationService.java
private String dumpViewGroup(int depth, ViewGroup vg, String existing_text) { String text = ""; Log.d(Constants.LOG_TAG, "root view, depth:" + depth + "; view: " + vg); for (int i = 0; i < vg.getChildCount(); ++i) { View v = vg.getChildAt(i); if (Constants.IS_LOGGABLE) { Log.d(Constants.LOG_TAG, "depth: " + depth + "; " + v.getClass().toString() + "; view: " + v); }//from www . ja v a2s . co m if (v.getId() == android.R.id.title || v instanceof android.widget.Button || v.getClass().toString().contains("android.widget.DateTimeView")) { if (Constants.IS_LOGGABLE) { Log.d(Constants.LOG_TAG, "I am going to skip this, but if I didn't, the text would be: " + ((TextView) v).getText().toString()); } if (existing_text.isEmpty() && v.getId() == android.R.id.title) { if (Constants.IS_LOGGABLE) { Log.d(Constants.LOG_TAG, "I was going to skip this, but the existing text was empty, and I need something."); } } else { continue; } } if (v instanceof TextView) { TextView tv = (TextView) v; if (tv.getText().toString() == "..." || tv.getText().toString() == "" || isInteger(tv.getText().toString()) || tv.getText().toString().trim().equalsIgnoreCase(existing_text)) { if (Constants.IS_LOGGABLE) { Log.d(Constants.LOG_TAG, "Text is: " + tv.getText().toString() + " but I am going to skip this"); } continue; } text += tv.getText().toString() + "\n"; if (Constants.IS_LOGGABLE) { Log.i(Constants.LOG_TAG, tv.getText().toString()); } } if (v instanceof ViewGroup) { text += dumpViewGroup(depth + 1, (ViewGroup) v, existing_text); } } return text; }
From source file:com.customprogrammingsolutions.MediaStreamer.MainActivity.java
private void setUpTabs() { Resources res = getResources(); tabHost = (TabHost) findViewById(R.id.tabhost); tabHost.setup();//from w w w .ja v a 2 s.co m recentsAdapter = new SimpleCursorAdapter(this, R.layout.recent_item_layout, null, new String[] { RecentsDBHelper.KEY_URL }, new int[] { R.id.recent_url }, 0); favoritesAdapter = new SimpleCursorAdapter(this, R.layout.favorite_item_layout, null, new String[] { FavoritesDBHelper.KEY_URL, FavoritesDBHelper.KEY_NAME, FavoritesDBHelper.KEY_ROWID }, new int[] { R.id.favorite_url, R.id.favorite_name, R.id.favorite_row_id }, 0); recents = (ListView) findViewById(R.id.recents_tab); recents.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); favorites = (ListView) findViewById(R.id.favorites_tab); favorites.setLayoutParams( new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); recents.setAdapter(recentsAdapter); favorites.setAdapter(favoritesAdapter); recents.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { TextView tv = (TextView) view.findViewById(R.id.recent_url); String url = tv.getText().toString(); urlBar.setText(url); if (isPlayDrawable) { mediaStateButton.performClick(); } else { mediaStateButton.performClick(); mediaStateButton.performClick(); } } }); favorites.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { TextView tv = (TextView) view.findViewById(R.id.favorite_url); String url = tv.getText().toString(); urlBar.setText(url); if (isPlayDrawable) { mediaStateButton.performClick(); } else { mediaStateButton.performClick(); mediaStateButton.performClick(); } } }); getSupportLoaderManager().initLoader(0, null, this); getSupportLoaderManager().initLoader(1, null, this); TabHost.TabSpec spec; // Resusable TabSpec for each tab spec = tabHost.newTabSpec("recents").setIndicator("Recents", res.getDrawable(R.drawable.ic_action_search)) .setContent(R.id.recents_tab); tabHost.addTab(spec); spec = tabHost.newTabSpec("favorites") .setIndicator("Favorites", res.getDrawable(R.drawable.ic_action_search)) .setContent(R.id.favorites_tab); tabHost.addTab(spec); }
From source file:com.closedevice.fastapp.view.tab.SlidingTabLayout.java
public void setMessageTipVisible(int visible) { int size = mTabStrip.getChildCount(); for (int i = 0; i < size; i++) { TextView mTvMessageCount = (TextView) mTabStrip.getChildAt(i).findViewById(R.id.tv_unread_count); if (mTvMessageCount == null) continue; if (visible == View.VISIBLE) {// try to show num String count = mTvMessageCount.getText().toString(); if (!TextUtils.isEmpty(count)) { int num = Integer.parseInt(count); if (num > 0) { mTvMessageCount.setVisibility(View.VISIBLE); continue; }//from w w w.j a v a 2 s.com } mTvMessageCount.setVisibility(View.INVISIBLE); } else { mTvMessageCount.setVisibility(visible); } } }
From source file:fr.cph.chicago.activity.BusActivity.java
/** * Draw arrivals in current layout// w w w. ja v a 2 s.c o m */ public final void drawArrivals() { if (mBusArrivals != null) { Map<String, TextView> mapRes = new HashMap<String, TextView>(); if (this.mBusArrivals.size() != 0) { for (BusArrival arrival : this.mBusArrivals) { if (arrival.getRouteDirection().equals(mBound)) { String destination = arrival.getBusDestination(); if (mapRes.containsKey(destination)) { TextView arrivalView = mapRes.get(destination); if (arrival.getIsDly()) { arrivalView.setText(arrivalView.getText() + " Delay"); } else { arrivalView.setText(arrivalView.getText() + " " + arrival.getTimeLeft()); } } else { TextView arrivalView = new TextView(ChicagoTracker.getAppContext()); if (arrival.getIsDly()) { arrivalView.setText(arrival.getBusDestination() + ": Delay"); } else { arrivalView.setText(arrival.getBusDestination() + ": " + arrival.getTimeLeft()); } arrivalView.setTextColor( ChicagoTracker.getAppContext().getResources().getColor(R.color.grey)); mapRes.put(destination, arrivalView); } } } } else { TextView arrivalView = new TextView(ChicagoTracker.getAppContext()); arrivalView.setTextColor(ChicagoTracker.getAppContext().getResources().getColor(R.color.grey)); arrivalView.setText("No service scheduled"); mapRes.put("", arrivalView); } mStopsView.removeAllViews(); for (Entry<String, TextView> entry : mapRes.entrySet()) { mStopsView.addView(entry.getValue()); } } }