0
Image를 Universal Image Loader가있는 GridView에 표시하고 있습니다. 이미지는 데이터베이스에서 가져온 것입니다. 필요한 경우 데이터베이스에서 사진을 삭제하기위한 상황에 맞는 메뉴를 추가했습니다. 모든 것은 잘 작동합니다. 사진을 삭제 한 후 뷰를 새로 고쳐야하지만 삭제 된 사진이 계속 표시됩니다. (나는 UIL에 대한 기본 설정을 사용하고 캐싱을 사용하지 않았다.) 이미지를 다시 쿼리하기 위해 async 작업을 호출하고 imageloader에 destroy 및 init 호출을 시도했지만 파일을 찾을 수 없다는 오류 메시지를 표시한다.). 여기 내 (긴) 코드입니다. 아무도 내가 누락 된 것을 볼 수 있습니까?삭제 후 Universal Image Loader에서 Gridview를 새로 고치려고합니다.
GridView gridview;
AdapterContextMenuInfo info;
ImageLoaderConfiguration config;
ImageView imageView;
ArrayList<String> pictures = new ArrayList<String>();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ac_image_grid);
config = new ImageLoaderConfiguration.Builder(this).build();
imgLoader = ImageLoader.getInstance();
imgLoader.init(config);
class getalbum extends AsyncTask<String, String, String> {
//pre execute here
@Override
protected String doInBackground(String... args) {
int success;
try {
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("username", restoredemail));
params.add(new BasicNameValuePair("album_name", album_name));
json = jsonParser.makeHttpRequest(LOGIN_URL, "POST", params);
success = json.getInt(TAG_SUCCESS);
if (success == 1) {
mPictures = json.getJSONArray(TAG_POSTS);
// looping through all posts according to the json object
// returned
for (int i = 0; i < mPictures.length(); i++) {
JSONObject c = mPictures.getJSONObject(i);
String dir = c.getString("dir");
String album = c.getString("album");
String pic = c.getString("photo");
String picture = thecompletedpicture;
pictures.add(picture);
}
return json.getString(TAG_MESSAGE);
} else {
Log.d("Login Failure!", json.getString(TAG_MESSAGE));
return json.getString(TAG_MESSAGE);
}
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
protected void onPostExecute(String file_url) {
pDialog.dismiss();
setpictures();
}
}
private void setpictures() {
// TODO Auto-generated method stub
gridview = (GridView) findViewById(R.id.gridview);
gridview.setAdapter(new ImageAdapter(this, pictures));
registerForContextMenu(gridview);
gridview.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
startImagePagerActivity(position);
}
});
}
// and then finally the context menu makes
// an async thread to delete the picture and
// remove it from the database. On the
// post execute I put the call to load the pictures again
// This is where the problem is. I need it to just display
// the remaining pictures. Maybe trying to remove the deleted
// picture from the array and then reloading it? I really need
// help with the code.
protected void onPostExecute(String file_url) {
// dismiss the dialog once product deleted
pDialog.dismiss();
imgLoader.destroy();
imgLoader.init(config);
new getalbum().execute();
}
좋아, 아직 나에게 같은 오류 E /하여 ImageLoader (31,336) 제공한다 : java.io.FileNotFoundException : HTTP : // WWW를. 내 사이트/업로드/20131007_085815.jpg 10-07 09 : 00 : 18.528 : E /하여 ImageLoader (31336) : libcore.net.http.HttpURLConnectionImpl.getInputStream에서 \t은 (HttpURLConnectionImpl.java:177) 나는 또한이 잎 발견 그림이 있던 빈 공간과 다른 모든 그림들을 중복시킨다. 나는 Gridview가 싫어. – JeffK