-5

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

enter image description here

boy_v
  • 547
  • 3
  • 8
  • 23

2 Answers2

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

No need to cast the result of findViewById?

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);