List of usage examples for android.widget TextView setText
@android.view.RemotableViewMethod public final void setText(@StringRes int resid)
From source file:com.ibm.mobileclientaccess.fbauth.MainActivity.java
private void setStatus(final String text) { final TextView tmpInfo = this.infoTextView; runOnUiThread(new Runnable() { @Override//from w w w . j av a 2 s .c o m public void run() { tmpInfo.setText(text); } }); }
From source file:com.springsource.greenhouse.twitter.TweetDetailsActivity.java
private void refreshTweetDetails() { if (tweet == null) { return;//ww w .j ava2s . c om } TextView t = (TextView) findViewById(R.id.tweet_details_fromuser); t.setText(tweet.getFromUser()); t = (TextView) findViewById(R.id.tweet_details_time); t.setText(new SimpleDateFormat("MMM d h:mm a").format(tweet.getCreatedAt())); t = (TextView) findViewById(R.id.tweet_details_text); t.setText(tweet.getText()); }
From source file:MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView textView = (TextView) findViewById(R.id.textView); SharedPreferences sharedPreferences = getPreferences(MODE_PRIVATE); String name = sharedPreferences.getString(NAME, null); if (name == null) { textView.setText("Hello"); } else {// w ww . j av a 2s . co m textView.setText("Welcome back " + name + "!"); } mEditTextName = (EditText) findViewById(R.id.editTextName); }
From source file:edu.stanford.mobisocial.dungbeetle.HandleNfcContact.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent();/*from ww w . ja v a 2 s . c om*/ final Uri uri = intent.getData(); setContentView(R.layout.handle_give); Button saveButton = (Button) findViewById(R.id.save_contact_button); Button cancelButton = (Button) findViewById(R.id.cancel_button); Button mutualFriendsButton = (Button) findViewById(R.id.mutual_friends_button); mutualFriendsButton.setVisibility(View.GONE); if (uri != null && (uri.getScheme().equals(HomeActivity.SHARE_SCHEME) || uri.getSchemeSpecificPart().startsWith(FriendRequest.PREFIX_JOIN))) { mEmail = uri.getQueryParameter("email"); mName = uri.getQueryParameter("name"); if (mName == null) { mName = mEmail; } TextView nameView = (TextView) findViewById(R.id.name_text); nameView.setText("Would you like to be friends with " + mName + "?"); final long cid = FriendRequest.acceptFriendRequest(HandleNfcContact.this, uri, false); saveButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { DBHelper helper = DBHelper.getGlobal(HandleNfcContact.this); IdentityProvider ident = new DBIdentityProvider(helper); try { JSONObject profile = new JSONObject(ident.userProfile()); byte[] data = FastBase64.decode(profile.getString("picture")); Helpers.updatePicture(HandleNfcContact.this, data); } catch (Exception e) { } // If asymmetric friend request, send public key. if (!NfcAdapter.ACTION_NDEF_DISCOVERED.equals(getIntent().getAction())) { FriendRequest.sendFriendRequest(HandleNfcContact.this, cid, uri.getQueryParameter("cap")); } Toast.makeText(HandleNfcContact.this, "Added " + mName + " as a friend.", Toast.LENGTH_SHORT) .show(); finish(); } }); cancelButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Helpers.deleteContact(HandleNfcContact.this, cid); finish(); } }); ImageView portraitView = (ImageView) findViewById(R.id.image); if (uri != null) { /* ((App)getApplication()).contactImages.lazyLoadImage( mEmail.hashCode(), Gravatar.gravatarUri(mEmail, 100), portraitView); */ //((App)getApplication()).contactImages.lazyLoadImage(mPicture.hashCode(), mPicture, portraitView); } } else { saveButton.setEnabled(false); cancelButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { finish(); } }); Toast.makeText(this, "Failed to receive contact.", Toast.LENGTH_SHORT).show(); Log.d(TAG, "Failed to handle " + uri); } }
From source file:org.xbmc.kore.ui.hosts.AddHostFragmentFinish.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (getView() == null) return;// w w w . j ava2s.com TextView message = (TextView) getView().findViewById(R.id.done_message); message.setText(Html.fromHtml(getString(R.string.wizard_done_message))); message.setMovementMethod(LinkMovementMethod.getInstance()); // Finish button Button next = (Button) getView().findViewById(R.id.next); next.setText(R.string.finish); next.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { listener.onAddHostFinish(); } }); // Previous button Button previous = (Button) getView().findViewById(R.id.previous); previous.setText(null); previous.setEnabled(false); // Check if PVR is enabled for the current host HostManager hostManager = HostManager.getInstance(getActivity()); if (hostManager.getHostInfo() != null) { AddHostFragmentFinish.checkPVREnabledAndSetMenuItems(getActivity(), new Handler()); String prefKey = Settings.KEY_PREF_CHECKED_PVR_ENABLED + String.valueOf(hostManager.getHostInfo().getId()); PreferenceManager.getDefaultSharedPreferences(getActivity()).edit().putBoolean(prefKey, true).apply(); } // Start the syncing process Intent syncIntent = new Intent(this.getActivity(), LibrarySyncService.class); syncIntent.putExtra(LibrarySyncService.SYNC_ALL_MOVIES, true); syncIntent.putExtra(LibrarySyncService.SYNC_ALL_TVSHOWS, true); syncIntent.putExtra(LibrarySyncService.SYNC_ALL_MUSIC, true); syncIntent.putExtra(LibrarySyncService.SYNC_ALL_MUSIC_VIDEOS, true); getActivity().startService(syncIntent); // InputMethodManager imm = (InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); // imm.hideSoftInputFromWindow(getActivity() // .getWindow() // .getDecorView() // .getRootView() // .getWindowToken(), 0); }
From source file:com.maomuffy.medicnaija.SpecialistMapActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_specialists_map); String footer = new MedicNaijaUtils().footer_text(); TextView tvFooter = (TextView) findViewById(R.id.tvFooter); tvFooter.setText(footer); GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext()); GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getApplicationContext()); map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.specialistMap)).getMap(); map.setMapType(GoogleMap.MAP_TYPE_HYBRID); map.getUiSettings().setZoomControlsEnabled(false); String disease_name = getIntent().getExtras().getString("disease_name"); int state_id = getIntent().getExtras().getInt("state_id"); int lga_id = getIntent().getExtras().getInt("lga_id"); Log.i("AAC_MAP", disease_name); new mapSpecialistApiCall().execute(disease_name, lga_id + "", state_id + ""); //map.setMyLocationEnabled(true); map.setInfoWindowAdapter(new PopupAdapter(getLayoutInflater())); // Set InfoWindow }
From source file:com.springsource.greenhouse.events.sessions.EventSessionRatingActivity.java
private void setRating(int rating) { this.rating = rating; final TextView textView = (TextView) findViewById(R.id.event_session_rating_stars); textView.setText(getRating() + " Stars"); }
From source file:org.mifos.androidclient.main.LoanInstallmentDetailsActivity.java
private void updateContent(LoanInstallmentDetails details) { mDetails = details;/*ww w .j a v a 2s. com*/ TextView field; field = (TextView) findViewById(R.id.loanInstallmentDetails_currentPrincipal); field.setText(details.getUpcomingInstallmentDetails().getPrincipal().toString()); field = (TextView) findViewById(R.id.loanInstallmentDetails_currentInterest); field.setText(details.getUpcomingInstallmentDetails().getInterest().toString()); field = (TextView) findViewById(R.id.loanInstallmentDetails_currentFees); field.setText(details.getUpcomingInstallmentDetails().getFees().toString()); field = (TextView) findViewById(R.id.loanInstallmentDetails_currentPenalty); field.setText(details.getUpcomingInstallmentDetails().getPenalty().toString()); field = (TextView) findViewById(R.id.loanInstallmentDetails_currentSubTotal); field.setText(details.getUpcomingInstallmentDetails().getSubTotal().toString()); field = (TextView) findViewById(R.id.loanInstallmentDetails_overduePrincipal); field.setText(details.getOverDueInstallmentDetails().getPrincipal().toString()); field = (TextView) findViewById(R.id.loanInstallmentDetails_overdueInterest); field.setText(details.getOverDueInstallmentDetails().getInterest().toString()); field = (TextView) findViewById(R.id.loanInstallmentDetails_overdueFees); field.setText(details.getOverDueInstallmentDetails().getFees().toString()); field = (TextView) findViewById(R.id.loanInstallmentDetails_overduePenalty); field.setText(details.getOverDueInstallmentDetails().getPenalty().toString()); field = (TextView) findViewById(R.id.loanInstallmentDetails_overdueSubTotal); field.setText(details.getOverDueInstallmentDetails().getSubTotal().toString()); field = (TextView) findViewById(R.id.loanInstallmentDetails_totalAmountDue_columnLabel); field.setText(getText(R.string.loanInstallmentDetails_totalAmountDue_columnLabel) + DateUtils.format(details.getNextMeetingDate())); field = (TextView) findViewById(R.id.loanInstallmentDetails_totalAmountDue); field.setText(details.getTotalAmountDue().toString()); }
From source file:jp.co.anaheim_eng.aessample.MainActivity.java
@Override public void onClick(View v) { byte[] bytes; try {/* w w w . ja v a2 s. co m*/ switch (v.getId()) { case R.id.btn_encode: { if (getPreferences() == false) { Intent intent = new Intent(this, MainPreferenceActivity.class); startActivity(intent); return; } // Create AES Library object AESLib al = new AESLib(mKeyBitLen, mPassword, mSalt); al.setPlainText(mPlainText); al.Encode(); // Encode result mCiphers = al.getCiphers(); StringBuilder sb = new StringBuilder(); sb.append("AES Encode result [" + String.valueOf(mKeyBitLen) + "bit]\n"); for (int i = 0; i < 3; i++) { sb.append("No." + String.valueOf(i + 1) + "\n"); sb.append("Plain Text:" + mPlainText.get(i) + "\n"); bytes = mCiphers.get(i); sb.append("Cipher :" + String.valueOf(Hex.encodeHex(bytes)) + "\n"); } TextView tv = (TextView) findViewById(R.id.textView1); tv.setText(sb); break; } case R.id.btn_decode: { if ((mCiphers == null) || (mCiphers.size() == 0)) { Toast.makeText(this, R.string.err_nonecipher, Toast.LENGTH_LONG).show(); return; } // Create AES Library object AESLib al = new AESLib(mKeyBitLen, mPassword, mSalt); al.setCiphers(mCiphers); al.Decode(); // Decode result mPlainText = al.getPlainText(); StringBuilder sb = new StringBuilder(); sb.append("AES Decode result [" + String.valueOf(mKeyBitLen) + "bit]\n"); for (int i = 0; i < 3; i++) { sb.append("No." + String.valueOf(i + 1) + "\n"); bytes = mCiphers.get(i); sb.append("Cipher :" + String.valueOf(Hex.encodeHex(bytes)) + "\n"); sb.append("Plain Text:" + mPlainText.get(i) + "\n"); } TextView tv = (TextView) findViewById(R.id.textView1); tv.setText(sb); break; } case R.id.btn_pref: { Intent intent = new Intent(this, MainPreferenceActivity.class); startActivity(intent); break; } } } catch (Exception e) { e.printStackTrace(); } }
From source file:net.idlesoft.android.apps.github.activities.BranchTree.java
@Override public void onCreate(final Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.branch_tree_list); mPrefs = getSharedPreferences(Hubroid.PREFS_NAME, 0); mUsername = mPrefs.getString("username", ""); mPassword = mPrefs.getString("password", ""); mGapi.authenticate(mUsername, mPassword); ((ImageButton) findViewById(R.id.btn_search)).setOnClickListener(new OnClickListener() { public void onClick(final View v) { startActivity(new Intent(BranchTree.this, Search.class)); }//from w w w . jav a 2 s .co m }); final TextView pageTitle = (TextView) findViewById(R.id.tv_page_title); pageTitle.setText("Tree Browser"); mListView = (ListView) findViewById(R.id.lv_branchTreeList_list); mListView.setOnItemClickListener(mOnListItemClick); mAdapter = new BranchTreeListAdapter(BranchTree.this, mListView); final Bundle extras = getIntent().getExtras(); if (extras != null) { mRepositoryName = extras.getString("repo_name"); mRepositoryOwner = extras.getString("repo_owner"); mBranchName = extras.getString("branch_name"); mBranchSha = extras.getString("branch_sha"); } }