Example usage for android.widget TextView setText

List of usage examples for android.widget TextView setText

Introduction

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

Prototype

@android.view.RemotableViewMethod
public final void setText(@StringRes int resid) 

Source Link

Document

Sets the text to be displayed using a string resource identifier.

Usage

From source file:com.ibm.mobileclientaccess.clientsdk.gauth.MainActivity.java

@Override
public void onFailure(Response response, Throwable t, JSONObject extendedInfo) {
    final TextView tmpInfo = this.infoTextView;
    runOnUiThread(new Runnable() {
        @Override//from w  ww  .j av a  2 s.c o m
        public void run() {
            tmpInfo.setText("Connection to Google - Failed");
        }
    });
}

From source file:com.photocitygame.android.ImageActivity.java

private void addScoreRow(TableLayout scoreTable, String team, int score) {
    TableRow row = new TableRow(this);
    TextView tv = new TextView(this);
    tv.setText(team);
    row.addView(tv);/*from  ww  w .  ja  va 2 s .  c o  m*/
    TextView scoreView = new TextView(this);
    scoreView.setText(Integer.toString(score));
    scoreView.setGravity(Gravity.RIGHT);
    row.addView(scoreView);
    scoreTable.addView(row);
}

From source file:com.eyekabob.VenueInfo.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.venue_info);
    findViewById(R.id.findLiveMusicButton).setOnClickListener(linksListener);
    findViewById(R.id.aboutButton).setOnClickListener(linksListener);
    findViewById(R.id.contactButton).setOnClickListener(linksListener);
    Venue thisVenue = (Venue) getIntent().getExtras().get("venue");
    Map<String, String> params = new HashMap<String, String>();
    params.put("venue", thisVenue.getId());

    TextView nameView = (TextView) findViewById(R.id.venueNameView);
    nameView.setText(thisVenue.getName());

    TextView infoView = (TextView) findViewById(R.id.venueInfoView);
    nameView.setText(thisVenue.getName());
    String venueDesc = "";
    // TODO: Padding instead of whitespace
    if (!thisVenue.getCity().equals("") && !thisVenue.getStreet().equals("")) {
        // TODO: I18N
        venueDesc += "Address:\n  " + thisVenue.getStreet() + "\n  " + thisVenue.getCity();
    }//  www  .  j a  v a 2 s. c o m
    infoView.setText(venueDesc);

    TextView websiteView = (TextView) findViewById(R.id.venueMoreInfoView);
    if (!"".equals((thisVenue.getUrl().toString()))) {
        // TODO: I18N
        websiteView.setText(Html.fromHtml("<a href=\"" + thisVenue.getUrl() + "\">More Information</a>"));
        websiteView.setMovementMethod(LinkMovementMethod.getInstance());
    }

    Uri uri = EyekabobHelper.LastFM.getUri("venue.getEvents", params);
    new RequestTask().execute(uri.toString());
}

From source file:com.amanmehara.programming.android.activities.ProgramActivity.java

private void setLanguageDatails() {
    TextView name = (TextView) findViewById(R.id.language_name);
    name.setText(languageName);
    ImageView image = (ImageView) findViewById(R.id.language_image);
    if (Objects.nonNull(logoBlob)) {
        int imageBlobLength = logoBlob.length;
        Bitmap logo = BitmapFactory.decodeByteArray(logoBlob, 0, imageBlobLength);
        image.setImageBitmap(logo);/*from  w ww  .  jav  a  2 s . c  om*/
    } else {
        image.setImageResource(R.drawable.ic_circle_logo);
    }
}

From source file:com.evvsoft.treeview.demo.DemoActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState != null) {
        mTheme = savedInstanceState.getInt(IDENT_THEME);
        if (mTheme > 0)
            setTheme(mTheme);//from  ww  w .j  ava 2 s.  c  o m
        mIndicator = savedInstanceState.getInt(IDENT_INDICATOR);
    }
    ;
    setContentView(R.layout.activity_demo);
    TreeView treeView = (TreeView) findViewById(R.id.treeView1);

    try {
        String jsonStr = null;
        if (savedInstanceState != null)
            jsonStr = savedInstanceState.getString(IDENT_JSON);
        if (jsonStr == null)
            jsonStr = "[{id:1,id_parent:null,name:name1},{id:3,id_parent:2,name:name3},{id:2,id_parent:null,name:name2},{id:4,id_parent:3,name:name4},{id:5,id_parent:4,name:name5},{id:6,id_parent:2,name:name6},{id:7,id_parent:6,name:name7},{id:8,id_parent:7,name:name8}]";

        JSONArray demoArray = new JSONArray(jsonStr);
        mAdapter = new SimpleJsonTreeViewAdapter(this, demoArray, from);

        View header = getLayoutInflater().inflate(android.R.layout.simple_list_item_1, null);
        TextView tv = (TextView) header.findViewById(android.R.id.text1);
        tv.setText("Demo Header");
        treeView.addHeaderView(header);
        View footer = getLayoutInflater().inflate(android.R.layout.simple_list_item_1, null);
        tv = (TextView) footer.findViewById(android.R.id.text1);
        tv.setText("Demo Footer");
        treeView.addFooterView(footer);

        if (mIndicator != 0)
            treeView.setGroupIndicatorResource(mIndicator);
        //treeView.setChoiceMode(TreeView.CHOICE_MODE_SINGLE);
        treeView.setAdapter(mAdapter);
    } catch (JSONException e) {
        e.printStackTrace();
    }
}

