List of usage examples for android.widget TextView setText
@android.view.RemotableViewMethod public final void setText(@StringRes int resid)
From source file:de.geeksfactory.opacclient.frontend.AccountEditActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(getLayoutResource()); setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); getSupportActionBar().setDisplayHomeAsUpEnabled(true); etLabel = (EditText) findViewById(R.id.etLabel); etName = (EditText) findViewById(R.id.etName); etPassword = (EditText) findViewById(R.id.etPassword); AccountDataSource data = new AccountDataSource(this); data.open();//from ww w . j av a2 s.c o m account = data.getAccount(getIntent().getLongExtra(EXTRA_ACCOUNT_ID, -1)); if (account == null) { finish(); return; } data.close(); if (account.getLabel().equals(getString(R.string.default_account_name))) { etLabel.setText(""); } else { etLabel.setText(account.getLabel()); } etName.setText(account.getName()); etPassword.setText(account.getPassword()); try { lib = ((OpacClient) getApplication()).getLibrary(account.getLibrary()); if (findViewById(R.id.tvCity) != null) { TextView tvCity = (TextView) findViewById(R.id.tvCity); tvCity.setText(lib.getDisplayName()); } if (lib.getReplacedBy() != null && findViewById(R.id.rlReplaced) != null) { findViewById(R.id.rlReplaced).setVisibility(View.VISIBLE); findViewById(R.id.ivReplacedStore).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { try { Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + lib.getReplacedBy())); startActivity(i); } catch (ActivityNotFoundException e) { Log.i("play", "no market installed"); } } }); } else if (findViewById(R.id.rlReplaced) != null) { findViewById(R.id.rlReplaced).setVisibility(View.GONE); } try { if (!lib.getData().getString("baseurl").contains("https") && findViewById(R.id.no_ssl) != null && lib.isAccountSupported()) { findViewById(R.id.no_ssl).setVisibility(View.VISIBLE); } else if (findViewById(R.id.no_ssl) != null) { findViewById(R.id.no_ssl).setVisibility(View.GONE); } } catch (Exception e) { } } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { ErrorReporter.handleException(e); e.printStackTrace(); } }
From source file:com.flowzr.activity.FlowzrSyncActivity.java
public void renderLastTime() { long lastTime = MyPreferences.getFlowzrLastSync(getApplicationContext()); TextView tv = (TextView) findViewById(R.id.sync_was); tv.setText(getString(R.string.flowzr_sync_was) + " " + new Date(lastTime).toLocaleString()); }
From source file:com.example.android.wifidirect.DeviceDetailFragment.java
/** * Clears the UI fields after a disconnect or direct mode disable operation. *//*from w w w . jav a 2 s . co m*/ public void resetViews() { mContentView.findViewById(R.id.btn_connect).setVisibility(View.VISIBLE); TextView view = (TextView) mContentView.findViewById(R.id.device_address); view.setText(R.string.empty); view = (TextView) mContentView.findViewById(R.id.device_info); view.setText(R.string.empty); view = (TextView) mContentView.findViewById(R.id.group_owner); view.setText(R.string.empty); view = (TextView) mContentView.findViewById(R.id.status_text); view.setText(R.string.empty); mContentView.findViewById(R.id.btn_start_client).setVisibility(View.GONE); this.getView().setVisibility(View.GONE); }
From source file:com.brodev.socialapp.view.MarketPlaceDetail.java
private void initView() { ImageView userImage = (ImageView) this.findViewById(R.id.image_user); if (!"".equals(marketPlace.getUser_image_path())) { networkUntil.drawImageUrl(userImage, marketPlace.getUser_image_path(), R.drawable.loading); }// w ww . j a v a 2s .c om userImage.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { Intent intent = new Intent(MarketPlaceDetail.this, FriendTabsPager.class); intent.putExtra("user_id", marketPlace.getUser_id()); startActivity(intent); return false; } }); // set title TextView title = (TextView) this.findViewById(R.id.title); title.setText(marketPlace.getTitle()); colorView.changeColorText(title, user.getColor()); // set content TextView content = (TextView) this.findViewById(R.id.content); // interesting part starts from here here: Html.ImageGetter ig = imageGetter.create(0, marketPlace.getText(), content); content.setTag(0); content.setText(Html.fromHtml(marketPlace.getText(), ig, null)); TextView timestampTxt = (TextView) findViewById(R.id.txtTimestamp); timestampTxt.setText(phraseManager.getPhrase(getApplicationContext(), "marketplace.posted_on")); TextView timestamp = (TextView) findViewById(R.id.time_stamp); timestamp.setText(marketPlace.getTime_stamp()); TextView price = (TextView) this.findViewById(R.id.price); if (marketPlace.getPrice() == 0) { price.setText(phraseManager.getPhrase(getApplicationContext(), "marketplace.free")); } else { price.setText(marketPlace.getCurrency() + " " + marketPlace.getPrice()); } TextView locationTxt = (TextView) findViewById(R.id.txtLocation); locationTxt.setText(phraseManager.getPhrase(getApplicationContext(), "marketplace.location")); TextView txtLocation = (TextView) this.findViewById(R.id.location); String location = marketPlace.getCountry_name(); if (!marketPlace.getCountry_child_name().equals("")) { location += " > " + marketPlace.getCountry_child_name(); } if (!marketPlace.getCity_name().equals("")) { location += " > " + marketPlace.getCity_name(); } txtLocation.setText(location); // set short text TextView fullnameTxt = (TextView) findViewById(R.id.txtFullname); fullnameTxt.setText(phraseManager.getPhrase(getApplicationContext(), "marketplace.posted_by")); TextView shortText = (TextView) findViewById(R.id.fullName); shortText.setText(marketPlace.getFull_name()); colorView.changeColorText(shortText, user.getColor()); shortText.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { Intent intent = new Intent(MarketPlaceDetail.this, FriendTabsPager.class); intent.putExtra("user_id", marketPlace.getUser_id()); startActivity(intent); return false; } }); TextView total_like = (TextView) findViewById(R.id.total_like); total_like.setText(String.valueOf(marketPlace.getTotal_like())); colorView.changeColorText(total_like, user.getColor()); TextView total_comment = (TextView) findViewById(R.id.total_comment); total_comment.setText(String.valueOf(marketPlace.getTotal_comment())); colorView.changeColorText(total_comment, user.getColor()); ImageView likeImg = (ImageView) this.findViewById(R.id.likes_feed_txt); ImageView commentImg = (ImageView) this.findViewById(R.id.comments_feed_txt); colorView.changeColorLikeCommnent(likeImg, commentImg, user.getColor()); //get list images if (!marketPlace.getImages().equals("")) { LinearLayout listImages = (LinearLayout) findViewById(R.id.listImages); JSONObject objOutputImage = null; try { JSONArray objImages = new JSONArray(marketPlace.getImages()); for (int i = 0; i < objImages.length(); i++) { objOutputImage = objImages.getJSONObject(i); ImageView imageView = new ImageView(getApplicationContext()); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( (int) getResources().getDimension(R.dimen.marketplace_image), (int) getResources().getDimension(R.dimen.marketplace_image)); lp.setMargins(5, 5, 5, 0); imageView.setLayoutParams(lp); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); final String imagePath = objOutputImage.getString("image_path"); networkUntil.drawImageUrl(imageView, imagePath, R.drawable.loading); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getApplicationContext(), ImageActivity.class); intent.putExtra("image", imagePath); intent.putExtra("title", marketPlace.getTitle()); startActivity(intent); } }); listImages.addView(imageView); } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { this.findViewById(R.id.horizontalScrollView1).setVisibility(View.GONE); this.findViewById(R.id.marketplace_list_image_view).setVisibility(View.GONE); } }
From source file:com.snappy.VoiceActivity.java
private void setInitHeaderAndAvatar() { ImageView ivAvatar = (ImageView) findViewById(R.id.ivAvatarVoice); LayoutHelper.scaleWidthAndHeight(this, 5f, ivAvatar); TextView tvTitle = (TextView) findViewById(R.id.tvTitle); tvTitle.setText("VOICE"); TextView tvNameOfUser = (TextView) findViewById(R.id.tvNameOfUserVoice); // message from somebody fileDownloadAsync(mMessage.getVoiceFileId(), new File(getHookUpPath(), "voice_download.wav")); String idOfUser = mExtras.getString("idOfUser"); String nameOfUser = mExtras.getString("nameOfUser"); //Log.i("Usuario Recuperado Audio", avatarId); if (UsersManagement.getLoginUser().getId().equals(idOfUser)) { Utils.displayImage(UsersManagement.getLoginUser().getAvatarFileId(), ivAvatar, ImageLoader.SMALL, R.drawable.user_stub, false); } else//from w ww . j ava 2 s. co m CouchDB.findAvatarIdAndDisplay(idOfUser, ivAvatar, this); ///String avatarId = null; //try { // avatarId = new FindAvatarFieldAsync(this).execute(idOfUser).get(); // } catch (InterruptedException e) { // e.printStackTrace(); // } catch (ExecutionException e) { // e.printStackTrace(); // } // Log.i("Usuario Recuperado Audio", avatarId); //Utils.displayImage(avatarId, ivAvatar, ImageLoader.SMALL, R.drawable.user_stub, false); if (mMessage.getBody().equals(null) || mMessage.getBody().equals("")) { tvNameOfUser.setText(getResources().getString(R.string.voice_activity_voice) + " " + Utils.capitalizeFirstLetter(nameOfUser)); //tvNameOfUser.setText(nameOfUser.toUpperCase(Locale.getDefault()) // + "'S VOICE"); } else { tvNameOfUser.setText(mMessage.getBody()); } Button back = (Button) findViewById(R.id.btnBack); back.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { finish(); } }); }
From source file:devbox.com.br.minercompanion.ProfileActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_profile); ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); if (networkInfo.isConnected()) { final WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE); final WifiInfo connectionInfo = wifiManager.getConnectionInfo(); if (connectionInfo != null && !(connectionInfo.getSSID().equals(""))) { //if (connectionInfo != null && !StringUtil.isBlank(connectionInfo.getSSID())) { routerName = connectionInfo.getSSID(); }//from www . ja va2 s . c o m } sensorCounter = new SensorCounter(3000, 3000); sensorCounter.start(); Intent intent = getIntent(); if(intent != null) { matricula = intent.getStringExtra("MATRICULA"); TextView textView = (TextView) findViewById(R.id.textView); textView.setText("Matrcula: " + matricula); sensors = new Sensors(matricula, routerName.replace("\"","")); } /* Get a SensorManager instance */ sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); ListView listView = (ListView) findViewById(R.id.listView); profileListAdapter = new ProfileListAdapter(this, strings); listView.setAdapter(profileListAdapter); profileListAdapter.addItem("Conectado ao servidor!"); }
From source file:com.oakesville.mythling.MediaPagerActivity.java
public void populate() throws IOException, JSONException, ParseException { if (getAppData() == null) { startProgress();/*ww w . j av a2 s . c o m*/ AppData appData = new AppData(getApplicationContext()); appData.readMediaList(getMediaType()); setAppData(appData); stopProgress(); } else if (getMediaType() != null && getMediaType() != getAppData().getMediaList().getMediaType()) { // media type was changed, then back button was pressed getAppSettings().setMediaType(getMediaType()); refresh(); return; } mediaList = getAppData().getMediaList(); storageGroups = getAppData().getStorageGroups(); setMediaType(mediaList.getMediaType()); pagerAdapter = new MediaPagerAdapter(getFragmentManager()); pager.setAdapter(pagerAdapter); pager.setOnPageChangeListener(new OnPageChangeListener() { public void onPageSelected(int position) { setSelItemIndex(position); positionBar.setProgress(getSelItemIndex()); TextView curItemView = (TextView) findViewById(R.id.pager_current_item); curItemView.setText(String.valueOf(getSelItemIndex() + 1)); } public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } public void onPageScrollStateChanged(int state) { } }); positionBar = (SeekBar) findViewById(R.id.pager_position); positionBar.setMax(getListables().size() == 0 ? 0 : getListables().size() - 1); positionBar.setProgress(0); positionBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { if (fromUser) { setSelItemIndex(progress - 1); } } public void onStartTrackingTouch(SeekBar seekBar) { } public void onStopTrackingTouch(SeekBar seekBar) { pager.setCurrentItem(getSelItemIndex()); } }); ImageButton button = (ImageButton) findViewById(R.id.pager_go_first); if (getAppSettings().isTv()) { button.setVisibility(View.GONE); } else { button.setOnClickListener(new OnClickListener() { public void onClick(View v) { pager.setCurrentItem(0); positionBar.setProgress(0); } }); } button = (ImageButton) findViewById(R.id.pager_go_last); if (getAppSettings().isTv()) { button.setVisibility(View.GONE); } else { button.setOnClickListener(new OnClickListener() { public void onClick(View v) { pager.setCurrentItem(getListables().size() - 1); positionBar.setProgress(getListables().size() - 1); } }); } TextView tv = (TextView) findViewById(R.id.pager_last_item); tv.setText(String.valueOf(getListables().size())); updateActionMenu(); if (getListables().size() <= getSelItemIndex()) setSelItemIndex(0); pager.setCurrentItem(getSelItemIndex()); positionBar.setProgress(getSelItemIndex()); TextView curItemView = (TextView) findViewById(R.id.pager_current_item); if (curItemView != null) curItemView.setText(String.valueOf(getSelItemIndex() + 1)); positionBar.requestFocus(); }
From source file:fm.krui.kruifm.ArticleViewActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.article_view_layout); // Show loading view showLoadingScreen(true);// w w w. j a v a2 s .co m // Prepare ActionBar ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); // Retrieve article object from intent Article article = new Article(); article = (Article) getIntent().getSerializableExtra(article.ARTICLE_INTENT); // Instantiate views TextView articleTitleTextView = (TextView) findViewById(R.id.view_article_title_textview); TextView authorTextView = (TextView) findViewById(R.id.view_article_author_textview); TextView articleContentTextView = (TextView) findViewById(R.id.view_article_text_textview); // Apply extracted info to views articleTitleTextView.setText(article.getTitle()); authorTextView.setText(getAuthor(article)); articleContentTextView.setText(Html.fromHtml(getArticleText(article))); // Hide loading view showLoadingScreen(false); }
From source file:kr.co.generic.wifianalyzer.wifi.AccessPointDetail.java
private void setViewVendorShort(@NonNull View view, @NonNull WiFiAdditional wiFiAdditional) { TextView textVendorShort = ((TextView) view.findViewById(kr.co.generic.wifianalyzer.R.id.vendorShort)); String vendor = wiFiAdditional.getVendorName(); if (StringUtils.isBlank(vendor)) { textVendorShort.setVisibility(View.GONE); } else {//w w w. j a v a2s. c o m textVendorShort.setVisibility(View.VISIBLE); textVendorShort.setText(vendor.substring(0, Math.min(VENDOR_SHORT_MAX, vendor.length()))); } }
From source file:com.scigames.slidegame.ProfileActivity.java
/** Called with the activity is first created. */ @Override/* www . ja v a2s. c o m*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE); Log.d(TAG, "super.OnCreate"); Intent i = getIntent(); Log.d(TAG, "getIntent"); firstNameIn = i.getStringExtra("fName"); lastNameIn = i.getStringExtra("lName"); passwordIn = i.getStringExtra("password"); massIn = i.getStringExtra("mass"); emailIn = i.getStringExtra("email"); classIdIn = i.getStringExtra("classId"); studentIdIn = i.getStringExtra("studentId"); visitIdIn = i.getStringExtra("visitId"); rfidIn = i.getStringExtra("rfid"); photoUrl = i.getStringExtra("photoUrl"); photoUrl = "http://mysweetwebsite.com/" + photoUrl; slideLevel = i.getStringExtra("slideLevel"); cartLevel = i.getStringExtra("cartLevel"); Log.d(TAG, "...getStringExtra"); // Inflate our UI from its XML layout description. setContentView(R.layout.profile_page); Log.d(TAG, "...setContentView"); // Hook up button presses to the appropriate event handler. //((Button) findViewById(R.id.back)).setOnClickListener(mBackListener); //((Button) findViewById(R.id.clear)).setOnClickListener(mClearListener); ((Button) findViewById(R.id.done)).setOnClickListener(mDone); //Log.d(TAG,"...instantiateButtons"); //display name and profile info Resources res = getResources(); TextView greets = (TextView) findViewById(R.id.greeting); greets.setText(String.format(res.getString(R.string.greeting), firstNameIn, lastNameIn)); TextView fname = (TextView) findViewById(R.id.first_name); fname.setText(String.format(res.getString(R.string.profile_first_name), firstNameIn)); TextView lname = (TextView) findViewById(R.id.last_name); lname.setText(String.format(res.getString(R.string.profile_last_name), lastNameIn)); TextView school = (TextView) findViewById(R.id.school_name); school.setText(String.format(res.getString(R.string.profile_school_name), "from DB")); TextView teacher = (TextView) findViewById(R.id.teacher_name); teacher.setText(String.format(res.getString(R.string.profile_teacher_name), "from DB")); TextView classid = (TextView) findViewById(R.id.class_id); classid.setText(String.format(res.getString(R.string.profile_classid), classIdIn)); TextView mmass = (TextView) findViewById(R.id.mass); mmass.setText(String.format(res.getString(R.string.profile_mass), massIn)); TextView memail = (TextView) findViewById(R.id.email); memail.setText(String.format(res.getString(R.string.profile_email), emailIn)); TextView mpass = (TextView) findViewById(R.id.password); mpass.setText(String.format(res.getString(R.string.profile_password), passwordIn)); TextView mRfid = (TextView) findViewById(R.id.rfid); mRfid.setText(String.format(res.getString(R.string.profile_rfid), rfidIn)); Log.d(TAG, "...Profile Info"); Typeface ExistenceLightOtf = Typeface.createFromAsset(getAssets(), "fonts/Existence-Light.ttf"); Typeface Museo300Regular = Typeface.createFromAsset(getAssets(), "fonts/Museo300-Regular.otf"); Typeface Museo500Regular = Typeface.createFromAsset(getAssets(), "fonts/Museo500-Regular.otf"); Typeface Museo700Regular = Typeface.createFromAsset(getAssets(), "fonts/Museo700-Regular.otf"); TextView welcome = (TextView) findViewById(R.id.welcome); TextView notascigamersentence = (TextView) findViewById(R.id.notascigamersentence); setTextViewFont(ExistenceLightOtf, greets); setTextViewFont(Museo500Regular, fname, lname, school, teacher, classid, mmass, memail, mpass, mRfid); Button Done = (Button) findViewById(R.id.done); setButtonFont(ExistenceLightOtf, Done); //set listener task.setOnResultsListener(this); //push picture back.-- photo task.cancel(true); //create a new async task for every time you hit login (each can only run once ever) task = new SciGamesHttpPoster(ProfileActivity.this, "http://mysweetwebsite.com/push/update_mass.php"); //i'm using MASS just for now //set listener task.setOnResultsListener(ProfileActivity.this); //prepare key value pairs to send String[] keyVals = { "student_id", studentIdIn, "visit_id", visitIdIn, "mass", massIn }; //create AsyncTask, then execute @SuppressWarnings("unused") AsyncTask<String, Void, JSONObject> serverResponse = null; serverResponse = task.execute(keyVals); Log.d(TAG, "...task.execute(keyVals)"); }