更新时间:2022-12-26 18:44:27
我现在看到您的代码类似于 DownloadRandomPicture.java 中的代码.
I now see that your code is like in DownloadRandomPicture.java.
字符串 fnames [] = null;
String fnames [] = null;
在 doOnBackGround() 中:
In doOnBackGround():
ArrayList<String> filenames = new ArrayList<String>();
for (Entry ent: dirent.contents) {
if (ent.thumbExists) {
filenames.add(ent.path);
}
}
fnames = filenames.toArray(new String[filenames.size()]);
在 onPostExecute() 中:
in onPostExecute():
if ( fnames != null )
{
ArrayAdapter<String> array = new ArrayAdapter<String>(mContext, android.R.layout.simple_list_item_1, fnames);
listView1.setAdapter(array);
}
else
showToast ( "fnames==null" );