Tabnine Logo
TextView.setText
Code IndexAdd Tabnine to your IDE (free)

How to use
setText
method
in
android.widget.TextView

Best Java code snippets using android.widget.TextView.setText (Showing top 20 results out of 41,292)

Refine searchRefine arrow

  • View.findViewById
  • LayoutInflater.inflate
  • TextView.<init>
  • Button.setOnClickListener
  • View.OnClickListener.<init>
  • ImageView.setImageResource
  • TextView.setLayoutParams
  • LinearLayout.addView
  • ArrayList.<init>
origin: scwang90/SmartRefreshLayout

protected TextView createMaskView(Context context, String text, int textSize, int gravity) {
  final TextView maskView = new TextView(context);
  maskView.setTextColor(Color.BLACK);
  maskView.setGravity(gravity | Gravity.CENTER_HORIZONTAL);
  maskView.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
  maskView.setText(text);
  //noinspection UnnecessaryLocalVariable
  final View view = maskView;
  view.setBackgroundColor(Color.WHITE);
  return maskView;
}
origin: stackoverflow.com

 TextView textView = new TextView(this);
textView.setText(R.string.register);
origin: stackoverflow.com

 private void updateView(int index){
  View v = yourListView.getChildAt(index - 
    yourListView.getFirstVisiblePosition());

  if(v == null)
    return;

  TextView someText = (TextView) v.findViewById(R.id.sometextview);
  someText.setText("Hi! I updated you manually!");
}
origin: stackoverflow.com

 AlertDialog.Builder builder;
AlertDialog alertDialog;

Context mContext = getApplicationContext();
LayoutInflater inflater = (LayoutInflater)
    mContext.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.custom_dialog,
    (ViewGroup) findViewById(R.id.layout_root));

TextView text = (TextView) layout.findViewById(R.id.text);
text.setText("Hello, this is a custom dialog!");
ImageView image = (ImageView) layout.findViewById(R.id.image);
image.setImageResource(R.drawable.android);

builder = new AlertDialog.Builder(mContext);
builder.setView(layout);
alertDialog = builder.create();
origin: cSploit/android

mScanReceiver = new ScanReceiver();
mConnectionReceiver = new ConnectionReceiver();
mStatusText = (TextView) v.findViewById(R.id.scanStatusText);
mAdapter = new ScanAdapter();
mKeyList = new ArrayList<>();
mStatusText.setText( getString(R.string.wifi_initializing) );
  mStatusText.setText( getString(R.string.wifi_activating_iface) );
  mWifiManager.setWifiEnabled(true);
  mStatusText.setText(getString(R.string.wifi_activated));
mStatusText.setText( getString(R.string.wifi_scanning) );
mScanning = true;
origin: stackoverflow.com

  intent.putParcelableArrayListExtra("files", new ArrayList<File>(Arrays.asList(files)));
  startService(intent);
bar.setProgress(file.progress);
TextView tv = (TextView) v.findViewById(R.id.textView);
tv.setText(file.toString());
v.findViewById(R.id.cancel).setOnClickListener(new View.OnClickListener() {
  @Override
  public void onClick(View v) {
  mEcs = new ExecutorCompletionService<NoResultType>(mExec);
  mBroadcastManager = LocalBroadcastManager.getInstance(this);
  mTasks = new ArrayList<MainActivity.DownloadingService.DownloadTask>();
origin: stackoverflow.com

 LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = vi.inflate(R.layout.your_layout, null);

// fill in any details dynamically here
TextView textView = (TextView) v.findViewById(R.id.a_text_view);
textView.setText("your text");

// insert into main view
ViewGroup insertPoint = (ViewGroup) findViewById(R.id.insert_point);
insertPoint.addView(v, 0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
origin: stackoverflow.com

 import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class FirstActivity extends RootActivity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    TextView tv = (TextView) findViewById(R.id.tvTitle);
    tv.setText("First Activity");
    Button bt = (Button) findViewById(R.id.buttonNext);
    bt.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        Intent i = new Intent(FirstActivity.this, SecondActivity.class);
        startActivity(i);

      }
    });
  }

}
origin: TeamNewPipe/NewPipe

