List of usage examples for android.widget TextView setText
@android.view.RemotableViewMethod public final void setText(@StringRes int resid)
From source file:com.ruenzuo.through.activities.LicensesActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.licenses_activity_layout); getActionBar().setDisplayHomeAsUpEnabled(true); AssetManager assetManager = getAssets(); try {/*from w w w. j av a2 s .c o m*/ 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.rincliu.library.common.reference.push.RLNotificationActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); RLNotificationEntity ne = (RLNotificationEntity) getIntent().getSerializableExtra("data"); setTitle(ne.getTitle());/*w w w . j a va 2 s. c o m*/ setContentView(R.layout.push); TextView tv_content = (TextView) findViewById(R.id.tv_content); tv_content.setText(ne.getContent()); String x = ne.getExtra(); if (x != null && !x.equals("")) { JSONObject object = null; try { object = new JSONObject(x); } catch (JSONException e) { e.printStackTrace(); } if (object != null && object.has("data")) { String data = null; try { data = object.get("data").toString(); } catch (JSONException e) { e.printStackTrace(); } if (data != null) { System.out.println(x); } } } }
From source file:edu.stanford.mobisocial.dungbeetle.feed.objects.PhoneStateObj.java
public void render(Context context, ViewGroup frame, Obj obj, boolean allowInteractions) { JSONObject content = obj.getJson();/*from w w w . j ava 2 s .c o m*/ TextView valueTV = new TextView(context); valueTV.setText(asText(content)); 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:org.kepennar.android.client.social.facebook.FacebookFeedListAdapter.java
public View getView(int position, View convertView, ViewGroup parent) { Post entry = getItem(position);/* www .java2s. c o m*/ View view = convertView; if (view == null) { view = _layoutInflater.inflate(R.layout.facebook_feed_list_item, parent, false); } TextView t = (TextView) view.findViewById(R.id.from_name); t.setText(entry.getFrom().getName()); t = (TextView) view.findViewById(R.id.updated_time); t.setText(entry.getUpdatedTime().toString()); t = (TextView) view.findViewById(R.id.message); t.setText(entry.getMessage()); return view; }
From source file:nf.frex.android.FrexActivity.java
public static void showYesNoDialog(Context context, int titleId, String message, DialogInterface.OnClickListener yesListener, DialogInterface.OnClickListener noListener, DialogInterface.OnCancelListener cancelListener) { TextView textView = new TextView(context); textView.setSingleLine(false);/*from w ww. ja v a 2 s . c om*/ textView.setPadding(10, 10, 10, 10); textView.setText(message); AlertDialog.Builder b = new AlertDialog.Builder(context); b.setTitle(titleId); b.setView(textView); b.setCancelable(true); if (yesListener != null) { b.setPositiveButton(android.R.string.yes, yesListener); } if (noListener != null) { b.setNegativeButton(android.R.string.no, noListener); } if (cancelListener != null) { b.setOnCancelListener(cancelListener); } b.show(); }
From source file:com.example.awesomedogs.ui.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);// w w w . j a v a2 s . co m ArrayAdapter<Dog> adapter = new ArrayAdapter<Dog>(this, R.layout.list_row, DoggyData.getDogs()) { @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = getLayoutInflater().inflate(R.layout.list_row, null, false); } Dog dog = getItem(position); TextView textView = (TextView) convertView; textView.setText(getItem(position).getName()); textView.setCompoundDrawablesWithIntrinsicBounds(dog.getIcon(), 0, 0, 0); return textView; } }; setListAdapter(adapter); getListView().setOnItemClickListener(this); }
From source file:com.manning.androidhacks.hack010.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);/*from w ww.j a v a2s. com*/ final TextView textView1 = (TextView) findViewById(R.id.my_text_view_html); textView1.setText(Html.fromHtml(getString(R.string.text1))); textView1.setMovementMethod(LinkMovementMethod.getInstance()); final Spannable text2 = new SpannableString(getString(R.string.text2)); text2.setSpan(new BackgroundColorSpan(Color.RED), 1, 4, 0); text2.setSpan(new ForegroundColorSpan(Color.BLUE), 5, 9, 0); ((TextView) findViewById(R.id.my_text_view_spannable)).setText(text2); }
From source file:MainActivity.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQUEST_SIGN_IN) { GoogleSignInResult googleSignInResult = Auth.GoogleSignInApi.getSignInResultFromIntent(data); if (googleSignInResult.isSuccess()) { GoogleSignInAccount googleSignInAccount = googleSignInResult.getSignInAccount(); TextView textView = (TextView) findViewById(R.id.textView); textView.setText("Signed in: " + googleSignInAccount.getDisplayName()); findViewById(R.id.signInButton).setVisibility(View.GONE); }/*from w w w . ja v a2 s . c o m*/ } }
From source file:org.kepennar.android.client.social.twitter.TwitterTimelineListAdapter.java
public View getView(int position, View convertView, ViewGroup parent) { Tweet tweet = getItem(position);/*from ww w . j a v a2 s . c o m*/ View view = convertView; if (view == null) { view = _layoutInflater.inflate(R.layout.twitter_timeline_list_item, parent, false); } TextView t = (TextView) view.findViewById(R.id.tweet_from_user); t.setText(tweet.getFromUser()); t = (TextView) view.findViewById(R.id.tweet_created_at); String date = tweet.getCreatedAt() == null ? "" : tweet.getCreatedAt().toString(); t.setText(date); t = (TextView) view.findViewById(R.id.tweet_text); t.setText(tweet.getText()); return view; }
From source file:com.amazonaws.demo.messageboard.MessageQueueAdapter.java
public View getView(int pos, View convertView, ViewGroup parent) { TextView messageText = new TextView(parent.getContext()); messageText.setText(this.getMessageText(pos)); messageText.setGravity(Gravity.LEFT); messageText.setPadding(10, 10, 10, 10); messageText.setMaxWidth(200);/*from w w w . j a v a 2 s. com*/ messageText.setMinWidth(200); messageText.setTextSize(16); return messageText; }