Example usage for android.widget TextView getText

List of usage examples for android.widget TextView getText

Introduction

In this page you can find the example usage for android.widget TextView getText.

Prototype

@ViewDebug.CapturedViewProperty
public CharSequence getText() 

Source Link

Document

Return the text that TextView is displaying.

Usage

From source file:com.android.datetimepicker.date.YearPickerView.java

private int getYearFromTextView(TextView view) {
    return Integer.valueOf(view.getText().toString());
}

From source file:com.commonsware.android.abf.ActionBarFragment.java

@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    if (event == null || event.getAction() == KeyEvent.ACTION_UP) {
        adapter.add(v.getText().toString());
        v.setText("");

        InputMethodManager imm = (InputMethodManager) getActivity()
                .getSystemService(Context.INPUT_METHOD_SERVICE);

        imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
    }//from w w  w .  ja v  a2 s .  c o  m

    return (true);
}

From source file:com.fuzz.emptyhusk.SimplePagerAdapter.java

@Override
public boolean isViewFromObject(View view, Object object) {
    TextView textView = (TextView) view.findViewById(R.id.cell_text);
    CharSequence text = null;/*from ww w  .  j av a2s . c o m*/

    if (textView != null) {
        text = textView.getText();
    }

    return text != null && text.equals(object);
}

From source file:com.madgag.agit.RDTypeListActivityStoryTest.java

public void testShouldShowAllTags() throws Exception {
    Repository repoWithTags = unpackRepo("small-repo.with-tags.zip");

    setActivityIntent(listIntent(repoWithTags, "tag"));

    final RDTypeListActivity activity = getActivity();

    ListView listView = activity.getListView();

    checkCanSelectEveryItemInNonEmpty(listView);

    RDTTag tagDomainType = new RDTTag(repoWithTags);
    List<TagSummary> summaries = tagDomainType.getAll();
    Log.i(TAG, "Should be " + summaries.size() + " elements in the list.. there are " + listView.getCount());
    assertThat(listView.getCount(), is(summaries.size()));
    for (int index = 0; index < summaries.size(); ++index) {
        TagSummary summary = summaries.get(index);
        View itemView = getItemViewBySelecting(listView, index);
        Log.d(TAG, "summary=" + summary + " view=" + itemView);
        TextView itemTitleTextView = (TextView) itemView.findViewById(android.R.id.text1);
        assertThat(itemTitleTextView.getText(), is(summary.getName()));

        if (summary.getName().equals("annotated-tag-of-2nd-commit")) {
            CharSequence dt = ((TextView) itemView.findViewById(android.R.id.text2)).getText();
            Log.i(TAG, "Looking... " + dt);
            assertThat(dt, charSequence(startsWith("Commit")));
            assertThat(dt, charSequence(containsString("Adding my happy folder with it's tags")));
        }//  w w w. j  av  a  2s.  com
    }
}

From source file:com.loadsensing.app.SensorsActivity.java

protected void onListItemClick(ListView l, View v, int position, long id) {
    // obtenim l'id del sensor i obrim la nova pantalla de la informaci del sensor
    TextView c = (TextView) v.findViewById(R.id.text1);
    String idsensorselected = c.getText().toString();
    Log.d(DEB_TAG, "idsensorselected: " + c.getText().toString());

    Intent intent = new Intent();
    intent.setClass(this.getApplicationContext(), SingleSensorActivity.class);
    intent.putExtra("idsensorselected", idsensorselected);
    startActivity(intent);// w w  w .j  ava  2 s  .  co m

}

From source file:can.yrt.onebusaway.MyRouteListFragmentBase.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    final TextView text = (TextView) info.targetView.findViewById(R.id.short_name);
    menu.setHeaderTitle(getString(R.string.route_name, text.getText()));
    if (isShortcutMode()) {
        menu.add(0, CONTEXT_MENU_DEFAULT, 0, R.string.my_context_create_shortcut);
    } else {//w ww.ja v  a2s  .  c o  m
        menu.add(0, CONTEXT_MENU_DEFAULT, 0, R.string.my_context_get_route_info);
    }
    menu.add(0, CONTEXT_MENU_SHOW_ON_MAP, 0, R.string.my_context_showonmap);
    final String url = QueryUtils.RouteList.getUrl(getListView(), info.position);
    if (!TextUtils.isEmpty(url)) {
        menu.add(0, CONTEXT_MENU_SHOW_URL, 0, R.string.my_context_show_schedule);
    }
}

