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.applechip.android.showcase.rest.HttpGetGzipCompressedJsonActivity.java

private void refreshResults(ResponseEntity<TwitterSearchResults> response) {
    if (response == null) {
        return;//from w  w w .j a va  2s  . c  om
    }

    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());

    TwitterSearchResults results = response.getBody();

    ListView listView = (ListView) findViewById(R.id.list_view_result_items);
    listView.setAdapter(new TweetListAdapter(this, results.getResults()));
}

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

public void setMessages(List<String> messages) {
    String message = StringUtils.join(messages, IOUtils.LINE_SEPARATOR);
    TextView messageView = (TextView) findViewById(R.id.messages);
    messageView.setText(message);
}

From source file:com.manning.androidhacks.hack029.fragment.ColorFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    if (container == null) {
        return null;
    }//  ww w.j av  a 2s .co  m

    final View rootView = inflater.inflate(R.layout.color_fragment, container, false);
    final TextView textView = (TextView) rootView.findViewById(R.id.color_fragment_text);

    rootView.setBackgroundColor(mColor);
    textView.setText(mText);

    return rootView;
}

From source file:edu.stanford.mobisocial.dungbeetle.feed.objects.MusicObj.java

public void render(Context context, ViewGroup frame, Obj obj, boolean allowInteractions) {
    JSONObject content = obj.getJson();//from   w  ww.  ja va 2s.  c  om
    LinearLayout container = new LinearLayout(context);
    container.setLayoutParams(CommonLayouts.FULL_WIDTH);
    container.setOrientation(LinearLayout.HORIZONTAL);
    container.setGravity(Gravity.CENTER);

    ImageView imageView = new ImageView(context);
    imageView.setImageResource(R.drawable.play);
    imageView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));

    TextView valueTV = new TextView(context);
    valueTV.setText(asText(content));
    valueTV.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));
    valueTV.setGravity(Gravity.BOTTOM | Gravity.LEFT);
    valueTV.setPadding(4, 0, 0, 0);

    container.addView(imageView);
    container.addView(valueTV);
    frame.addView(container);
}

From source file:org.projecthdata.ehr.viewer.fragments.PatientFragment.java

/**
 * Utility method to set the text for a given child TextView
 * //  www.  j av a 2  s  . c  o  m
 * @param id
 * @param text
 */
private void setTextViewText(int id, String text) {
    TextView tv = (TextView) (getActivity().findViewById(id));
    tv.setText(text);
}

From source file:com.manning.androidhacks.hack047.fragments.ColorFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    if (container == null) {
        return null;
    }//from  w w w.j a  va2s . c  o m

    final TextView textView = (TextView) inflater.inflate(R.layout.color_fragment, container, false);

    textView.setBackgroundColor(mColor);
    textView.setText(mText);

    return textView;
}

From source file:com.springsource.greenhouse.events.EventDescriptionActivity.java

private void refreshEventDescription() {
    final TextView textViewDescription = (TextView) findViewById(R.id.event_description_textview);
    Event event = getApplicationContext().getSelectedEvent();
    textViewDescription.setText(event.getDescription());
}

From source file:org.mifos.androidclient.util.listadapters.SimpleListAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View row;// w  w w  . j  a  va2s . com
    if (convertView == null) {
        LayoutInflater inflater = (LayoutInflater) getContext()
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        row = inflater.inflate(R.layout.simple_list_item, parent, false);
    } else {
        row = convertView;
    }
    SimpleListItem item = getItem(position);
    if (item != null) {
        TextView label = (TextView) row.findViewById(R.id.simple_list_item_label);
        label.setText(item.getListLabel());
    }
    return row;
}

From source file:com.dreamfactory.kurtishu.pretty.view.delegate.AboutDelegate.java

@Override
protected void initViews(Context context, Intent mIntent) {
    super.initViews(context, mIntent);
    Toolbar toolbar = get(R.id.toolbar);
    toolbar.setTitle(R.string.app_name);
    toolbar.setTitleTextColor(Color.WHITE);
    toolbar.setNavigationIcon(R.mipmap.ic_arrow_back);
    toolbar.setNavigationOnClickListener(this);

    TextView textViewVersion = get(R.id.version);
    textViewVersion.setText(context.getString(R.string.version, BuildConfig.VERSION_NAME, BuildConfig.FLAVOR));

    RecyclerView mRecyclerView = get(R.id.dp_libraries);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(context));

    ListOrderedMap<String, String> dataMap = new ListOrderedMap<String, String>();
    dataMap.put("GitHub?", "https://github.com/KurtisHu/Pretty");
    dataMap.put("  ", " ?");
    dataMap.put("square / okhttp", "https://square.github.io/okhttp/");
    dataMap.put("google / gson", "https://github.com/google/gson");
    dataMap.put("facebook / fresco", "https://github.com/facebook/fresco");
    dataMap.put("orhanobut / logger", "https://github.com/orhanobut/logger");
    dataMap.put("greenrobot / EventBus", "https://github.com/greenrobot/EventBus");
    dataMap.put("lsjwzh / RecyclerViewPager", "https://github.com/lsjwzh/RecyclerViewPager");
    dataMap.put("Syehunter / RecyclerViewManager", "https://github.com/Syehunter/RecyclerViewManager");
    dataMap.put("Apache / commons-collections", "http://commons.apache.org/proper/commons-collections/");
    dataMap.put("Realm", "https://realm.io");

    mRecyclerView.setAdapter(new LibraryAdapter(context, dataMap));
}

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

public void setCurrentWord(String currentWord) {
    TextView currentWordView = (TextView) findViewById(R.id.current_word);
    currentWordView.setText(currentWord);
}