List of usage examples for android.widget TextView setText
@android.view.RemotableViewMethod public final void setText(@StringRes int resid)
From source file:com.morphoss.jumble.frontend.ResultsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_result); TextView textBestScore = (TextView) findViewById(R.id.score_best); textBestScore.setText("" + MainActivity.scoreTotal); myGallery = (LinearLayout) findViewById(R.id.galleryCategories); myGallery.removeAllViews();/*from w w w.jav a2 s.c o m*/ rga = new ResultsGridAdapter(this); for (int i = 0; i < rga.getCount(); i++) { myGallery.addView(rga.getView(i, null, myGallery)); } new LoadCategoryTask().execute(); }
From source file:com.QuarkLabs.BTCeClient.adapters.OrdersBookAdapter.java
@SuppressLint("InflateParams") @Override// ww w . ja v a 2 s . c o m public View getView(int position, View convertView, ViewGroup parent) { View v; if (convertView == null) { v = mInflater.inflate(R.layout.ordersbook_item, parent, false); } else { v = convertView; } JSONArray value = mData.optJSONArray(position); double price = value.optDouble(0); double volume = value.optDouble(1); TextView text1 = (TextView) v.findViewById(R.id.orderBookPrice); TextView text2 = (TextView) v.findViewById(R.id.ordersBookVolume); text1.setText(String.valueOf(price)); text2.setText(String.valueOf(volume)); if (volume == mMaxValue) { text1.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD)); text2.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD)); } else { text1.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL)); text2.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL)); } return v; }
From source file:net.idlesoft.android.apps.github.activities.NetworkList.java
@Override public void onCreate(final Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.network);//from www.j a va2 s . c o m 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(NetworkList.this, Search.class)); } }); mListView = (ListView) findViewById(R.id.lv_network_list); mListView.setOnItemClickListener(mOnForkListItemClick); mAdapter = new ForkListAdapter(NetworkList.this, mListView); final Bundle extras = getIntent().getExtras(); if (extras != null) { mRepositoryName = extras.getString("repo_name"); mRepositoryOwner = extras.getString("username"); final TextView title = (TextView) findViewById(R.id.tv_page_title); title.setText("Network"); } }
From source file:it.sasabz.android.sasabus.InfoActivity.java
/** Called with the activity is first created. */ @Override//from w w w. j av a 2s. c o m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.standard_listview_layout); TextView titel = (TextView) findViewById(R.id.untertitel); titel.setText(R.string.menu_infos); }
From source file:com.spotify.sdk.android.authentication.sample.MainActivity.java
private void setResponse(final String text) { runOnUiThread(new Runnable() { @Override// ww w .j a v a 2 s .co m public void run() { final TextView responseView = (TextView) findViewById(R.id.response_text_view); responseView.setText(text); } }); }
From source file:eu.operando.operandoapp.wifi.AccessPointsDetail.java
public void setView(@NonNull Resources resources, @NonNull View view, @NonNull final WiFiDetail wiFiDetail) { TextView ssidLabel = (TextView) view.findViewById(R.id.ssid); ssidLabel.setText(wiFiDetail.getTitle()); TextView textLinkSpeed = (TextView) view.findViewById(R.id.linkSpeed); textLinkSpeed.setTextColor(Color.BLACK); String ipAddress = wiFiDetail.getWiFiAdditional().getIPAddress(); boolean isConnected = StringUtils.isNotBlank(ipAddress); if (!isConnected) { textLinkSpeed.setVisibility(View.GONE); ssidLabel.setTextColor(resources.getColor(android.R.color.black)); } else {// w w w .j av a2s. c o m ssidLabel.setTextColor(resources.getColor(R.color.connected)); int linkSpeed = wiFiDetail.getWiFiAdditional().getLinkSpeed(); if (linkSpeed == WiFiConnection.LINK_SPEED_INVALID) { textLinkSpeed.setVisibility(View.GONE); } else { textLinkSpeed.setVisibility(View.VISIBLE); textLinkSpeed.setText(String.format("%d%s", linkSpeed, WifiInfo.LINK_SPEED_UNITS)); } } WiFiSignal wiFiSignal = wiFiDetail.getWiFiSignal(); Strength strength = wiFiSignal.getStrength(); ImageView imageView = (ImageView) view.findViewById(R.id.levelImage); imageView.setImageResource(strength.imageResource()); imageView.setColorFilter(resources.getColor(strength.colorResource())); Security security = wiFiDetail.getSecurity(); ImageView securityImage = (ImageView) view.findViewById(R.id.securityImage); securityImage.setImageResource(security.imageResource()); securityImage.setColorFilter(resources.getColor(R.color.icons_color)); TextView textLevel = (TextView) view.findViewById(R.id.level); textLevel.setText(String.format("%ddBm", wiFiSignal.getLevel())); textLevel.setTextColor(Color.BLACK); //textLevel.setTextColor(resources.getColor(strength.colorResource())); ((TextView) view.findViewById(R.id.channel)) .setText(String.format("%d", wiFiSignal.getWiFiChannel().getChannel())); ((TextView) view.findViewById(R.id.frequency)) .setText(String.format("%d%s", wiFiSignal.getFrequency(), WifiInfo.FREQUENCY_UNITS)); ((TextView) view.findViewById(R.id.distance)).setText(String.format("%.1fm", wiFiSignal.getDistance())); ((TextView) view.findViewById(R.id.capabilities)).setText(wiFiDetail.getCapabilities()); LayoutInflater layoutInflater = mainContext.getLayoutInflater(); final WiFiApConfig wiFiApConfig = wiFiDetail.getWiFiAdditional().getWiFiApConfig(); ImageView configuredImage = (ImageView) view.findViewById(R.id.configuredImage); if (wiFiApConfig != null) { configuredImage.setVisibility(View.VISIBLE); if (isOperandoCompatible(wiFiApConfig)) { configuredImage.setColorFilter(resources.getColor(android.R.color.holo_green_light)); view.setOnClickListener( new ConfiguredClickListener(context, wiFiDetail, wiFiApConfig, isConnected)); } else { configuredImage.setColorFilter(resources.getColor(android.R.color.holo_red_light)); view.setOnClickListener(new ForgetClickListener(context, wiFiDetail)); } } else { configuredImage.setVisibility(View.GONE); view.setOnClickListener(new ConnectClickListener(context, wiFiDetail, layoutInflater)); } }
From source file:de.tudresden.inf.rn.mobilis.groups.overlays.GroupsOverlay.java
@Override protected boolean onTap(int index) { OverlayItem item = mOverlays.get(index); GroupItemInfo gii = groupItemInfos.get(index); LayoutInflater inflater = (LayoutInflater) mainActivity .getSystemService(mainActivity.LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.groups_details_dialog, (ViewGroup) mainActivity.findViewById(R.id.groups_details_layout_root)); TextView text = (TextView) layout.findViewById(R.id.groups_details_text); text.setText(Html.fromHtml("<b>Latitude:</b> " + gii.latitudeE6 / 1E6 + "<br><b>Longitude:</b> " + gii.longitudeE6 / 1E6 + "<br><b>Number of Members:</b> " + gii.memberCount)); //Prepare the Intent for creating a group at this foursquare venue final Intent i = new Intent(mainActivity.getApplicationContext(), GroupInfoActivity.class); i.putExtra("group_id", gii.groupId); String title = gii.name;/*from w w w . j ava 2 s .co m*/ if (title == null || title.equals("")) title = " "; AlertDialog.Builder builder = new AlertDialog.Builder(mainActivity); builder.setTitle(title).setView(layout).setIcon(R.drawable.group_marker_24).setCancelable(true) .setPositiveButton("Details", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { mainActivity.startActivity(i); } }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); builder.show(); return true; }
From source file:org.flakor.androidtool.net.net.HistoryTask.java
@Override protected void onPostExecute(Integer i) { if (i < 0) { if (dialog != null) dialog.dismiss();//from w w w .j av a 2 s . c om Toast.makeText(context, "?", Toast.LENGTH_SHORT).show(); } else if (i >= 0) { View view = LayoutInflater.from(context).inflate(R.layout.dialog_history, null); ListView list = (ListView) view.findViewById(R.id.history_list); if (i == 0) { TextView noHistory = (TextView) view.findViewById(R.id.no_history); noHistory.setVisibility(View.VISIBLE); list.setVisibility(View.GONE); } else { RemoteHistoryAdapter adapter = new RemoteHistoryAdapter(context); list.setAdapter(adapter); } TextView title = (TextView) view.findViewById(R.id.dialog_title); title.setText("??"); Button okBtn = (Button) view.findViewById(R.id.ok_btn); okBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.setContentView(view); Toast.makeText(context, "??", Toast.LENGTH_SHORT).show(); } else { if (dialog != null) dialog.dismiss(); Toast.makeText(context, "???", Toast.LENGTH_SHORT).show(); } }
From source file:com.chess.genesis.dialog.GameStatsDialog.java
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle(title);/* w w w. j av a2 s . co m*/ setBodyView(R.layout.dialog_endgame); setButtonTxt(R.id.cancel, "Close"); final TextView score = (TextView) findViewById(R.id.psr_score); score.setText(psr_score); if (diff > 0) score.setTextColor(MColors.GREEN_DARK); else if (diff < 0) score.setTextColor(MColors.RED_DARK); // Set TextViews final int list[] = new int[] { R.id.opponent, R.id.result, R.id.psr_type }; final String data[] = new String[] { opponent, result, psr_type }; for (int i = 0; i < list.length; i++) { final TextView tv = (TextView) findViewById(list[i]); tv.setText(data[i]); } }
From source file:com.google.android.apps.authenticator.backup.BackupActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.backup);// w ww.j a va 2s .c o m TextView backupText = (TextView) findViewById(R.id.backup_text); backupText.setText(getString(R.string.backup_text, BACKUP_FILE_STRING)); TextView restoreText = (TextView) findViewById(R.id.restore_text); restoreText.setText(getString(R.string.restore_text, BACKUP_FILE_STRING)); Button backupButton = (Button) findViewById(R.id.backup); backupButton.setOnClickListener(this); Button restoreButton = (Button) findViewById(R.id.restore); restoreButton.setOnClickListener(this); // hide backup instructions if the account database is empty ArrayList<String> accountNames = new ArrayList<String>(); DependencyInjector.getAccountDb().getNames(accountNames); if (accountNames.size() < 1) { backupText.setVisibility(View.GONE); backupButton.setVisibility(View.GONE); } }