Android get image path from drawable as string

前端 未结 5 595
天涯浪人
天涯浪人 2020-12-04 19:15

Is there any way that I can get the image path from drawable folder in android as String. I need this because I implement my own viewflow where I\'m showing the images by us

5条回答
  •  萌比男神i
    2020-12-04 20:15

    I think you cannot get it as String but you can get it as int by get resource id:

    int resId = this.getResources().getIdentifier("imageNameHere", "drawable", this.getPackageName());
    

提交回复
热议问题