+ 1

Can someone tell me the difference between two scenarios

Case 1: private TextView textview; public class a { .... textview = findViewById (R.id.textview); ..... } Case 2: public class a { TextView textview = findViewById (R.id.textview); } The textview is present within a ListView

26th Aug 2019, 5:43 AM
Ghost rider
1 Answer
+ 1
The first case you created a global reference to a textview, so you can use it in any part of the class. The second case I'd a local reference you can only use it locally.
9th Sep 2019, 1:06 PM
Diogo
Diogo - avatar