List of usage examples for android.widget TextView setText
@android.view.RemotableViewMethod public final void setText(@StringRes int resid)
From source file:com.dedipower.portal.android.CDNLanding.java
public void UpdateErrorMessage(String MessageText) { TextView ErrorMessage = (TextView) findViewById(R.id.ErrorMessageText); if (MessageText.length() == 0) { ErrorMessage.setHeight(0);/*from ww w .j ava 2s.co m*/ } else { ErrorMessage.setHeight(24); ErrorMessage.setTextColor(-65536); ErrorMessage.setText(MessageText); } }
From source file:com.mk4droid.IMC_Activities.Fragment_Comments.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { vfrag_comments = inflater.inflate(R.layout.fragment_comments, container, false); mfrag_comments = this; ctx = vfrag_comments.getContext();/*from ww w .j a va 2s .c om*/ resources = setResources(); //------------ Title --------- TextView tvTitle = (TextView) vfrag_comments.findViewById(R.id.tv_Comments_GrandTitle); tvTitle.setText(issueTitle); //------- no comments tv-------- tvNoCom = (TextView) vfrag_comments.findViewById(R.id.tvnoComments); // Comments added from a new thread so as to avoid delays TabComments = (TableLayout) vfrag_comments.findViewById(R.id.tlComments); lparams = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); //-------- Enable send Comment button Button btComment = (Button) vfrag_comments.findViewById(R.id.btAddComment); // -------- Enable Commenting EditText EditText etComment = (EditText) vfrag_comments.findViewById(R.id.etComment); if (AuthFlag && InternetConnCheck.getInstance(ctx).isOnline(ctx)) { etComment.setEnabled(true); // Make icon drawable more vivid Drawable dr = resources.getDrawable(R.drawable.ic_send_holo_light); dr.setColorFilter(resources.getColor(R.color.orange), android.graphics.PorterDuff.Mode.SRC_ATOP); btComment.setCompoundDrawablesWithIntrinsicBounds(null, dr, null, null); btComment.setCompoundDrawablePadding(-40); } else { etComment.setEnabled(false); } btComment.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { //================ SEND COMMENT TO DB =============== EditText etComment = (EditText) vfrag_comments.findViewById(R.id.etComment); CommSTR = etComment.getText().toString(); if (CommSTR.length() > 0 && InternetConnCheck.getInstance(ctx).isOnline(ctx) && AuthFlag) { new AsynchTask_SendComment().execute(); } else if (!InternetConnCheck.getInstance(ctx).isOnline(ctx)) { Toast.makeText(ctx, resources.getString(R.string.NoInternet), Toast.LENGTH_SHORT).show(); } else if (!AuthFlag) { Toast.makeText(ctx, resources.getString(R.string.OnlyRegistered), Toast.LENGTH_SHORT).show(); } //=================================================== } }); return vfrag_comments; }
From source file:com.example.survey2.ExpandableListAdapter.java
private void bindView(View view, Map<String, ?> data, String[] from, int[] to) { int len = to.length; for (int i = 0; i < len; i++) { TextView v = (TextView) view.findViewById(to[i]); if (v != null) { v.setText((String) data.get(from[i])); }/*from w w w .java 2s.co m*/ } }
From source file:org.geometerplus.android.fbreader.network.AuthenticationActivity.java
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); Thread.setDefaultUncaughtExceptionHandler( new org.geometerplus.zlibrary.ui.android.library.UncaughtExceptionHandler(this)); setResult(RESULT_CANCELED);/*from w ww.j ava2s . c om*/ setContentView(R.layout.authentication); final Intent intent = getIntent(); final String host = intent.getStringExtra(HOST_KEY); final String area = intent.getStringExtra(AREA_KEY); final String username = intent.getStringExtra(USERNAME_KEY); final String error = intent.getStringExtra(ERROR_KEY); final boolean showSignupLink = intent.getBooleanExtra(SHOW_SIGNUP_LINK_KEY, false); myResource = ZLResource.resource("dialog").getResource("AuthenticationDialog"); setTitle(host != null ? host : myResource.getResource("title").getValue()); if (area != null && !"".equals(area)) { findTextView(R.id.authentication_subtitle).setText(area); } else { findTextView(R.id.authentication_subtitle).setVisibility(View.GONE); } final TextView warningView = findTextView(R.id.authentication_unencrypted_warning); if ("https".equalsIgnoreCase(intent.getStringExtra(SCHEME_KEY))) { warningView.setVisibility(View.GONE); } else { warningView.setText(myResource.getResource("unencryptedWarning").getValue()); } findTextView(R.id.authentication_username_label).setText(myResource.getResource("login").getValue()); findTextView(R.id.authentication_password_label).setText(myResource.getResource("password").getValue()); final TextView usernameView = findTextView(R.id.authentication_username); usernameView.setText(username); final TextView errorView = findTextView(R.id.authentication_error); if (error != null && !"".equals(error)) { errorView.setVisibility(View.VISIBLE); errorView.setText(error); } else { errorView.setVisibility(View.GONE); } if (showSignupLink) { findViewById(R.id.authentication_signup_box).setVisibility(View.VISIBLE); final TextView signupView = (TextView) findViewById(R.id.authentication_signup); signupView.setText(myResource.getResource("register").getValue()); signupView.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { setResult(RESULT_SIGNUP); finish(); } }); } else { findViewById(R.id.authentication_signup_box).setVisibility(View.GONE); } final ZLResource buttonResource = ZLResource.resource("dialog").getResource("button"); final Button okButton = findButton(R.id.authentication_ok_button); okButton.setText(buttonResource.getResource("ok").getValue()); okButton.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { final Intent data = new Intent(); data.putExtra(USERNAME_KEY, usernameView.getText().toString()); data.putExtra(PASSWORD_KEY, findTextView(R.id.authentication_password).getText().toString()); setResult(RESULT_OK, data); finish(); } }); final Button cancelButton = findButton(R.id.authentication_cancel_button); cancelButton.setText(buttonResource.getResource("cancel").getValue()); cancelButton.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { finish(); } }); }
From source file:com.example.pyrkesa.frag.UserAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { LayoutInflater mInflater = (LayoutInflater) context1.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); convertView = mInflater.inflate(R.layout.user_list_item, null); }//from ww w . ja v a 2s .c o m pos = position; ImageView imgIcon = (ImageView) convertView.findViewById(R.id.contact); final TextView txtTitle = (TextView) convertView.findViewById(R.id.user_login); ImageButton imgDelete = (ImageButton) convertView.findViewById(R.id.delete); imgIcon.setImageResource(userItems.get(position).getIcon()); txtTitle.setText(userItems.get(position).getTitle()); imgDelete.setImageResource(userItems.get(position).getDelete()); imgDelete.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Toast.makeText(context1,"ggffgfg",Toast.LENGTH_LONG).show(); ModelFactory model = (ModelFactory) ModelFactory.getContext(); if (model.user.type == 1) { new AlertDialog.Builder(v.getContext()).setTitle("Supprimer " + txtTitle.getText()) .setMessage("Voulez-vous supprimer cet utilisateur?") .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // continue with delete new DeleteUser().execute(txtTitle.getText().toString()); } }).setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // do nothing } }).setIcon(android.R.drawable.ic_dialog_alert).show(); } else { new AlertDialog.Builder(v.getContext()).setTitle("Attention") .setMessage("Opration interdite : Droits d'administration requis.").show(); } } }); return convertView; }
From source file:com.example.android.wifidirect.DeviceDetailFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { // User has picked an image. Transfer it to group owner i.e peer using // FileTransferService. Uri uri = data.getData();// w w w . ja va2 s . com TextView statusText = (TextView) mContentView.findViewById(R.id.status_text); statusText.setText("Sending: " + uri); Log.d(WiFiDirectActivity.TAG, "Intent----------- " + uri); Intent serviceIntent = new Intent(getActivity(), FileTransferService.class); serviceIntent.setAction(FileTransferService.ACTION_SEND_FILE); serviceIntent.putExtra(FileTransferService.EXTRAS_FILE_PATH, uri.toString()); serviceIntent.putExtra(FileTransferService.EXTRAS_GROUP_OWNER_ADDRESS, info.groupOwnerAddress.getHostAddress()); serviceIntent.putExtra(FileTransferService.EXTRAS_GROUP_OWNER_PORT, 8988); getActivity().startService(serviceIntent); }
From source file:com.sunho.nating.fragments.DetailUnivFragment.java
private void bindFragment(View parent) { Bundle args = getArguments();/*from www .ja va 2 s .co m*/ if (args == null) { return; } ImageView image = (ImageView) parent.findViewById(R.id.image); image.setImageResource(args.getInt(ARG_RESOURCE_ID)); TextView title = (TextView) parent.findViewById(R.id.title); title.setText(args.getString(ARG_TITLE)); listView = (ListView) parent.findViewById(R.id.list); listView.setDividerHeight(0); adapter = new CustomListAdapter(MainActivity.mActivity, placeList) { @Override public View getDataRow(int position, View convertView, ViewGroup parent) { return convertView; } }; listView.setAdapter(adapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Toast.makeText(MainActivity.mContext, placeList.get(position).getOldAddress(), 0).show(); moveFragment(position); } }); listView.setOnScrollListener(new EndlessScrollListener() { @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { super.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount); //lastListitem = (totalItemCount - 1 > 0) && (firstVisibleItem + visibleItemCount >= totalItemCount - 1); } @Override public void onLoadMore(int page, int totalItemsCount) { // Triggered only when new data needs to be appended to the list // Add whatever code is needed to append new items to your AdapterView Log.d(TAG, "==ListView Information=="); Log.d(TAG, "PageNumber : " + page); Log.d(TAG, "TotalCount : " + totalItemsCount); Log.d(TAG, "adpaterCount : " + adapter.getCount()); Log.d(TAG, "========================"); new GetDataTask().execute(); } }); new GetDataTask().execute(); }
From source file:com.glabs.homegenie.adapters.MediaRendererWidgetAdapter.java
private void _updateControlStatus() { if (_playbackstatus.equals("STOPPED")) { _module.View.findViewById(R.id.playButton).setBackgroundResource(R.drawable.ic_media_play); _module.View.findViewById(R.id.stopButton).setVisibility(View.GONE); } else if (_playbackstatus.equals("PAUSED_PLAYBACK")) { _module.View.findViewById(R.id.stopButton).setVisibility(View.VISIBLE); _module.View.findViewById(R.id.playButton).setBackgroundResource(R.drawable.ic_media_play); } else if (_playbackstatus.equals("PLAYING")) { _module.View.findViewById(R.id.stopButton).setVisibility(View.VISIBLE); _module.View.findViewById(R.id.playButton).setBackgroundResource(R.drawable.ic_media_pause); }//w w w . j a va 2 s .c o m // if (_currentmute.equals("1")) { _module.View.findViewById(R.id.muteButton) .setBackgroundResource(android.R.drawable.ic_lock_silent_mode); } else { _module.View.findViewById(R.id.muteButton) .setBackgroundResource(android.R.drawable.ic_lock_silent_mode_off); } // TextView trackuri = (TextView) _module.View.findViewById(R.id.mediaUri); TextView trackpos = (TextView) _module.View.findViewById(R.id.mediaPosition); trackuri.setText(_currenturi); trackpos.setText(_currentposition); }
From source file:com.android.browser.GearsBaseDialog.java
public void setupDialog(TextView message, ImageView icon) { message.setText(R.string.unrecognized_dialog_message); icon.setImageResource(R.drawable.ic_dialog_menu_generic); message.setVisibility(View.VISIBLE); }
From source file:com.df.kia.carsWaiting.CarsWaitingListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_cars_waiting); swipeListView = (SwipeListView) findViewById(R.id.carsWaitingList); data = new ArrayList<CarsWaitingItem>(); adapter = new CarsWaitingListAdapter(this, data, new CarsWaitingListAdapter.OnAction() { @Override//from w w w . j a v a 2s . c o m public void onEditPressed(int position) { swipeListView.openAnimate(position); } @Override public void onModifyProcedure(int positon) { CarsWaitingItem item = data.get(positon); Intent intent = new Intent(CarsWaitingListActivity.this, InputProceduresActivity.class); intent.putExtra("carId", item.getCarId()); startActivity(intent); } @Override public void onDeleteCar(final int position) { View view1 = getLayoutInflater().inflate(R.layout.popup_layout, null); TableLayout contentArea = (TableLayout) view1.findViewById(R.id.contentArea); TextView content = new TextView(view1.getContext()); content.setText(R.string.confirmDeleteCar); content.setTextSize(20f); contentArea.addView(content); setTextView(view1, R.id.title, getResources().getString(R.string.alert)); AlertDialog dialog = new AlertDialog.Builder(CarsWaitingListActivity.this).setView(view1) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { CarsWaitingItem item = data.get(position); deleteCar(item.getCarId()); } }).setNegativeButton(R.string.cancel, null).create(); dialog.show(); } }); swipeListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); swipeListView.setSwipeListViewListener(new BaseSwipeListViewListener() { @Override public void onClickFrontView(int position) { getCarDetail(data.get(position).getCarId(), CarCheckActivity.class); } @Override public void onDismiss(int[] reverseSortedPositions) { for (int position : reverseSortedPositions) { data.remove(position); } adapter.notifyDataSetChanged(); } @Override public void onStartOpen(int position, int action, boolean right) { swipeListView.closeOpenedItems(); lastPos = position; } }); swipeListView.setSwipeMode(SwipeListView.SWIPE_MODE_LEFT); swipeListView.setSwipeActionLeft(SwipeListView.SWIPE_ACTION_REVEAL); swipeListView.setLongClickable(false); swipeListView.setSwipeOpenOnLongPress(false); swipeListView.setOffsetLeft(620); swipeListView.setAnimationTime(300); swipeListView.setAdapter(adapter); footerView = ((LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE)) .inflate(R.layout.footer, null, false); swipeListView.addFooterView(footerView); Button homeButton = (Button) findViewById(R.id.buttonHome); homeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { finish(); } }); Button loadMoreButton = (Button) findViewById(R.id.loadMore); loadMoreButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { refresh(); } }); Button refreshButton = (Button) findViewById(R.id.buttonRefresh); refreshButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startNumber = 1; data.clear(); adapter.notifyDataSetChanged(); swipeListView.closeOpenedItems(); refresh(); } }); refresh(); }