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.twitter.TweetsListAdapter.java

public View getView(int position, View convertView, ViewGroup parent) {
    Tweet tweet = getItem(position);/*from  w w  w .j  ava  2s . c o  m*/
    View view = convertView;

    if (view == null) {
        view = layoutInflater.inflate(R.layout.tweet_list_item, parent, false);
    }

    TextView t = (TextView) view.findViewById(R.id.tweet_list_item_text);
    t.setText(tweet.getText());

    t = (TextView) view.findViewById(R.id.tweet_list_item_fromuser);
    t.setText(tweet.getFromUser());

    return view;
}

From source file:com.ruenzuo.pokeffective.activities.InfoActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.info_activity);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    Uri data = getIntent().getData();//  w ww . ja  v  a  2s.co m
    if (data != null) {
        getActionBar().setTitle("License");
        AssetManager assetManager = getAssets();
        try {
            InputStream inputStream = assetManager.open("licenses/licenses.txt");
            StringWriter stringWriter = new StringWriter();
            IOUtils.copy(inputStream, stringWriter);
            String licenses = stringWriter.toString();
            TextView txtViewLicenses = (TextView) findViewById(R.id.txtViewLicenses);
            txtViewLicenses.setText(licenses);
            txtViewLicenses.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

From source file:com.mappn.gfan.common.util.Utils.java

/**
 * Tab??TextViewView//from  w  ww .ja  va 2s .  c  o  m
 */
public static View createTabView(Context context, String text) {
    TextView view = (TextView) LayoutInflater.from(context).inflate(R.layout.common_tab_view, null);
    view.setText(text);
    return view;
}

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

@Override
public void render(Context context, ViewGroup frame, Obj obj, boolean allowInteractions) {
    JSONObject content = obj.getJson();/*from ww w.ja  va2s.  c  om*/

    TextView valueTV = new TextView(context);
    valueTV.setText("Join me in '" + content.optString(GROUP_NAME) + "'");
    valueTV.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));
    valueTV.setGravity(Gravity.TOP | Gravity.LEFT);
    frame.addView(valueTV);
}

From source file:net.dahanne.android.google.client.GoogleProfileListAdapter.java

public View getView(int position, View convertView, ViewGroup parent) {
    String[] item = getItem(position);
    View view = convertView;/*from  w  w w. ja v  a2  s  . c om*/

    if (view == null) {
        view = layoutInflater.inflate(android.R.layout.two_line_list_item, parent, false);
    }

    TextView t = (TextView) view.findViewById(android.R.id.text1);
    t.setText(item[0]);

    t = (TextView) view.findViewById(android.R.id.text2);
    t.setText(item[1]);

    return view;
}

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

@Override
public void render(Context context, ViewGroup frame, Obj obj, boolean allowInteractions) {
    TextView valueTV = new TextView(context);
    valueTV.setText("I'm here!");
    valueTV.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));
    valueTV.setGravity(Gravity.TOP | Gravity.LEFT);
    frame.addView(valueTV);//from w  w w  . j  a v a  2  s.c o m
}

From source file:org.kepennar.android.client.social.facebook.FacebookProfileListAdapter.java

public View getView(int position, View convertView, ViewGroup parent) {
    String[] item = getItem(position);

    View view = convertView;/* w w  w. j  a  v  a2s .  com*/

    if (view == null) {
        view = _layoutInflater.inflate(android.R.layout.two_line_list_item, parent, false);
    }

    TextView t = (TextView) view.findViewById(android.R.id.text1);
    t.setText(item[0]);

    t = (TextView) view.findViewById(android.R.id.text2);
    t.setText(item[1]);

    return view;
}

From source file:com.example.awesomedogs.ui.DogDetailActivity.java

private void showDetails() {
    setText(R.id.name, mDog.getName());//from  w ww.  jav  a  2 s .c  om
    setText(R.id.breed, mDog.getBreed());
    setText(R.id.age, String.format(getString(R.string.age_template), mDog.getAge()));

    String description = mDog.getDescription(this);
    if (description.isEmpty()) { // Uh oh, this API is only supported on Android 2.2+
        description = getString(R.string.no_description);
    } else {
        description += " " + getString(R.string.lorem_ipsum);
    }
    setText(R.id.description, description);

    Country country = mDog.getCountry();
    TextView tv = (TextView) findViewById(R.id.country);
    tv.setText(country.getName());
    tv.setCompoundDrawablesWithIntrinsicBounds(country.getIcon(), 0, 0, 0);

    ((ImageView) findViewById(R.id.photo)).setImageResource(mDog.getPhoto());
}

From source file:com.springsource.greenhouse.events.sessions.EventSessionDescriptionActivity.java

private void refreshSessionDescription() {
    if (session == null) {
        return;//from  w  w w. j a  v a2 s .co m
    }

    final TextView textViewDescription = (TextView) findViewById(R.id.event_session_description_textview);
    textViewDescription.setText(session.getDescription());
}

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

public void render(Context context, ViewGroup frame, Obj obj, boolean allowInteractions) {
    JSONObject content = obj.getJson();//  www  . j av a2  s .co m
    TextView valueTV = new TextView(context);
    valueTV.setText(content.optString(TEXT));
    valueTV.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));
    valueTV.setGravity(Gravity.TOP | Gravity.LEFT);
    if (Linkify.addLinks(valueTV, Linkify.ALL)) {
        if (!allowInteractions)
            valueTV.setMovementMethod(null);
    }

    frame.addView(valueTV);
}