我正在使用sdcard在gridview中显示图像缩略图,当我点击图像时,我想开始一个新活动并以全屏显示图像。但我面临一个问题,即活动没有开始?我发布我的代码和logcat希望任何人都可以提前帮助谢谢..
getFromSdcard(parent, child);
for (int i = 0; i < f.size(); i++) {
Cursor desc = sql.fetchCatImageDesc(f.get(i).substring(
f.get(i).lastIndexOf("/") + 1));
while (desc.moveToNext()) {
itemname = desc.getString(desc
.getColumnIndexOrThrow(Image_Sql.ITEM_NAME));
}
image.add(new Image(bit.get(i), itemname));
}
adapter = new MyAdapter(this.getActivity(), image);
gv.setAdapter(adapter);
gv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
Cursor desc = sql.fetchCatImageDesc(compare.get(arg2));
while (desc.moveToNext()) {
description = desc.getString(desc
.getColumnIndexOrThrow(Image_Sql.IMAGE_DESCRIPTION));
}
Intent intent= new Intent(getActivity(),FullImageActivity.class);
Bitmap bitmap = bit.get(arg2);
intent.putExtra("image", bitmap);
Bundle bundle = new Bundle();
bundle.putString("title", compare.get(arg2));
bundle.putString("desc", description);
bundle.putString("cat", parent);
bundle.putString("subcat", child);
intent.putExtras(bundle);
startActivity(intent);
}
});
}
public void getFromSdcard(String parent, String child) {
File file;
try {
File[] listFile;
if (!child.equals("")) {
file = new File(
android.os.Environment.getExternalStorageDirectory(),
"ldapps/admin/" + parent + "/" + child + "/.NoMedia");
} else {
file = new File(
android.os.Environment.getExternalStorageDirectory(),
"ldapps/admin/" + parent + "/.NoMedia");
}
Bitmap bitmap;
Cursor image = sql.fetchCategorySubImage(parent, child);
while (image.moveToNext()) {
String name = image.getString(image
.getColumnIndexOrThrow(Image_Sql.IMAGE_NAME));
compare.add(name);
}
if (file.isDirectory()) {
listFile = file.listFiles();
for (int i = 0; i < listFile.length; i++) {
for (int j = 0; j < compare.size(); j++) {
if (compare
.get(j)
.toString()
.equals(listFile[i].getAbsolutePath()
.substring(
listFile[i].getAbsolutePath()
.lastIndexOf("/") + 1))) {
f.add(listFile[i].getAbsolutePath());
bitmap = convertBitmap(listFile[i]
.getAbsolutePath());
bit.add(bitmap);
}
}
}
}
} catch (Exception e) {
Dialog d = new Dialog(getActivity());
TextView tv = new TextView(getActivity());
tv.setText(e.toString());
d.setTitle(e.toString());
d.setContentView(tv);
d.show();
}
}
Logcat就是这个......
09-04 06:04:37.843: E/JavaBinder(2833): !!! FAILED BINDER TRANSACTION !!!