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.springsource.greenhouse.events.EventDetailsActivity.java

private void refreshEventDetails() {
    if (event == null) {
        return;/*w ww . ja  va 2 s.c  o m*/
    }

    TextView t = (TextView) findViewById(R.id.event_details_name);
    t.setText(event.getTitle());

    t = (TextView) findViewById(R.id.event_details_date);
    t.setText(event.getFormattedTimeSpan());

    t = (TextView) findViewById(R.id.event_details_location);
    t.setText(event.getLocation());

    t = (TextView) findViewById(R.id.event_details_description);
    t.setText(event.getDescription());
}

From source file:com.example.austin.test.TextActivity.java

private void PrintOCRResponse(String jsonResponse) throws ParseException, IOException {
    JSONParser parser = new JSONParser();
    JSONObject jsonObj = (JSONObject) parser.parse(jsonResponse);

    JSONArray text = (JSONArray) jsonObj.get("OCRText");
    String result = "";

    for (int i = 0; i < text.size(); i++) {
        result = result + " " + text.get(i);
    }/*from   w w  w . jav  a 2 s  .  com*/
    final TextView textView = (TextView) findViewById(R.id.textView);
    textView.setText(result);
}

From source file:SecondActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_second);
    TextView textView = (TextView) findViewById(R.id.textViewText);
    if (getIntent() != null && getIntent().hasExtra(Intent.EXTRA_TEXT)) {
        textView.setText(getIntent().getStringExtra(Intent.EXTRA_TEXT));
    }/*w  ww.j  ava  2s  .c  om*/
}

From source file:com.chess.genesis.dialog.GamePoolDialog.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTitle("Game Pool Info");
    setBodyView(R.layout.dialog_gamepool);
    setButtonTxt(R.id.cancel, "Close");

    final TableLayout table = (TableLayout) findViewById(R.id.layout01);
    final LayoutParams layout = (TableRow.LayoutParams) findViewById(R.id.left).getLayoutParams();

    for (final PoolDataItem item : data) {
        final TableRow row = new TableRow(context);

        TextView txt = new TextView(context);
        txt.setLayoutParams(layout);//  www  .  j  a  va  2  s .c o  m
        txt.setText(item.gametype);
        row.addView(txt);

        txt = new TextView(context);
        txt.setText(item.time);
        row.addView(txt);

        table.addView(row);
    }
}

From source file:com.chintans.venturebox.cards.SystemCard.java

public SystemCard(Context context, AttributeSet attrs, RomUpdater romUpdater, Bundle savedInstanceState) {
    super(context, attrs, savedInstanceState);
    setLayoutId(R.layout.card_system);/*from  w w w .java  2  s  .c o  m*/
    setTopTitle(getResources().getString(R.string.system_title), getResources().getColor(R.color.primary_text));
    mContext = context;
    mRomUpdater = new RomUpdater(mContext, false);

    LayoutInflater inflater = LayoutInflater.from(context);
    View view = inflater.inflate(R.layout.card_system, this);

    TextView romView = (TextView) view.findViewById(R.id.rom);
    romView.setText(getResources().getString(R.string.system_rom, romUpdater.getVersion().toString(false)));

    TextView maintainerView = (TextView) view.findViewById(R.id.maintainer);
    maintainerView.setText(getResources().getString(R.string.system_maintainer, romUpdater.getMaintainer()));

    mSeparator = view.findViewById(R.id.separator);
    mUpdateItem = (Item) view.findViewById(R.id.update_found);
    refreshCard();
}

From source file:ca.liquidlabs.android.speedtestvisualizer.fragments.SpeedTestInfoWindowAdapter.java

/**
 * Renders marker contents into the infobox
 * //from w  ww .  j  av a 2s.c  o  m
 * @param marker Map marker
 * @param view Custom infobox view
 */
private void renderContents(Marker marker, View view) {
    String[] snippetInfo = StringUtils.split(marker.getSnippet(), AppConstants.TEXT_SEPARATOR);

    TextView infoHeading = (TextView) view.findViewById(R.id.txt_info_heading);
    infoHeading.setText("@ " + marker.getTitle());

    TextView downloadSpeed = (TextView) view.findViewById(R.id.txt_info_download);
    downloadSpeed.setText(snippetInfo[1]);

    TextView uploadSpeed = (TextView) view.findViewById(R.id.txt_info_upload);
    uploadSpeed.setText(snippetInfo[2]);

    // Connection type - update image based on type
    ConnectionType connType = ConnectionType.fromString(snippetInfo[0]);
    ImageView conntypeImage = (ImageView) view.findViewById(R.id.img_legend_conntype);
    if (connType.isWifi()) {
        conntypeImage.setImageResource(R.drawable.ic_connection_wifi);
    } else {
        conntypeImage.setImageResource(R.drawable.ic_connection_cell);
    }
    TextView connTypeTxt = (TextView) view.findViewById(R.id.txt_info_conntype);
    connTypeTxt.setText(snippetInfo[0]);
}

From source file:com.skubit.iab.activities.TransactionDetailsActivity.java

private void formatStatus(TextView view, TransactionState status) {
    view.setText(status.name());
}

From source file:com.jdom.word.playdough.android.GamePackPlayerActivity.java

public void setScore(String score) {
    TextView scoreView = (TextView) findViewById(R.id.score);
    scoreView.setText(score);
}

From source file:com.applechip.android.showcase.rest.HttpGetGzipCompressedActivity.java

private void refreshResults(ResponseEntity<String> response) {
    if (response == null) {
        return;//from  w  w  w. j  a v a2  s.co  m
    }

    HttpHeaders headers = response.getHeaders();
    StringBuilder sb = new StringBuilder();
    sb.append("Date: ").append(headers.getFirst("Date")).append("\n");
    sb.append("Status: ").append(headers.getFirst("Status")).append("\n");
    sb.append("Content-Type: ").append(headers.getFirst("Content-Type")).append("\n");
    sb.append("Content-Encoding: ").append(headers.getFirst("Content-Encoding")).append("\n");
    sb.append("Content-Length: ").append(headers.getFirst("Content-Length")).append("\n");

    TextView textView = (TextView) findViewById(R.id.text_view_headers);
    textView.setText(sb.toString());

    String results = response.getBody() + "\n";

    textView = (TextView) findViewById(R.id.text_view_results);
    textView.setText(results);
}

From source file:com.messagesight.mqtthelper.PayloadAdapter.java

@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView,
        ViewGroup parent) {/*www  . j  a v a  2 s  .  co  m*/
    final String childText = (String) getChild(groupPosition, childPosition);
    if (convertView == null) {
        LayoutInflater inflater = (LayoutInflater) this.ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = inflater.inflate(R.layout.list_item, null);
    }
    TextView txtListChild = (TextView) convertView.findViewById(R.id.lblListItem);

    txtListChild.setText(childText);
    return convertView;
}