Android 无法使用毕加索从资产文件夹加载图像
我曾尝试与毕加索从资产文件夹加载图像 下面是java代码Android 无法使用毕加索从资产文件夹加载图像,android,picasso,Android,Picasso,我曾尝试与毕加索从资产文件夹加载图像 下面是java代码 protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_frame); getFilesList(); ivMain = (ImageView) findViewById(R.id.ivMain
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_frame);
getFilesList();
ivMain = (ImageView) findViewById(R.id.ivMain);
Picasso.with(MainFrameActivity.this)
.load("file:///android_asset/" + files.get(0)).into(ivMain);
}
private void getFilesList() {
try {
files = new ArrayList<String>();
String f[] = getAssets().list("");
for (String f1 : f) {
if (f1.endsWith(".png")) {
System.out.println(f1);
files.add(f1);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
但是它没有加载到ivMain中,有人有解决方案吗?在
文件中得到什么字符串。get(0)
?a.png----它是返回文件名以访问资产
文件夹中的文件使用AssetManager.list()
和AssetManager.open(…)
02-10 23:04:16.229: I/System.out(5863): a1_big.png
02-10 23:04:16.229: I/System.out(5863): a_big.png
02-10 23:04:16.229: I/System.out(5863): b1_big.png
02-10 23:04:16.229: I/System.out(5863): b_big.png
02-10 23:04:16.229: I/System.out(5863): c1_big.png
02-10 23:04:16.229: I/System.out(5863): c_big.png
02-10 23:04:16.229: I/System.out(5863): d1_big.png
02-10 23:04:16.229: I/System.out(5863): d_big.png
02-10 23:04:16.229: I/System.out(5863): e1_big.png
02-10 23:04:16.229: I/System.out(5863): e_big.png
02-10 23:04:16.229: I/System.out(5863): f1_big.png
02-10 23:04:16.229: I/System.out(5863): f_big.png
02-10 23:04:16.229: I/System.out(5863): g1_big.png
02-10 23:04:16.229: I/System.out(5863): g_big.png
02-10 23:04:16.229: I/System.out(5863): h1_big.png
02-10 23:04:16.229: I/System.out(5863): h_big.png