I have a custom ListView adapter that uses multiple layout types. One is the built-in type here:
v = inflater.inflate(android.R.layout.simple_list_item_1, null);
How do I access the TextView on that layout? What is the ID?
TextView txt1 = (TextView) v.findViewById(***WHAT IS THE ID***);
txt1.setText("foo");
And if you know the ID, how did you find it?
It is @android:id/text1
So you need to modify your code like this
TextView txt1 = (TextView) v.findViewById(android.R.id.text1);
Found here https://github.com/android/platform_frameworks_base/blob/master/core/res/res/layout/simple_list_item_1.xml
Source code is your best friend!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With