List of usage examples for android.widget TextView setText
@android.view.RemotableViewMethod public final void setText(@StringRes int resid)
From source file:com.app.jdy.adapter.GradeAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null || convertView.getTag() == null) { // ?list_item convertView = listContainer.inflate(this.itemViewResource, null); TextView grade_item = (TextView) convertView.findViewById(R.id.grade_item); TextView score_item = (TextView) convertView.findViewById(R.id.score_item); grade_item.setText(list.get(position).getGrade()); score_item.setText(list.get(position).getScore()); }// www . jav a 2 s .c o m return convertView; }
From source file:com.f16gaming.pathofexilestatistics.PoeEntry.java
public AlertDialog getInfoDialog(Activity activity, Resources res) { AlertDialog.Builder builder = new AlertDialog.Builder(activity); LayoutInflater inflater = activity.getLayoutInflater(); View view = inflater.inflate(R.layout.info, null); String nameFormat = res.getString(R.string.info_name); String accountFormat = res.getString(R.string.info_account); String rankFormat = res.getString(R.string.info_rank); String levelFormat = res.getString(R.string.info_level); String classFormat = res.getString(R.string.info_class); String experienceFormat = res.getString(R.string.info_experience); ((TextView) view.findViewById(R.id.info_name)).setText(String.format(nameFormat, name)); ((TextView) view.findViewById(R.id.info_account)).setText(String.format(accountFormat, account)); ((TextView) view.findViewById(R.id.info_rank)).setText(String.format(rankFormat, rank)); ((TextView) view.findViewById(R.id.info_level)).setText(String.format(levelFormat, level)); ((TextView) view.findViewById(R.id.info_class)).setText(String.format(classFormat, className)); ((TextView) view.findViewById(R.id.info_experience)).setText(String.format(experienceFormat, experience)); TextView status = (TextView) view.findViewById(R.id.info_status); status.setText(online ? R.string.online : R.string.offline); status.setTextColor(online ? res.getColor(R.color.online) : res.getColor(R.color.offline)); builder.setTitle(R.string.info_title).setView(view).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override//from w w w .j a v a 2s. c o m public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); return builder.create(); }
From source file:eltharis.wsn.showIDActivity.java
private void showId(String httpresponse) { TextView tv = (TextView) findViewById(R.id.tv); Serializer ser = new Persister(); User u = null;//w w w . j ava 2 s . c o m try { u = ser.read(User.class, httpresponse); tv.setText("ID: " + Integer.toString(u.getId()) + "\nUsername: " + u.getUsername() + "\nFirst name: " + u.getFirst_name() + "\nLast name: " + u.getLast_name() + "\nLast login: " + u.getLast_login() + "\n"); } catch (Exception e) { e.printStackTrace(); } // tv.setText(httpresponse); }
From source file:kr.co.generic.wifianalyzer.wifi.AccessPointDetail.java
private void setViewCompact(@NonNull Context context, @NonNull View view, @NonNull WiFiDetail wiFiDetail, boolean isChild) { ((TextView) view.findViewById(kr.co.generic.wifianalyzer.R.id.ssid)).setText(wiFiDetail.getTitle()); WiFiSignal wiFiSignal = wiFiDetail.getWiFiSignal(); Strength strength = wiFiSignal.getStrength(); Security security = wiFiDetail.getSecurity(); ImageView securityImage = (ImageView) view.findViewById(kr.co.generic.wifianalyzer.R.id.securityImage); securityImage.setImageResource(security.imageResource()); securityImage/*from w w w . ja v a 2 s . c o m*/ .setColorFilter(ContextCompat.getColor(context, kr.co.generic.wifianalyzer.R.color.icons_color)); TextView textLevel = (TextView) view.findViewById(kr.co.generic.wifianalyzer.R.id.level); textLevel.setText(String.format(Locale.ENGLISH, "%ddBm", wiFiSignal.getLevel())); textLevel.setTextColor(ContextCompat.getColor(context, strength.colorResource())); ((TextView) view.findViewById(kr.co.generic.wifianalyzer.R.id.channel)) .setText(wiFiSignal.getChannelDisplay()); ((TextView) view.findViewById(kr.co.generic.wifianalyzer.R.id.primaryFrequency)).setText(String .format(Locale.ENGLISH, "%d%s", wiFiSignal.getPrimaryFrequency(), WiFiSignal.FREQUENCY_UNITS)); ((TextView) view.findViewById(kr.co.generic.wifianalyzer.R.id.distance)) .setText(String.format(Locale.ENGLISH, "%5.1fm", wiFiSignal.getDistance())); if (isChild) { view.findViewById(kr.co.generic.wifianalyzer.R.id.tab).setVisibility(View.VISIBLE); } else { view.findViewById(kr.co.generic.wifianalyzer.R.id.tab).setVisibility(View.GONE); } }
From source file:moe.minori.androidoauthtutorialproject.MainActivity.java
@Override protected void onResume() { super.onResume(); // Fill hardcoded constants to UI on first UI inflation if (!isInFlatedUI) { TextView authUrlTextView = (TextView) findViewById(R.id.authUrlTextView); authUrlTextView.setText(authUrlTextView.getText() + Constants.authURL); TextView accessEndpointTextView = (TextView) findViewById(R.id.accessEndpointTextView); accessEndpointTextView.setText(accessEndpointTextView.getText() + Constants.accessEndpointURL); isInFlatedUI = true;/* w w w.j a v a 2s . c om*/ } // Fill non-hardcoded variables to UI on UI resume TextView accessTokenTextView = (TextView) findViewById(R.id.accessTokenTextView); if (accessToken != null) accessTokenTextView.setText(getString(R.string.accessTokenTextViewString) + accessToken); TextView refreshTokenTextView = (TextView) findViewById(R.id.refreshTokenTextView); if (refreshToken != null) refreshTokenTextView.setText(getString(R.string.refreshTokenTextViewString) + refreshToken); TextView expiresInTextView = (TextView) findViewById(R.id.tokenExpiryTextView); expiresInTextView.setText(getString(R.string.tokenExpiryTextViewString) + expires_in); EditText accessResultEditText = (EditText) findViewById(R.id.accessResultEditText); if (accessResult != null) accessResultEditText.setText(accessResult); }
From source file:com.knurld.dropboxdemo.KnurldActivity.java
public void showInstructions(View view) { Activity parent = (Activity) context; View spinnerView = LayoutInflater.from(parent).inflate(R.layout.instructions_popup, null); TextView textView = (TextView) spinnerView.findViewById(R.id.phraseText); textView.setText("Press record to begin recording enrollment"); PopupWindow popupWindow = new PopupWindow(spinnerView, 500, 500); popupWindow.setFocusable(true);//from w w w. j a v a2 s. co m popupWindow.showAtLocation(view, Gravity.CENTER, 0, 0); final PopupWindow finalPopupWindow = popupWindow; new android.os.Handler().postDelayed(new Runnable() { public void run() { finalPopupWindow.dismiss(); } }, 3000); }
From source file:com.knurld.dropboxdemo.KnurldActivity.java
public void showMessage(View view, String message) { Activity parent = (Activity) context; View spinnerView = LayoutInflater.from(parent).inflate(R.layout.instructions_popup, null); TextView textView = (TextView) spinnerView.findViewById(R.id.phraseText); textView.setText(message); PopupWindow popupWindow = new PopupWindow(spinnerView, 500, 500); popupWindow.setFocusable(true);//from w ww .j a v a 2 s .com popupWindow.showAtLocation(view, Gravity.CENTER, 0, 0); final PopupWindow finalPopupWindow = popupWindow; new android.os.Handler().postDelayed(new Runnable() { public void run() { finalPopupWindow.dismiss(); } }, 3000); }
From source file:org.deviceconnect.android.uiapp.fragment.profile.VibrationProfileFragment.java
/** * Vibration???./*from w w w .j a v a 2s . c o m*/ * @param pattern ? */ private void sendVibration(final CharSequence pattern) { (new AsyncTask<Void, Void, DConnectMessage>() { public DConnectMessage doInBackground(final Void... args) { String p = null; if (pattern != null && pattern.length() > 0) { p = pattern.toString(); } try { URIBuilder builder = new URIBuilder(); builder.setProfile(VibrationProfileConstants.PROFILE_NAME); builder.setAttribute(VibrationProfileConstants.ATTRIBUTE_VIBRATE); builder.addParameter(DConnectMessage.EXTRA_DEVICE_ID, getSmartDevice().getId()); if (p != null) { builder.addParameter(VibrationProfileConstants.PARAM_PATTERN, p); } builder.addParameter(DConnectMessage.EXTRA_ACCESS_TOKEN, getAccessToken()); HttpResponse response = getDConnectClient().execute(getDefaultHost(), new HttpPut(builder.build())); return (new HttpMessageFactory()).newDConnectMessage(response); } catch (URISyntaxException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(final DConnectMessage result) { if (getActivity().isFinishing()) { return; } TextView tv = (TextView) getView().findViewById(R.id.fragment_vibration_result); if (result == null) { tv.setText("failed"); } else { tv.setText(result.toString()); } } }).execute(); }
From source file:me.ntrrgc.jsvm.manualTests.MainActivity.java
public void runTest(View view) { // Example of a call to a native method TextView tv = (TextView) findViewById(R.id.sample_text); PerformanceTests tests = new PerformanceTests(); String testResults = tests.testPropertyRead() + "\n" + tests.testObjectCreation(); tv.setText(testResults); }
From source file:com.springsource.greenhouse.profile.ProfileActivity.java
private void refreshProfile(GreenhouseProfile profile) { if (profile == null) { return;/*from w ww . ja v a2 s .co m*/ } this.profile = profile; final TextView textViewMemberName = (TextView) findViewById(R.id.profile_textview_member_name); textViewMemberName.setText(profile.getDisplayName()); new DownloadProfileImageTask().execute(profile.getPictureUrl()); }