I need to use Picasso with ImageView but . I can't bind or access image view on fragment it's return redundant . Pls Help Thank You
Asked
Active
Viewed 242 times
2 Answers
3
Find the solution
Above or equal to API 26 onwards no need to cast any view
Imageview img = rootView.findViewById(R.id.imgView);
If your using below API 26 you should cast view
Imageview img = (ImageView)rootView.findViewById(R.id.imgView);
For more info, please find the below link

Rajasekhar Reddy
- 159
- 4
0
Starting with API 26, findViewById
uses inference for its return type, so you no longer have to cast.
<T extends View> T findViewById(int id)
old signature for Before API level 26
public View findViewById(int id){
}
new signature for starting from API level 26
public <T extends View > T findViewById(int id){
}
Redundant means extra or unnecessary it is just
warning
and it says that no need to casting
try like this
Imageview img = rootView.findViewById(R.id.imgView);

Pritesh - ɐʎıɥpɐΛ ɥsǝʇᴉɹꓒ
- 758
- 1
- 6
- 19