Description
Hi, I am a newbie at this so, please help me.
For my project, I need to access images (present in the folder named "assets") in native code(Android code) in flutter so that i can set it as my phone wallpaper.
I have used assetsmanager to access the file but it is showing me that it can't find any file. Below is the code snippet.
I also added the image in pubspec.yaml under assets.
WallpaperManager wm = null;
wm = WallpaperManager.getInstance(this);
try{
AssetManager assetManager = getAssets();
InputStream is = assetManager.open("assets/wall3.jpg");
Bitmap bitmap = BitmapFactory.decodeStream(is);
wm.setBitmap(bitmap);
}
catch (IOException e){
System.out.println("Exception occurred - 1");
System.out.println(e);
}
Where are these files stored.(Ex: /assets/image1.jpg or somewhere else)