private View addItemView(final String title, @DrawableRes final int icon, ViewGroup container) {
  final View itemRoot = View.inflate(getContext(), R.layout.subscription_import_export_item, null);
  final TextView titleView = itemRoot.findViewById(android.R.id.text1);
  final ImageView iconView = itemRoot.findViewById(android.R.id.icon1);
  titleView.setText(title);
  iconView.setImageResource(icon);
  container.addView(itemRoot);
  return itemRoot;
}
origin: vinc3m1/RoundedImageView

 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
  ViewGroup view;
  if (convertView == null) {
   view = (ViewGroup) mInflater.inflate(R.layout.rounded_item, parent, false);
  } else {
   view = (ViewGroup) convertView;
  }
  ColorItem item = getItem(position);
  ((ImageView) view.findViewById(R.id.imageView1)).setImageResource(item.mResId);
  ((ImageView) view.findViewById(R.id.imageView1)).setScaleType(item.mScaleType);
  ((TextView) view.findViewById(R.id.textView1)).setText(item.mLine1);
  ((TextView) view.findViewById(R.id.textView2)).setText(item.mLine2);
  ((TextView) view.findViewById(R.id.textView3)).setText(item.mScaleType.toString());
  return view;
 }
}
origin: stackoverflow.com

 LayoutParams lparams = new LayoutParams(
  LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
TextView tv=new TextView(this);
tv.setLayoutParams(lparams);
tv.setText("test");
this.m_vwJokeLayout.addView(tv);
origin: stackoverflow.com

 TableLayout table = new TableLayout(this);
TableRow tr = new TableRow(this);
tr.setBackgroundColor(Color.BLACK);
tr.setPadding(0, 0, 0, 2); //Border between rows

TableRow.LayoutParams llp = new TableRow.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
llp.setMargins(0, 0, 2, 0);//2px right-margin

//New Cell
LinearLayout cell = new LinearLayout(this);
cell.setBackgroundColor(Color.WHITE);
cell.setLayoutParams(llp);//2px border on the right for the cell


TextView tv = new TextView(this);
tv.setText("Some Text");
tv.setPadding(0, 0, 4, 3);

cell.addView(tv);
tr.addView(cell);
//add as many cells you want to a row, using the same approach

table.addView(tr);
origin: square/picasso

 @Override public View getView(int position, View convertView, ViewGroup parent) {
  TextView view = (TextView) convertView;
  if (view == null) {
   view = (TextView) inflater.inflate(R.layout.picasso_sample_activity_item, parent, false);
  }

  view.setText(getItem(position).name);

  return view;
 }
}
origin: stackoverflow.com

TextView txtName = (TextView) convertView.findViewById(R.id.nameEdit);
txtName.setText(score.getName());
Button b = (Button)convertView.findViewById(R.id.deletePlayer);
b.setTag(position);
b.setOnClickListener(new View.OnClickListener() {
     public void onClick(View v) {
origin: stackoverflow.com

findViewById(R.id.btn_back).setOnClickListener(new View.OnClickListener() {
  @Override
  public void onClick(View v) {
findViewById(R.id.btn_forward).setOnClickListener(new View.OnClickListener() {
  @Override
  public void onClick(View v) {
if(text != null) mTextView.setText(text);
origin: stackoverflow.com

public View getView(int position, View convertView, ViewGroup parent){
   // TODO Auto-generated method stub
   View v;
   if(convertView==null)
   {
     LayoutInflater li = getLayoutInflater();
     v = li.inflate(R.layout.icontext, null);
   }else{
     v = convertView;
   }
   TextView tv = (TextView)v.findViewById(R.id.icon_text);
   tv.setText(providers[position]);
   ImageView iv = (ImageView)v.findViewById(R.id.icon_image);
   iv.setImageResource(R.drawable.icon);
   return v;
 }
origin: H07000223/FlycoTabLayout

  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fr_simple_card, null);
    TextView card_title_tv = (TextView) v.findViewById(R.id.card_title_tv);
    card_title_tv.setText(mTitle);

    return v;
  }
}
origin: hackware1993/MagicIndicator

@Override
public Object instantiateItem(ViewGroup container, int position) {
  TextView textView = new TextView(container.getContext());
  textView.setText(mDataList.get(position));
  textView.setGravity(Gravity.CENTER);
  textView.setTextColor(Color.BLACK);
  textView.setTextSize(24);
  container.addView(textView);
  return textView;
}
origin: stackoverflow.com

 import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class SecondActivity extends RootActivity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    TextView tv = (TextView) findViewById(R.id.tvTitle);
    tv.setText("Second Activity");
    Button bt = (Button) findViewById(R.id.buttonNext);
    bt.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        Intent i = new Intent(SecondActivity.this, ThirdActivity.class);
        startActivity(i);

      }
    });

  }

}
origin: chentao0707/SimplifyReader

public void showNetworkError(View.OnClickListener onClickListener) {
  View layout = helper.inflate(R.layout.message);
  TextView textView = (TextView) layout.findViewById(R.id.message_info);
  textView.setText(helper.getContext().getResources().getString(R.string.common_no_network_msg));
  ImageView imageView = (ImageView) layout.findViewById(R.id.message_icon);
  imageView.setImageResource(R.drawable.ic_exception);
  if (null != onClickListener) {
    layout.setOnClickListener(onClickListener);
  }
  helper.showLayout(layout);
}
android.widgetTextViewsetText

Popular methods of TextView

  • setTextColor
  • setVisibility
  • setOnClickListener
  • getText
  • <init>
  • setTextSize
  • setGravity
  • setTypeface
  • setLayoutParams
  • setPadding
  • setMovementMethod
  • setBackgroundColor
  • setMovementMethod,
  • setBackgroundColor,
  • setBackgroundResource,
  • getContext,
  • getVisibility,
  • setSingleLine,
  • getPaint,
  • setCompoundDrawablesWithIntrinsicBounds,
  • setEnabled

Popular in Java

  • Reactive rest calls using spring rest template
  • getSharedPreferences (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • startActivity (Activity)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now