Opening a File from assets folder in android

前端 未结 6 1020
面向向阳花
面向向阳花 2020-12-01 14:37

I have a .gif file inside the assets folder like this assets/Files/android.gif. when I try to open the file it throws an exception at the second line

AssetM         


        
6条回答
  •  南笙
    南笙 (楼主)
    2020-12-01 15:02

    I believe the preferred way to do this is to put your image in the res/drawable directory. Then you can get a Drawable like this:

    Drawable d = Resources.getSystem().getDrawable(R.drawable.android);
    

提交回复
热议问题