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.flan.stock.fragment.FragmentQuotationHs.java

@SuppressLint("InflateParams")
@Override/*www. j av  a  2s.c om*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    scrollView = (ObservableScrollView) inflater.inflate(R.layout.fragment_quotation_hs, null);

    zfbTitle = (RelativeLayout) scrollView.findViewById(R.id.rl_hs_zfb);

    tv_zfb = (TextView) scrollView.findViewById((int) R.id.tv_zfb);

    nslv_zfb = (NoScrollListView) scrollView.findViewById(R.id.lv_hs_zfb);
    listViewAdapter = new StockRankListViewAdapter(context);
    nslv_zfb.setAdapter(listViewAdapter);
    nslv_zfb.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {

            TextView tv_name = (TextView) v.findViewById(R.id.stock_name);
            System.out.println("itme " + v.getId() + " stock name " + tv_name.getText());

            Intent intent = new Intent(context, StockDetailActivity.class);
            intent.putExtra("code", tv_name.getText());
            context.startActivity(intent);
        }
    });

    return scrollView;
}

From source file:com.freshplanet.nativeExtensions.C2DMBroadcastReceiver.java

private boolean recurseGroup(Context context, 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 (COLOR_SEARCH_RECURSE_TIP.equals(szText)) {
                notification_text_color = text.getTextColors().getDefaultColor();
                notification_text_size = text.getTextSize();
                DisplayMetrics metrics = new DisplayMetrics();
                WindowManager systemWM = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
                systemWM.getDefaultDisplay().getMetrics(metrics);
                notification_text_size /= metrics.scaledDensity;
                return true;
            }//from   w  ww .  j  a  v  a 2s  .co m
        } else if (gp.getChildAt(i) instanceof ViewGroup)
            return recurseGroup((Context) context, (ViewGroup) gp.getChildAt(i));
    }
    return false;
}

From source file:am.roadpolice.roadpolice.AboutUsDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    View dialogView = getActivity().getLayoutInflater().inflate(R.layout.dialog_about_us, null);
    TextView tvVersion = (TextView) dialogView.findViewById(R.id.tvAboutUsVersion);
    try {//from   ww w  . j  a  v a 2s .c o m
        PackageManager manager = getActivity().getPackageManager();
        PackageInfo info = manager.getPackageInfo(getActivity().getPackageName(), 0);
        tvVersion.setText(tvVersion.getText() + " " + info.versionName);

    } catch (PackageManager.NameNotFoundException e) {
        tvVersion.setVisibility(View.GONE);
    }

    // Makes the link in the text view clickable.
    TextView t2 = (TextView) dialogView.findViewById(R.id.tvAboutUsDeveloper);
    t2.setMovementMethod(LinkMovementMethod.getInstance());

    // Creates About Us Alert dialog which extends from DialogFragment.
    return new AlertDialog.Builder(getActivity()).setTitle(R.string.txtAboutUs)
            .setNeutralButton(R.string.about_us_close, null).setView(dialogView).create();
}

From source file:com.armtimes.dialogs.DialogAboutUs.java

@SuppressWarnings("NullableProblems")
@Override/* ww w  .  java2s . c  om*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    View dialogView = getActivity().getLayoutInflater().inflate(R.layout.dialog_about_us, null);
    TextView tvVersion = (TextView) dialogView.findViewById(R.id.tvAboutUsVersion);
    try {
        PackageManager manager = getActivity().getPackageManager();
        PackageInfo info = manager.getPackageInfo(getActivity().getPackageName(), 0);
        tvVersion.setText(tvVersion.getText() + " " + info.versionName);

    } catch (PackageManager.NameNotFoundException e) {
        tvVersion.setVisibility(View.GONE);
    }

    // Makes the link in the text view clickable.
    TextView t2 = (TextView) dialogView.findViewById(R.id.tvAboutUsDeveloper);
    t2.setMovementMethod(LinkMovementMethod.getInstance());

    // Creates About Us Alert dialog which extends from DialogFragment.
    return new AlertDialog.Builder(getActivity()).setTitle(R.string.about_us)
            .setNeutralButton(R.string.about_us_close, null).setView(dialogView).create();
}

From source file:com.birkettenterprise.phonelocator.activity.AuthenticationActivity.java

private String getValueFromTextView(int id) {
    TextView textView = (TextView) findViewById(id);
    return textView.getText().toString();
}

From source file:com.gimranov.zandy.app.LookupActivity.java

/**
 * Implementation of the OnClickListener interface, to handle button events.
 * /*  w ww . j  a  v a  2 s  .com*/
 * Note: When adding a button, it needs to be added here, but the
 * ClickListener needs to be set in the main onCreate(..) as well.
 */
