0
What is the significance of creating new view inside b1.setonclicklistener?
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); progress = new ProgressDialog(this); b1=(Button)findViewById(R.id.button); b2=(Button)findViewById(R.id.button2); b1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { TextView txtView = (TextView) findViewById(R.id.textView); txtView.setTextSize(25); } });
1 Answer
+ 9
This txtView will become local variable. If you want to make global it then you can declare it above setOnclickListener().