List of usage examples for android.widget TextView setText
@android.view.RemotableViewMethod public final void setText(@StringRes int resid)
From source file:com.pixellostudio.qqdroid.BaseQuote.java
/** Called when the activity is first created. */ @Override//from w ww.j av a 2 s .co m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setActionBarContentView(R.layout.show); getActionBar().setTitle(title); getActionBar().addItem(getActionBar().newActionBarItem(NormalActionBarItem.class) .setDrawable(R.drawable.seemore).setContentDescription("List"), R.id.actionbar_seemore); view = (ListView) findViewById(R.id.ListView); view.setOnCreateContextMenuListener(new OnCreateContextMenuListener() { public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { menu.add(0, 1, 0, R.string.sharequote); } }); adapter = new ArrayAdapter<String>(getBaseContext(), android.R.layout.simple_list_item_1); adapter2 = new ArrayAdapter<String>(getBaseContext(), android.R.layout.simple_list_item_1) { @Override public View getView(int position, View convertView, ViewGroup parent) { SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(BaseQuote.this); TextView txt = new TextView(this.getContext()); txt.setTextSize(Float.parseFloat(pref.getString("policesize", "20"))); txt.setText(Html.fromHtml(this.getItem(position))); if (pref.getString("design", "blackonwhite").equals("blackonwhite")) { txt.setTextColor(Color.BLACK); txt.setBackgroundColor(Color.WHITE); txt.setBackgroundDrawable( this.getContext().getResources().getDrawable(R.drawable.quote_gradient_white)); } else if (pref.getString("design", "blackonwhite").equals("whiteonblack")) { txt.setTextColor(Color.WHITE); txt.setBackgroundColor(Color.BLACK); txt.setBackgroundDrawable( this.getContext().getResources().getDrawable(R.drawable.quote_gradient_black)); } return txt; } }; String[] liste = (String[]) getLastNonConfigurationInstance(); if (liste != null && liste.length != 0) { for (int i = 0; i < liste.length; i++) { adapter.add(liste[i]); adapter2.add(liste[i]); } this.setTitle(name); } else { new LoadQuotes().execute(); } view.setAdapter(adapter2); }
From source file:com.wholegroup.rally.ScoreActivity.java
/** * ? /*from www. j av a 2s .c om*/ */ @Override protected Dialog onCreateDialog(int id) { final View textEntryView = View.inflate(this, R.layout.score_dialog, null); final TextView textName = (TextView) textEntryView.findViewById(R.id.score_dlg_username_edit); textName.setText(m_sName); return new AlertDialog.Builder(ScoreActivity.this).setView(textEntryView) .setTitle(getString(R.string.score_dialog_name)) .setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { m_sName = textName.getText().toString(); if (0 == m_sName.trim().length()) { m_sName = getString(R.string.score_default_name); } // ? ? ?? m_arrRecords[ScoreActivity.RECORDCOUNT - 1] = new ScoreRecord(m_sName, m_iScore, m_iType); // ? ?? Arrays.sort(m_arrRecords); // ?? ((ScoreAdapter) ScoreActivity.this.getListAdapter()).notifyDataSetChanged(); // ? SaveScore(); // , ? // ? getIntent().putExtra(getString(R.string.score_parameter_score), 0); } }).create(); }
From source file:org.klnusbaum.udj.auth.AuthActivity.java
/** * {@inheritDoc}//w ww . ja v a2 s .c om */ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); mAccountManager = AccountManager.get(this); final Intent intent = getIntent(); mUsername = intent.getStringExtra(PARAM_USERNAME); mRequestNewAccount = mUsername == null; mConfirmCredentials = intent.getBooleanExtra(PARAM_CONFIRM_CREDENTIALS, false); Log.i(TAG, " request new: " + mRequestNewAccount); requestWindowFeature(Window.FEATURE_LEFT_ICON); setContentView(R.layout.login_activity); getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, android.R.drawable.ic_dialog_alert); mMessage = (TextView) findViewById(R.id.message); mUsernameEdit = (EditText) findViewById(R.id.username_edit); mPasswordEdit = (EditText) findViewById(R.id.password_edit); if (!TextUtils.isEmpty(mUsername)) mUsernameEdit.setText(mUsername); mMessage.setText(getMessage()); TextView signUp = (TextView) findViewById(R.id.signup_text); signUp.setText(Html.fromHtml(getString(R.string.dont_have_account))); signUp.setMovementMethod(LinkMovementMethod.getInstance()); }
From source file:com.coodesoft.notee.DataAdapter.java
public View getView(int position, View convertView, ViewGroup parent) { boolean isLastRow = position >= m_nItemsLoaded; int rowResID = isLastRow ? loadingRowResID : itemRowResID; LayoutInflater inflater = LayoutInflater.from(context); View v = inflater.inflate(rowResID, parent, false); if (isLastRow) { if (position < m_nNoteAmount) { // Should there be more items loaded? int nextItemToLoad = position + PRELOAD_ITEMS; if (nextItemToLoad > m_nNoteAmount) nextItemToLoad = m_nNoteAmount; Log.d(LOG_TAG, "nextItemToLoad: " + nextItemToLoad); if (nextItemToLoad > m_nItemsLoaded) { Log.d(LOG_TAG, "itemsToLoad: " + nextItemToLoad); // Launch the loading thread if it is not currently running synchronized (loading) { if (!loading.booleanValue()) { Log.d(LOG_TAG, "Staring loading task"); loading = Boolean.TRUE; m_threadLoading = new LoadingThread(); m_threadLoading.start(); Log.d(LOG_TAG, "Loading task started"); }// w w w. jav a 2 s. c o m } } } else uiHandler.post(updateTask); } else { synchronized (m_lstNoteItems) { NoteItem item = m_lstNoteItems.get(position); // title TextView itemControl = (TextView) v.findViewById(R.id.note_item_title); itemControl.setText(item.m_strTitle); // set at TextView itemDate = (TextView) v.findViewById(R.id.note_item_subtitle); itemDate.setText(item.getSetAt()); // icon ImageView imageView = (ImageView) v.findViewById(R.id.image_view_icon); if (item.isNote()) imageView.setImageResource(R.drawable.ic_note); else imageView.setImageResource(R.drawable.ic_schedule); } } return v; }
From source file:org.openplans.rcavl.RCAVL.java
private void switchToRunning() { setContentView(R.layout.running);// w w w . j a v a2s. c o m TextView userField = (TextView) findViewById(R.id.loggedInAsLabel); userField.setText("Logged in as " + userEmail); final Button breakButton = (Button) findViewById(R.id.breakButton); if (locationService.getStatus().equals(LocationService.BREAK)) breakButton.setText(R.string.return_from_break); else breakButton.setText(R.string.take_a_break); breakButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { runOnUiThread(new Thread() { public void run() { if (locationService.isActive()) { locationService.setStatus(LocationService.BREAK, false); breakButton.setText(R.string.return_from_break); } else { locationService.setStatus(LocationService.ACTIVE, true); breakButton.setText(R.string.take_a_break); } } }); } }); final Button logoutButton = (Button) findViewById(R.id.logoutButton); logoutButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { locationService.setStatus(LocationService.INACTIVE, false); stopService(new Intent(RCAVL.this, LocationService.class)); switchToLogin(); } }); }
From source file:de.hackerspacebremen.fragments.StatusFragment.java
public void onEvent(final RefreshEvent event) { if (statusAnimation != null) { statusAnimation.start();/*from w w w .ja v a2 s .c om*/ } if (messageAnimation != null) { messageAnimation.start(); } StatusViewHolder.get().messageBlock.setVisibility(RelativeLayout.GONE); StatusViewHolder.get().imgStatus.setVisibility(ImageView.VISIBLE); StatusViewHolder.get().imgConnErr.setVisibility(ImageView.GONE); final TextView text = StatusViewHolder.get().statusMessage; text.setTypeface(null, Typeface.NORMAL); text.setText(getString(R.string.fetch_status)); final TextView messageText = StatusViewHolder.get().messageText; messageText.setText(getString(R.string.fetch_message)); final TextView messageLabel = StatusViewHolder.get().messageLabel; messageLabel.setVisibility(TextView.GONE); startStatusCommunication(); }
From source file:com.example.kyle.weatherforecast.WeatherFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_layout, container, false); Bundle args = getArguments();/*from ww w . ja va2s . c o m*/ int i = args.getInt("day"); TextView textOutlook = ((TextView) rootView.findViewById(R.id.text_outlook)); ImageView symbolView = ((ImageView) rootView.findViewById(R.id.image_symbol)); TextView tempsView = ((TextView) rootView.findViewById(R.id.text_temp)); TextView windView = ((TextView) rootView.findViewById(R.id.text_min)); TextView realFeelView = ((TextView) rootView.findViewById(R.id.text_real_feel)); textOutlook.setText(WeatherData.outlookArray[i]); symbolView.setImageResource(WeatherData.symbolArray[i]); tempsView.setText(WeatherData.tempsArray[i] + "c"); windView.setText(("Min " + WeatherData.minArray[i] + "c")); realFeelView.setText("Real feel " + WeatherData.realFeelArray[i] + "c"); return rootView; }
From source file:org.silena.main.RegistrationOld.java
private void RenderError(String massage) { LayoutInflater inflater = getLayoutInflater(); View layout = inflater.inflate(R.layout.toast_error, (ViewGroup) findViewById(R.id.toast_layout_root)); TextView text = (TextView) layout.findViewById(R.id.text); text.setText(massage); Toast toast = new Toast(getApplicationContext()); toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0); toast.setDuration(Toast.LENGTH_LONG); toast.setView(layout);// w w w .j a va2 s . co m toast.show(); return; }
From source file:com.facebook.android.friendsmash.RequestUserArrayAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View listItemView = inflater.inflate(R.layout.request_list_item_view, parent, false); ProfilePictureView profilePicView = (ProfilePictureView) listItemView .findViewById(R.id.requestListItemProfilePic); TextView nameView = (TextView) listItemView.findViewById(R.id.requestListItemName); final ImageView checkBox = (ImageView) listItemView.findViewById(R.id.requestListItemCheckbox); JSONObject currentUser = users.get(position); profilePicView.setProfileId(currentUser.optString("id")); profilePicView.setCropped(true);//from w w w . j a v a 2s . c o m nameView.setText(currentUser.optString("first_name")); checkBox.setOnTouchListener(new View.OnTouchListener() { boolean checked = false; @Override public boolean onTouch(View v, MotionEvent event) { // toggle image if (checked) { checked = false; checkBox.setImageResource(R.drawable.checkbox_cold); } else { checked = true; checkBox.setImageResource(R.drawable.checkbox_hot); } return false; } }); return listItemView; }
From source file:com.gammalabs.wifianalyzer.wifi.AccessPointDetail.java
private void setViewVendorShort(@NonNull View view, @NonNull WiFiAdditional wiFiAdditional) { TextView textVendorShort = ((TextView) view.findViewById(R.id.vendorShort)); String vendor = wiFiAdditional.getVendorName(); if (StringUtils.isBlank(vendor)) { textVendorShort.setVisibility(View.GONE); } else {/* w ww. ja va 2 s. co m*/ textVendorShort.setVisibility(View.VISIBLE); textVendorShort.setText(vendor.substring(0, Math.min(VENDOR_SHORT_MAX, vendor.length()))); } }