From source file:com.lingeringsocket.mobflare.WaitFlare.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.wait_flare);
    quorumText = (TextView) findViewById(R.id.participants_required_num);
    joinedText = (TextView) findViewById(R.id.participants_joined_num);
    flareName = getIntent().getStringExtra(FlareTimer.FLARE_NAME);
    TextView flareNameView = (TextView) findViewById(R.id.flare_name);
    flareNameView.setText(flareName);
    rpcCoordinator = new RpcCoordinator(this);
    needJoin = true;// ww  w.  j av a  2s  . c o  m
    onTimerTick();
}

From source file:com.tapchatapp.android.app.ui.TapchatServiceStatusBar.java

private void showStatusText(final String message) {
    View headerView = findHeaderView();
    if (headerView == null) {
        return;//w  w w.java  2 s .com
    }

    TextView textView = (TextView) headerView.findViewById(R.id.status_text);
    textView.setText(message);

    headerView.setVisibility(View.VISIBLE);
}

From source file:com.android.browser.GearsPermissionsDialog.java

public void setupDialog(TextView message, ImageView icon) {
    if (mDialogType.equalsIgnoreCase(LOCAL_DATA_STRING)) {
        message.setText(R.string.query_data_prompt);
        icon.setImageResource(android.R.drawable.ic_popup_disk_full);
    } else if (mDialogType.equalsIgnoreCase(LOCATION_DATA_STRING)) {
        message.setText(R.string.location_prompt);
        icon.setImageResource(R.drawable.ic_dialog_menu_generic);
    }//from  www  . j a v  a2 s  .c o  m
}

From source file:com.gammalabs.wifianalyzer.wifi.AccessPointDetail.java

private void setViewCompact(@NonNull Context context, @NonNull View view, @NonNull WiFiDetail wiFiDetail,
        boolean isChild) {
    ((TextView) view.findViewById(R.id.ssid)).setText(wiFiDetail.getTitle());

    WiFiSignal wiFiSignal = wiFiDetail.getWiFiSignal();
    Strength strength = wiFiSignal.getStrength();

    Security security = wiFiDetail.getSecurity();
    ImageView securityImage = (ImageView) view.findViewById(R.id.securityImage);
    securityImage.setImageResource(security.imageResource());
    securityImage.setColorFilter(ContextCompat.getColor(context, R.color.icons_color));

    TextView textLevel = (TextView) view.findViewById(R.id.level);
    textLevel.setText(String.format(Locale.ENGLISH, "%ddBm", wiFiSignal.getLevel()));
    textLevel.setTextColor(ContextCompat.getColor(context, strength.colorResource()));

    ((TextView) view.findViewById(R.id.channel)).setText(wiFiSignal.getChannelDisplay());
    ((TextView) view.findViewById(R.id.primaryFrequency)).setText(String.format(Locale.ENGLISH, "%d%s",
            wiFiSignal.getPrimaryFrequency(), WiFiSignal.FREQUENCY_UNITS));
    ((TextView) view.findViewById(R.id.distance))
            .setText(String.format(Locale.ENGLISH, "%5.1fm", wiFiSignal.getDistance()));

    if (isChild) {
        view.findViewById(R.id.tab).setVisibility(View.VISIBLE);
    } else {//from  w w w.ja  v  a  2s .c  o m
        view.findViewById(R.id.tab).setVisibility(View.GONE);
    }
}

From source file:org.flakor.androidtool.net.net.HistoryTask.java

private void showDialog(String text) {
    dialog = new Dialog(context, R.style.dialogStyle);
    View view = LayoutInflater.from(context).inflate(R.layout.progress_dialog, null);
    TextView textView = (TextView) view.findViewById(R.id.progress_text);
    textView.setText(text);

    dialog.setContentView(view);//  ww w. j  a  v  a  2  s  .com
    dialog.show();
}