public void onClick(View v) {
    Log.d(TAG, "Click on: " + v.getId());
    if (v.getId() == R.id.lookupButton) {
        Log.d(TAG, "Trying to start search activity");
        TextView field = (TextView) findViewById(R.id.identifier);
        Editable fieldContents = (Editable) field.getText();
        Bundle b = new Bundle();
        b.putString("mode", "isbn");
        b.putString("identifier", fieldContents.toString());
        this.b = b;
        showDialog(DIALOG_PROGRESS);
    } else {
        Log.w(TAG, "Uncaught click on: " + v.getId());
    }
}

From source file:com.cloudbase.cbhelperdemo.DataScreen.java

@Override
public void onClick(View v) {
    if (v.getId() == R.id.insertButton) {
        TestDataObject obj = this.createObject();
        // use the shared object and send an insert to the basic data object
        MainActivity.helper.insertDocument(obj, "android_demo_collection", true);
    }//  ww w . j  a v a 2 s .c  om

    if (v.getId() == R.id.insertFileButton) {
        // create a photopicker to attach a file. the insert completes in the onActivityResult
        Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
        photoPickerIntent.setType("image/*");
        startActivityForResult(photoPickerIntent, 1);
    }

    if (v.getId() == R.id.searchButton) {
        // run a search over the test collection for all the objects with firstName of "cloud". Should be all of them.
        // this Fragment is also the responder
        CBSearchCondition cond = new CBSearchCondition("firstName", CBSearchConditionOperator.CBOperatorEqual,
                "cloud");
        cond.addSortField("firstName", -1);
        cond.setLimit(1);

        /*
        List<CBDataAggregationCommand> aggregationCommands = new ArrayList<CBDataAggregationCommand>();
                
        CBDataAggregationCommandProject projectCommand = new CBDataAggregationCommandProject();
        projectCommand.getIncludeFields().add("Symbol");
        projectCommand.getIncludeFields().add("Price");
        projectCommand.getIncludeFields().add("total");
        aggregationCommands.add(projectCommand);
                
        CBDataAggregationCommandGroup groupCommand = new CBDataAggregationCommandGroup();
        groupCommand.addOutputField("Symbol");
        groupCommand.addGroupFormulaForField("total", CBDataAggregationGroupOperator.CBDataAggregationGroupSum, "Price");
        aggregationCommands.add(groupCommand);
        */
        MainActivity.helper.searchDocument("android_demo_collection", cond, this);
        //MainActivity.helper.searchDocumentAggregate("security_master_3", aggregationCommands, this);

    }

    if (v.getId() == R.id.downloadButton) {
        TextView fileIdText = (TextView) this.getView().findViewById(R.id.fileIdText);
        String fileId = fileIdText.getText().toString();

        // download file and show the image in a popup view - This Fragment is also the responder
        MainActivity.helper.downloadFile(fileId, this);
    }
}

From source file:com.aqnote.app.wifianalyzer.about.AboutActivityTest.java

@Test
public void testApplicationName() throws Exception {
    // setup//from   ww  w .  ja  v a2 s  .  c o  m
    String expectedName = fixture.getString(R.string.app_name);
    if (isDevelopmentMode) {
        expectedName += " " + MainActivity.WI_FI_ANALYZER_BETA;
    }
    // execute
    TextView actual = (TextView) fixture.findViewById(R.id.about_app_name);
    // validate
    assertNotNull(actual);
    assertEquals(View.VISIBLE, actual.getVisibility());
    assertEquals(expectedName, actual.getText());
}

From source file:fi.iki.murgo.irssinotifier.InitialSettingsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.initialsettings);

    preferences = new Preferences(this);

    if (LicenseHelper.isPlusVersion(this)) {
        TextView tv = (TextView) findViewById(R.id.textViewWelcomeHelp);
        tv.setText(getString(R.string.welcome_thanks_for_support) + " " + tv.getText());
    }/*from  w w  w.  ja  v a2s .co  m*/

    UserHelper fetcher = new UserHelper();
    final Account[] accounts = fetcher.getAccounts(this);
    String[] accountNames = new String[accounts.length];
    for (int i = 0; i < accounts.length; i++) {
        accountNames[i] = accounts[i].name;
    }

    ListView listView = (ListView) findViewById(R.id.accountsList);
    listView.setAdapter(new ArrayAdapter<String>(this, R.layout.accountlistitem, accountNames));
    listView.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            Account account = accounts[arg2];
            preferences.setAccountName(account.name);
            preferences.setNotificationsEnabled(true);
            whatNext(0);
        }
    });

    if (LicenseHelper.bothEditionsInstalled(this)) {
        MessageBox.Show(this, null, getString(R.string.both_versions_installed), null);
    }
}

From source file:com.italankin.dictionary.ui.translation.TranslationActivity.java

@Override
public void onClick(View v) {
    // lookup word
    TextView textView = (TextView) v;
    Intent intent = new Intent(this, MainActivity.class);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_TEXT, textView.getText().toString());
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    startActivity(intent);/*from ww  w  .ja  v  a 2  s.c  o m*/
}