List of usage examples for android.widget TextView getText
@ViewDebug.CapturedViewProperty
public CharSequence getText()
From source file:com.example.pyrkesa.frag.ScenarioAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { LayoutInflater mInflater = (LayoutInflater) context1.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); convertView = mInflater.inflate(R.layout.scenario_list_item, null); }//from ww w.j av a 2 s .c om pos = position; ImageView imgIcon = (ImageView) convertView.findViewById(R.id.scenario); final TextView txtTitle = (TextView) convertView.findViewById(R.id.scenario_name); ImageButton imgDelete = (ImageButton) convertView.findViewById(R.id.delete_scenario); imgIcon.setImageResource(scenarioItems.get(position).getIcon_Scenario()); txtTitle.setText(scenarioItems.get(position).getName()); imgDelete.setImageResource(scenarioItems.get(position).getIcon_Delete()); imgDelete.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Toast.makeText(context1,"ggffgfg",Toast.LENGTH_LONG).show(); ModelFactory model = (ModelFactory) ModelFactory.getContext(); new AlertDialog.Builder(v.getContext()).setTitle("Supprimer " + txtTitle.getText()) .setMessage("Voulez-vous supprimer ce scnario?") .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // continue with delete new DeleteScenario().execute(txtTitle.getText().toString()); } }).setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // do nothing } }).setIcon(android.R.drawable.ic_dialog_alert).show(); } }); return convertView; }
From source file:edu.cmu.hcii.hangg.beeksbeacon.Fragments.ManageBeaconFragment.java
private View.OnClickListener makeInsertAttachmentOnClickListener(final Button insertButton, final TextView namespaceTextView, final EditText typeEditText, final EditText dataEditText) { return new View.OnClickListener() { @Override//from w w w . jav a 2s .c o m public void onClick(View v) { final String namespace = namespaceTextView.getText().toString(); if (namespace.length() == 0) { toast("namespace cannot be empty"); return; } String type = typeEditText.getText().toString(); if (type.length() == 0) { toast("type cannot be empty"); return; } final String data = dataEditText.getText().toString(); if (data.length() == 0) { toast("data cannot be empty"); return; } Utils.setEnabledViews(false, insertButton); JSONObject body = buildCreateAttachmentJsonBody(namespace, type, data); Callback createAttachmentCallback = new Callback() { @Override public void onFailure(Request request, IOException e) { logErrorAndToast("Failed request: " + request, e); Utils.setEnabledViews(false, insertButton); } @Override public void onResponse(Response response) throws IOException { String body = response.body().string(); if (response.isSuccessful()) { try { JSONObject json = new JSONObject(body); attachmentsTable.addView(makeAttachmentRow(json), 2); namespaceTextView.setText(namespace); typeEditText.setText(""); typeEditText.requestFocus(); dataEditText.setText(""); insertButton.setEnabled(true); } catch (JSONException e) { logErrorAndToast("JSONException in building attachment data", e); } } else { logErrorAndToast("Unsuccessful createAttachment request: " + body); } Utils.setEnabledViews(true, insertButton); } }; client.createAttachment(createAttachmentCallback, beaconInstance.getBeaconName(), body); } }; }
From source file:com.example.pyrkesa.frag.UserAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { LayoutInflater mInflater = (LayoutInflater) context1.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); convertView = mInflater.inflate(R.layout.user_list_item, null); }//from w w w .j av a2s . com pos = position; ImageView imgIcon = (ImageView) convertView.findViewById(R.id.contact); final TextView txtTitle = (TextView) convertView.findViewById(R.id.user_login); ImageButton imgDelete = (ImageButton) convertView.findViewById(R.id.delete); imgIcon.setImageResource(userItems.get(position).getIcon()); txtTitle.setText(userItems.get(position).getTitle()); imgDelete.setImageResource(userItems.get(position).getDelete()); imgDelete.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Toast.makeText(context1,"ggffgfg",Toast.LENGTH_LONG).show(); ModelFactory model = (ModelFactory) ModelFactory.getContext(); if (model.user.type == 1) { new AlertDialog.Builder(v.getContext()).setTitle("Supprimer " + txtTitle.getText()) .setMessage("Voulez-vous supprimer cet utilisateur?") .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // continue with delete new DeleteUser().execute(txtTitle.getText().toString()); } }).setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // do nothing } }).setIcon(android.R.drawable.ic_dialog_alert).show(); } else { new AlertDialog.Builder(v.getContext()).setTitle("Attention") .setMessage("Opration interdite : Droits d'administration requis.").show(); } } }); return convertView; }
From source file:net.idlesoft.android.apps.github.activities.SingleIssue.java
private void loadIssueItemBox() { final TextView date = (TextView) mHeader.findViewById(R.id.tv_issue_list_item_updated_date); final ImageView icon = (ImageView) mHeader.findViewById(R.id.iv_issue_list_item_icon); final TextView title = (TextView) mHeader.findViewById(R.id.tv_issue_list_item_title); final TextView number = (TextView) mHeader.findViewById(R.id.tv_issue_list_item_number); final TextView topbar = (TextView) findViewById(R.id.tv_page_title); try {/*w w w .ja v a 2 s. c o m*/ date.setText(getTimeSince(mJson.getString("updated_at"))); if (mJson.getString("state").equalsIgnoreCase("open")) { icon.setImageResource(R.drawable.issues_open); } else { icon.setImageResource(R.drawable.issues_closed); } number.setText("#" + mJson.getString("number")); title.setText(mJson.getString("title")); topbar.setText("Issue " + number.getText().toString()); } catch (final Exception e) { e.printStackTrace(); } }
From source file:com.dena.app.usage.watcher.fragment.WatchFragment.java
private void showSetTimerDialog(final WatchItem item) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(item.getAppName()); View view = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_set_timer, null); final TextView editInfo = (TextView) view.findViewById(R.id.editInfoTime); editInfo.setText(Integer.toString(mDB.getTimerInfo(item.getPackageName()))); final TextView editWarning = (TextView) view.findViewById(R.id.editWarningTime); editWarning.setText(Integer.toString(mDB.getTimerWarning(item.getPackageName()))); final TextView editFinish = (TextView) view.findViewById(R.id.editFinishTime); editFinish.setText(Integer.toString(mDB.getTimerFinish(item.getPackageName()))); builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { mDB.setTimerInfo(item.getPackageName(), StringUtil.parseInt(editInfo.getText().toString(), 0)); mDB.setTimerWarning(item.getPackageName(), StringUtil.parseInt(editWarning.getText().toString(), 0)); mDB.setTimerFinish(item.getPackageName(), StringUtil.parseInt(editFinish.getText().toString(), 0)); onRefresh();//from w ww . j a va 2 s . c om } }); builder.setNegativeButton(getString(R.string.cancel), null); AlertDialog dialog = builder.create(); dialog.setView((view)); dialog.setCancelable(true); dialog.setCanceledOnTouchOutside(true); dialog.show(); }
From source file:com.github.michalbednarski.intentslab.editor.NewBundleEntryDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { // Inflate layout View view = getActivity().getLayoutInflater().inflate(R.layout.add_extra, null); // Find and fill name field Bundle arguments = getArguments();//w ww . j a va 2 s. c o m final TextView nameTextView = (TextView) view.findViewById(R.id.name); if (arguments != null) { nameTextView.setText(arguments.getString(ARG_DEFAULT_NAME)); } // Find and fill type Spinner final Spinner typeSpinner = (Spinner) view.findViewById(R.id.typespinner); typeSpinner.setAdapter(new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, new String[] { "String/Number", // 0 = TYPE_STRING_OR_NUMBER "Boolean" // 1 = TYPE_BOOLEAN })); // Create AlertDialog return new AlertDialog.Builder(getActivity()).setTitle(R.string.btn_add).setView(view) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String name = nameTextView.getText().toString(); switch (typeSpinner.getSelectedItemPosition()) { case TYPE_STRING_OR_NUMBER: getBundleAdapter().launchEditorForNewEntry(name, ""); break; case TYPE_BOOLEAN: getBundleAdapter().onEditorResult(name, true); break; } } }).create(); }
From source file:com.example.zf_android.trade.ApplyDetailActivity.java
/** * get the item value by key/*from www .j a va 2 s.c o m*/ * * @param key * @return */ private String getItemValue(Object key) { LinearLayout item = (LinearLayout) mContainer.findViewWithTag(key); TextView tvValue = (TextView) item.findViewById(R.id.apply_detail_value); return tvValue.getText().toString(); }
From source file:com.huyn.demogroup.relativetop.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTextColor(tabTextColor); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); }/*from w w w. ja v a2 s. com*/ } } else if (v instanceof LinearLayout) { TextView tab = (TextView) v.findViewWithTag("TEXT"); tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTextColor(tabTextColor); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } } } }
From source file:cn.com.hgh.view.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); }/*from ww w. j a v a 2 s. c o m*/ } if (i == selectedPosition) { tab.setTextColor(selectedTabTextColor); } } } }
From source file:com.google.android.apps.common.testing.accessibility.framework.uielement.ViewHierarchyElement.java
ViewHierarchyElement(int id, @Nullable ViewHierarchyElement parent, View fromView) { // Bookkeeping this.id = id; this.parentId = (parent != null) ? parent.getId() : null; // API 16+ properties this.scrollable = AT_16 ? fromView.isScrollContainer() : null; // API 11+ properties this.backgroundDrawableColor = (AT_11 && (fromView != null) && (fromView.getBackground() instanceof ColorDrawable)) ? ((ColorDrawable) fromView.getBackground()).getColor() : null;/*from w w w . j a va2 s .com*/ // Base properties this.visibleToUser = ViewAccessibilityUtils.isVisibleToUser(fromView); this.className = fromView.getClass().getName(); this.accessibilityClassName = null; this.packageName = fromView.getContext().getPackageName(); this.resourceName = (fromView.getId() != View.NO_ID) ? ViewAccessibilityUtils.getResourceNameForView(fromView) : null; this.contentDescription = SpannableString.valueOf(fromView.getContentDescription()); this.enabled = fromView.isEnabled(); if (fromView instanceof TextView) { TextView textView = (TextView) fromView; // Hint text takes precedence if no text is present. CharSequence text = textView.getText(); if (TextUtils.isEmpty(text)) { text = textView.getHint(); } this.text = SpannableString.valueOf(text); this.textSize = textView.getTextSize(); this.textColor = textView.getCurrentTextColor(); this.typefaceStyle = (textView.getTypeface() != null) ? textView.getTypeface().getStyle() : null; } else { this.text = null; this.textSize = null; this.textColor = null; this.typefaceStyle = null; } this.importantForAccessibility = ViewAccessibilityUtils.isImportantForAccessibility(fromView); this.clickable = fromView.isClickable(); this.longClickable = fromView.isLongClickable(); this.focusable = fromView.isFocusable(); this.editable = ViewAccessibilityUtils.isViewEditable(fromView); this.canScrollForward = (ViewCompat.canScrollVertically(fromView, 1) || ViewCompat.canScrollHorizontally(fromView, 1)); this.canScrollBackward = (ViewCompat.canScrollVertically(fromView, -1) || ViewCompat.canScrollHorizontally(fromView, -1)); this.checkable = (fromView instanceof Checkable); this.checked = (fromView instanceof Checkable) ? ((Checkable) fromView).isChecked() : null; this.hasTouchDelegate = (fromView.getTouchDelegate() != null); // There may be subtle differences between the bounds from a View instance compared to that of // its AccessibilityNodeInfo. The latter uses a @hide getBoundsOnScreen method, which clips to // parent bounds. android.graphics.Rect tempRect = new android.graphics.Rect(); if (fromView.getGlobalVisibleRect(tempRect)) { this.boundsInScreen = new Rect(tempRect); } else { this.boundsInScreen = null; } this.nonclippedHeight = fromView.getHeight(); this.nonclippedWidth = fromView.getWidth(); }