From source file:br.unisinos.evertonlucas.passshelter.app.SendResourceGroupActivity.java

public void btnSendResource(View view) {
    try {/* w w w  . jav a2 s. c  o  m*/
        this.progressDialog = ProgressDialogUtil.createProgressDialog(this,
                getString(R.string.process_send_resource));
        RelativeLayout parent = (RelativeLayout) view.getParent();
        TextView txtSendResource = (TextView) parent.getChildAt(0);
        Group group = this.groupsRep.getGroupByName(txtSendResource.getText().toString());
        new SendProcessGroupAsyncTask(this, service, resourceRep, this, parseData, localUserRep, group)
                .execute(resourceName);
    } catch (Exception e) {
        this.progressDialog.dismiss();
        ShowLogExceptionUtil.showAndLogException(this, "Erro ao enviar recurso", e);
    }
}

From source file:com.itime.team.itime.fragments.InputDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    // Get the layout inflater
    final LayoutInflater inflater = getActivity().getLayoutInflater();

    TextView title = new TextView(getActivity());
    // You Can Customise your Title here
    String titleText = getArguments().getString(INPUT_DIALOG_TITLE);
    title.setText(titleText);/*from  ww w. j  a  v  a 2 s  . com*/
    title.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
    title.setPadding(10, 10, 10, 10);
    title.setGravity(Gravity.CENTER);
    title.setTextColor(Color.WHITE);
    title.setTextSize(20);

    // Inflate and set the layout for the dialog
    // Pass null as the parent view because its going in the dialog layout
    builder.setView(inflater.inflate(R.layout.fragment_input_dialog, null)).setCustomTitle(title)
            // Add action buttons
            .setPositiveButton(R.string.Save, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                    TextView inputArea = (TextView) getDialog().findViewById(R.id.input_area);
                    mListener.onDialogPositiveClick(inputArea.getText().toString());

                }
            }).setNegativeButton(R.string.Cancel, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                    mListener.onDialogNegativeClick(InputDialogFragment.this);
                }
            });
    return builder.create();
}

From source file:com.anysoftkeyboard.ui.settings.AboutAnySoftKeyboardFragment.java

@Override
public void onViewStateRestored(Bundle savedInstanceState) {
    super.onViewStateRestored(savedInstanceState);
    TextView additionalSoftware = (TextView) getView().findViewById(R.id.about_legal_stuff_link);
    SpannableStringBuilder sb = new SpannableStringBuilder(additionalSoftware.getText());
    sb.clearSpans();//removing any previously (from instance-state) set click spans.
    sb.setSpan(new ClickableSpan() {
        @Override//ww  w  .  ja v a 2s . c om
        public void onClick(View widget) {
            FragmentChauffeurActivity activity = (FragmentChauffeurActivity) getActivity();
            activity.addFragmentToUi(new AdditionalSoftwareLicensesFragment(),
                    FragmentChauffeurActivity.FragmentUiContext.DeeperExperience);
        }
    }, 0, additionalSoftware.getText().length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
    additionalSoftware.setMovementMethod(LinkMovementMethod.getInstance());
    additionalSoftware.setText(sb);
}

From source file:gov.in.bloomington.georeporter.fragments.PersonalInfoFragment.java

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);

    final String fieldname = PersonalInfoAdapter.FIELDS[position];
    final TextView label = (TextView) v.findViewById(android.R.id.text1);
    final TextView input = (TextView) v.findViewById(android.R.id.text2);

    final EditText newValue = new EditText(getActivity());
    newValue.setText(input.getText());

    int type = InputType.TYPE_TEXT_FLAG_CAP_WORDS;
    if (fieldname == "email") {
        type = InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
    }//  w  ww . j  a  v a 2 s .  c om
    if (fieldname == "phone") {
        type = InputType.TYPE_CLASS_PHONE;
    }
    newValue.setInputType(type);

    new AlertDialog.Builder(getActivity()).setTitle(label.getText()).setView(newValue)
            .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    try {
                        mPersonalInfo.put(fieldname, newValue.getText());
                    } catch (JSONException e) {
                        // Just ignore any errors
                    }
                }
            }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // Do Nothing
                }
            }).show();
}