List of usage examples for android.widget TextView setText
@android.view.RemotableViewMethod public final void setText(@StringRes int resid)
From source file:com.ubergeek42.WeechatAndroid.utils.UntrustedCertificateDialog.java
@NonNull @Override/*www. j a va2s . c o m*/ public Dialog onCreateDialog(Bundle savedInstanceState) { final int padding = (int) getResources().getDimension(R.dimen.dialog_padding_full); final ScrollView scrollView = new ScrollView(getContext()); final TextView textView = new AppCompatTextView(getContext()); textView.setText(Html.fromHtml(getCertificateDescription())); scrollView.addView(textView); return new AlertDialog.Builder(getContext()).setTitle(getString(R.string.ssl_cert_dialog_title)) .setView(scrollView, padding, padding / 2, padding, 0) .setPositiveButton(getString(R.string.ssl_cert_dialog_accept_button), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { SSLHandler.getInstance(getContext()).trustCertificate(certificate); ((WeechatActivity) getActivity()).connect(); } }) .setNegativeButton(getString(R.string.ssl_cert_dialog_reject_button), null).create(); }
From source file:com.manning.androidhacks.hack027.NumbersAdapter.java
@Override public View getView(int position, View cv, ViewGroup parent) { if (null == cv) { cv = mInflator.inflate(R.layout.number_row, parent, false); }/*from ww w . ja v a 2s. c o m*/ final Integer value = getItem(position); TextView tv = (TextView) cv.findViewById(R.id.numbers_row_text); tv.setText(value.toString()); View button = cv.findViewById(R.id.numbers_row_button); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (null != mDelegate) { mDelegate.removeItem(value); } } }); return cv; }
From source file:com.sintech.RunningBus.java
public void initBusStation() { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); String linename = sp.getString("lastLine", ""); if (linename.equals("")) { Log.d("DBG", "initBusStation no line"); return;/*from w w w. j a v a 2s . co m*/ } String js = sp.getString(linename, "{'name':'" + linename + "','stations':[],'stationDn':[]}"); try { JSONObject jsonObject = new JSONObject(js); JSONArray array = jsonObject.getJSONArray("stations"); TextView busname = (TextView) findViewById(R.id.IdBusname); busname.setText(jsonObject.getString("name")); LinearLayout ll = (LinearLayout) findViewById(R.id.IdStations); for (int i = 0; i < array.length(); i++) { String stInfo = array.getString(i); TextView station = new TextView(this); station.setText(stInfo.split("=")[0]); ll.addView(station); } } catch (Exception e) { } }
From source file:MainActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQUEST_SPEECH && resultCode == RESULT_OK && data != null) { ArrayList<String> result = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); TextView textView = (TextView) findViewById(R.id.textView); if (result.size() > 0) { textView.setText(""); for (String item : result) { textView.append(item + "\n"); }/*from ww w . j av a2 s . c o m*/ } } }
From source file:com.example.app.ArticleFragment.java
public void updateArticleView(int position) { TextView article = (TextView) getActivity().findViewById(R.id.articleTitle); try {//from w ww. j a va2s . c om article.setText(MainActivity.objects[position].getString("title")); } catch (JSONException e) { e.printStackTrace(); } mCurrentPosition = position; }
From source file:com.dolibarrmaroc.com.F3Activity.java
/** * onCreate//from w w w. j a v a2 s .c o m * * Called when the activity is first created. * This is where you should do all of your normal static set up: create views, bind data to lists, etc. * This method also provides you with a Bundle containing the activity's previously frozen state, if there was one. * * Always followed by onStart(). * * @param savedInstanceState Bundle */ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_f3); setTitleFromActivityLabel(R.id.title_text); try { /*Arc arc=new Arc("http://takamaroc.com/htdocs/doliDroid/app.gz"); arc.setBasicAuth("vendeur", "1234"); Response resp = arc.request("/htdocs/doliDroid/restWebServices.php") .param("username", "vendeur") .param("password", 1234) .param("id", 45) .get(); Response resp = arc.request("").get(); */ ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add(new BasicNameValuePair("username", "vendeur")); //Log.e("PRDS ",compte.getLogin()); nameValuePairs.add(new BasicNameValuePair("password", "1234")); //Log.e("PRDS ",compte.getPassword()); nameValuePairs.add(new BasicNameValuePair("id", "45")); JSONParser json = new JSONParser(); String resp = json.makeHttpRequest("http://takamaroc.com/htdocs/doliDroid/listclient.php", "GET", nameValuePairs); TextView txt = (TextView) findViewById(R.id.restWeb); txt.setText(resp); } catch (Exception e) { System.out.println(e.getMessage()); } }
From source file:org.kepennar.android.client.rest.GoogleSearchActivity.java
private void refreshResults(String result) { if (result == null) { return;/*from w ww .j av a 2 s . com*/ } TextView textViewResults = (TextView) findViewById(R.id.text_view_results); textViewResults.setText(result); }
From source file:com.wellsandwhistles.android.redditsp.reddit.prepared.RedditPreparedMessage.java
@Override public View getBody(final AppCompatActivity activity, final Integer textColor, final Float textSize, final boolean showLinkButtons) { final LinearLayout subjectLayout = new LinearLayout(activity); subjectLayout.setOrientation(LinearLayout.VERTICAL); final TextView subjectText = new TextView(activity); subjectText.setText(StringEscapeUtils.unescapeHtml4(src.subject != null ? src.subject : "(no subject)")); subjectText.setTextColor(textColor); subjectText.setTextSize(textSize);//w w w .j av a 2 s. c om subjectText.setTypeface(null, Typeface.BOLD); subjectLayout.addView(subjectText); subjectLayout.addView(body.buildView(activity, textColor, textSize, showLinkButtons)); return subjectLayout; }
From source file:com.falcon.nester.AboutActivity.java
private void setAboutInfo(String title, String assetFile) { // int offset = 0; // int len; //char[] buff = new char[32*1024]; ((TextView) this.findViewById(R.id.about_title)).setText(title); try {/* w ww . j a v a2 s.c o m*/ InputStream is = getAssets().open(assetFile); // We guarantee that the available method returns the total // size of the asset... of course, this does mean that a single // asset can't be more than 2 gigs. int size = is.available(); // Read the entire asset into a local byte buffer. byte[] buffer = new byte[size]; is.read(buffer); is.close(); // Finally stick the string into the text view. TextView tv = (TextView) findViewById(R.id.about_info); tv.setText(EncodingUtils.getString(buffer, "GB2312")); // scvInfo.setOverScrollMode(ScrollView.OVER_SCROLL_IF_CONTENT_SCROLLS); } catch (IOException e) { e.printStackTrace(); } }
From source file:de.fahrgemeinschaft.util.ReoccuringWeekDaysView.java
public ReoccuringWeekDaysView(Context context, AttributeSet attrs) { super(context, attrs); clickable = attrs.getAttributeBooleanValue(android, CLICKABLE, true); String[] weekDays = new DateFormatSymbols().getShortWeekdays(); for (int i = 2; i <= weekDays.length; i++) { TextView day = makeRecurringDayButton(getContext()); day.setText(weekDays[i < weekDays.length ? i : 1].substring(0, 2)); addView(day);/* www. j a v a2 s .c o m*/ } setFocusable(true); }