How to use setImageUri() on Android

后端 未结 7 1471
误落风尘
误落风尘 2020-12-03 21:01

Can you help me please? I\'ve tried :

ImageButton imgbt=(ImageButton)findViewById(R.id.imgbutton);
Uri imgUri=Uri.parse(\"/data/data/MYFOLDER/myimage.png\");         


        
7条回答
  •  心在旅途
    2020-12-03 21:37

    I solved it with framework. Added this line into the gradle:

    implementation 'com.facebook.fresco:fresco:1.8.0'
    

    Init singlton in application-class(or another main class in your app)

    Fresco.initialize(applicationContext)
    

    And in finish, use it.

    XML:

      
    

    Java:

    avatar.setImageURI(user.getAvatarUrl())
    

提交回复
热议问题