List of usage examples for android.widget TextView getText
@ViewDebug.CapturedViewProperty
public CharSequence getText()
From source file:cn.ttyhuo.activity.InfoOwnerActivity.java
@Override protected void initView() { super.initView(); mEditDate = (TextView) findViewById(R.id.edit_date); mEditChexing = (TextView) findViewById(R.id.edit_chexing); mEditZaizhong = (EditText) findViewById(R.id.edit_zaizhong); mEditChechang = (EditText) findViewById(R.id.edit_chechang); mEditZuowei = (EditText) findViewById(R.id.edit_zuowei); mEditChepai = (EditText) findViewById(R.id.edit_chepaihao); mEditXinghao = (EditText) findViewById(R.id.edit_xinghao); mEditKuan = (EditText) findViewById(R.id.edit_kuan); mEditGao = (EditText) findViewById(R.id.edit_gao); tv_edit_tips = (TextView) findViewById(R.id.tv_edit_tips); // //w w w .j a v a 2s. c om mEditZaizhong.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { String numStr = v.getText().toString(); if (!StringNumberUtils.isPositiveDecimal(numStr) && !StringNumberUtils.isPositiveInteger(numStr)) { Toast.makeText(mContext, "1.0-100.0", Toast.LENGTH_SHORT).show(); } else { float num = Float.parseFloat(numStr); if (num > 10.0 || num < 1.0) { Toast.makeText(mContext, "1.0-100.0", Toast.LENGTH_SHORT).show(); } } return false; } }); progressBar = (ProgressBar) findViewById(R.id.progressBar1); if (progressBar != null) progressBar.setVisibility(View.VISIBLE); isDoingUpdate = true; if (!NetworkUtils.isNetworkAvailable(mContext)) { Toast.makeText(mContext, "??", Toast.LENGTH_LONG).show(); } new UrlThread(handler, UrlList.MAIN + "mvc/editTruckInfoJson".toString(), 1).start(); }
From source file:com.blueoxfords.peacecorpstinder.activities.MainActivity.java
public void getLegalInfo(View v) { String photoId = v.getTag() + ""; ImageRestClient.get().getInfoFromImageId(photoId, new Callback<ImageService.ImageInfoWrapper>() { @Override/*from www. j a v a2s. c o m*/ public void success(ImageService.ImageInfoWrapper imageInfoWrapper, Response response) { AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.activity); ScrollView wrapper = new ScrollView(MainActivity.activity); LinearLayout infoLayout = new LinearLayout(MainActivity.activity); infoLayout.setOrientation(LinearLayout.VERTICAL); infoLayout.setPadding(35, 35, 35, 35); TextView imageOwner = new TextView(MainActivity.activity); imageOwner.setText(Html.fromHtml("<b>Image By: </b>" + imageInfoWrapper.photo.owner.username)); if (imageInfoWrapper.photo.owner.realname.length() > 0) { imageOwner.setText(imageOwner.getText() + " (" + imageInfoWrapper.photo.owner.realname + ")"); } infoLayout.addView(imageOwner); if (getLicenseUrl(Integer.parseInt(imageInfoWrapper.photo.license)).length() > 0) { TextView licenseLink = new TextView(MainActivity.activity); licenseLink.setText(Html .fromHtml("<a href=\"" + getLicenseUrl(Integer.parseInt(imageInfoWrapper.photo.license)) + "\"><b>Licensing</b></a>")); licenseLink.setMovementMethod(LinkMovementMethod.getInstance()); infoLayout.addView(licenseLink); } if (imageInfoWrapper.photo.urls.url.size() > 0) { TextView imageLink = new TextView(MainActivity.activity); imageLink.setText(Html.fromHtml("<a href=\"" + imageInfoWrapper.photo.urls.url.get(0)._content + "\"><b>Image Link</b></a>")); imageLink.setMovementMethod(LinkMovementMethod.getInstance()); infoLayout.addView(imageLink); } if (imageInfoWrapper.photo.title._content.length() > 0) { TextView photoTitle = new TextView(MainActivity.activity); photoTitle .setText(Html.fromHtml("<b>Image Title: </b>" + imageInfoWrapper.photo.title._content)); infoLayout.addView(photoTitle); } if (imageInfoWrapper.photo.description._content.length() > 0) { TextView description = new TextView(MainActivity.activity); description.setText(Html .fromHtml("<b>Image Description: </b>" + imageInfoWrapper.photo.description._content)); infoLayout.addView(description); } TextView contact = new TextView(MainActivity.activity); contact.setText( Html.fromHtml("<br><i>To remove this photo, please email pcorpsconnect@gmail.com</i>")); infoLayout.addView(contact); wrapper.addView(infoLayout); builder.setTitle("Photo Information"); builder.setPositiveButton("Close", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }); builder.setView(wrapper); builder.create().show(); } @Override public void failure(RetrofitError error) { Log.i("testing", "could not retrieve legal/attribution info"); } }); }
From source file:com.csipsimple.service.SipNotifications.java
private boolean recurseSearchNotificationPrimaryText(ViewGroup gp) { final int count = gp.getChildCount(); for (int i = 0; i < count; ++i) { if (gp.getChildAt(i) instanceof TextView) { final TextView text = (TextView) gp.getChildAt(i); final String szText = text.getText().toString(); if (TO_SEARCH.equals(szText)) { notificationPrimaryTextColor = text.getTextColors().getDefaultColor(); return true; }/*from w w w . j a va2s . co m*/ } else if (gp.getChildAt(i) instanceof ViewGroup) { if (recurseSearchNotificationPrimaryText((ViewGroup) gp.getChildAt(i))) { return true; } } } return false; }
From source file:com.example.apptankcontroller.bluetoothchat.BluetoothChatFragment.java
/** * Set up the UI and background operations for chat. */// www . j av a 2 s . co 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); } } }); mButtonLF.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); mButtonLB.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); mButtonRF.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); mButtonRB.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); mButtonST.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { sendMessage("$C,0,0,*0"); } }); // Initialize the BluetoothChatService to perform bluetooth connections mChatService = new BluetoothChatService(getActivity(), mHandler); // Initialize the buffer for outgoing messages mOutStringBuffer = new StringBuffer(""); }
From source file:com.houseofslack.pullscoring.Scoring.java
private int getScore(int inputId) { TextView input = (TextView) findViewById(inputId); int value = 0; try {//from w ww .ja v a 2s .co m value = Integer.valueOf(input.getText().toString()); } catch (NumberFormatException ex) { // do nothing, we've already set to the default } return value; }
From source file:com.siso.app.adapter.MarketListAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder listItemView = null;//from ww w . j a v a 2 s . co m if (convertView == null) { convertView = listContainer.inflate(this.itemViewResource, null, false); listItemView = new ViewHolder(); listItemView.content = (TextView) convertView.findViewById(R.id.marketList_title); listItemView.priceTextView = (TextView) convertView.findViewById(R.id.marketList_price); listItemView.username = (TextView) convertView.findViewById(R.id.marketList_username); listItemView.imageView = (ImageView) convertView.findViewById(R.id.marketList_img); listItemView.linearLayout = (LinearLayout) convertView.findViewById(R.id.nearby); listItemView.likeButton = (LinearLayout) convertView.findViewById(R.id.item_goods_like); listItemView.likeCount = (TextView) convertView.findViewById(R.id.item_goods_like_text); listItemView.viewCount = (TextView) convertView.findViewById(R.id.item_goods_viewcount); listItemView.likeImageButton = (ImageButton) convertView.findViewById(R.id.item_goods_like_btn); if (type == 1) { listItemView.username.setVisibility(View.GONE); listItemView.linearLayout.setVisibility(View.VISIBLE); listItemView.schoolname = (TextView) convertView.findViewById(R.id.marketList_schoolname); listItemView.distance = (TextView) convertView.findViewById(R.id.marketList_distance); } convertView.setTag(listItemView); } else { listItemView = (ViewHolder) convertView.getTag(); } final GoodsEntity tmpGoodsEntity = listItems.get(position); listItemView.content.setText(tmpGoodsEntity.getGoodTitle()); listItemView.priceTextView.setText("" + tmpGoodsEntity.getGoodPrice()); listItemView.username.setText(tmpGoodsEntity.getUserName()); if (type == 1) { listItemView.schoolname.setText("?[" + tmpGoodsEntity.getSchoolName() + "]"); listItemView.distance.setText(tmpGoodsEntity.getDistance() + "Km"); } if (tmpGoodsEntity.isLike()) { listItemView.likeImageButton.setBackgroundResource(R.drawable.liked); } listItemView.likeCount.setText(tmpGoodsEntity.getLikeCount() + ""); listItemView.viewCount.setText(tmpGoodsEntity.getViewCount() + ""); listItemView.likeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (MyApplication.userInfo == null) { Toast.makeText(context, context.getResources().getString(R.string.has_no_login), Toast.LENGTH_SHORT).show(); return; } ImageButton imageButton = (ImageButton) view.findViewById(R.id.item_goods_like_btn); TextView likeCount = (TextView) view.findViewById(R.id.item_goods_like_text); if (tmpGoodsEntity.isLike()) { postData(tmpGoodsEntity.getId(), "delete"); tmpGoodsEntity.setLike(false); imageButton.setBackgroundResource(R.drawable.like); String textString = likeCount.getText().toString(); if (textString != null) { likeCount.setText(Integer.parseInt(textString) - 1 + ""); } } else { postData(tmpGoodsEntity.getId(), "add"); tmpGoodsEntity.setLike(true); imageButton.setBackgroundResource(R.drawable.liked); String textString = likeCount.getText().toString(); if (textString != null) { likeCount.setText(Integer.parseInt(textString) + 1 + ""); } } } }); if (tmpGoodsEntity.getGoodImages() != null) { Picasso picasso = Picasso.with(listItemView.imageView.getContext()); picasso.load(CommonUtils.getFirstImg(tmpGoodsEntity.getGoodImages())) .placeholder(R.drawable.ic_img_loading).into(listItemView.imageView); } else { listItemView.imageView.setBackgroundResource(R.drawable.ic_img_loading); } return convertView; }
From source file:com.example.android.BluetoothChat.BluetoothChat.java
private void setupChat() { Log.d(TAG, "setupChat()"); // Initialize the array adapter for the conversation thread mConversationArrayAdapter = new ArrayAdapter<String>(this, R.layout.message2); mConversationView = (ListView) findViewById(R.id.in); mConversationView.setAdapter(mConversationArrayAdapter); // Initialize the compose field with a listener for the return key mOutEditText = (EditText) findViewById(R.id.edit_text_out); mOutEditText.setOnEditorActionListener(mWriteListener); // Initialize the send button with a listener that for click events mSendButton = (Button) findViewById(R.id.button_send); mSendButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { // Send a message using content of the edit text widget TextView view = (TextView) findViewById(R.id.edit_text_out); String message = view.getText().toString(); sendMessage(message);//from ww w .j a va 2 s. c o m } }); // Initialize the BluetoothChatService to perform bluetooth connections mChatService = new BluetoothChatService(this, mHandler); // Initialize the buffer for outgoing messages mOutStringBuffer = new StringBuffer(""); }
From source file:com.github.jvanhie.discogsscrobbler.ReleaseDetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_release_detail, container, false); mRootView = rootView;//from w w w. ja v a2 s . c o m // Show the content if (mRelease != null) { setRelease(); if (!mRelease.hasExtendedInfo) { //we don't got extended info on this release yet, get it and display it mDiscogs.refreshRelease(mRelease, new Discogs.DiscogsWaiter() { @Override public void onResult(boolean success) { if (success) { //refresh the info setRelease(); } } }); } } else { mDiscogs.getRelease(getArguments().getLong(ARG_ITEM_ID, 0), new Discogs.DiscogsDataWaiter<Release>() { @Override public void onResult(boolean success, Release data) { if (success) { mRelease = data; setRelease(); } } }); } //pricesuggestions //get price suggestions mDiscogs.getPriceSuggestions(getArguments().getLong(ARG_ITEM_ID, 0), new Discogs.DiscogsDataWaiter<DiscogsPriceSuggestion>() { @Override public void onResult(boolean success, DiscogsPriceSuggestion data) { if (success && data != null) { ArrayList<Bar> bars = new ArrayList<Bar>(); for (DiscogsPriceSuggestion.Quality quality : data.getSuggestion()) { Bar b = new Bar(); b.setName(quality.type); b.setValue(quality.value); b.setValueString(Math.round(quality.value * 10) / 10f + ""); bars.add(b); } if (bars.size() > 0) { TextView heading = (TextView) mRootView.findViewById(R.id.detail_price_header); BarGraph graph = (BarGraph) mRootView.findViewById(R.id.detail_price_graph); heading.setText(heading.getText() + " in " + data.getSuggestion().get(0).currency); graph.setBars(bars); heading.setVisibility(View.VISIBLE); graph.setVisibility(View.VISIBLE); } } } }); return rootView; }
From source file:com.bydavy.card.receipts.activities.ReceiptListActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { final MenuInflater inflater = getSupportMenuInflater(); inflater.inflate(R.menu.activity_receipt_list, menu); final MenuItem searchItem = menu.findItem(R.id.menu_search); mSearch = (EditText) searchItem.getActionView(); mSearch.setOnEditorActionListener(new OnEditorActionListener() { @Override/*www .jav a 2 s . co m*/ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if ((EditorInfo.IME_ACTION_SEARCH == actionId) || ((event != null) && (KeyEvent.KEYCODE_ENTER == event.getKeyCode()))) { search(v.getText().toString()); return true; } return false; } }); return super.onCreateOptionsMenu(menu); }
From source file:com.microsoft.office365.msgraphsnippetapp.SnippetDetailFragment.java
@TargetApi(11) private void clipboard11(TextView tv) { android.content.ClipboardManager clipboardManager = (android.content.ClipboardManager) getActivity() .getSystemService(Context.CLIPBOARD_SERVICE); ClipData clipData = ClipData.newPlainText("RESTSnippets", tv.getText()); clipboardManager.setPrimaryClip(clipData); }