코드를 넣으려면 다시 onResume()
메서드를 넣고 탭 클릭으로 다시로드 할 때마다이 메서드를 실행해야하지만 문제는 이제 데이터가 처음으로로드됩니다. 탭에서 처음 클릭 할 때 목록보기로 서버에서 탭을 변경하고 다시로드 할 때 강제로 닫고 강제로 "배열 인덱스가 바운드 예외"가됩니다. 그것은 이전에로드 된 데이터를 제거하지 않기 때문에 제거하거나 탭 클릭에 새 데이터를 다시로드하는 방법 그래서 예외가 발생하지 않는 것 같아요? 이전 데이터를 삭제하는 방법은 onResume()
을 통해 새 데이터를로드하기 전에 의미합니까?보기에서 "ontabchange()"탭을 변경할 때 onresume() 메서드를 실행하십시오.
보호 된 void onPause() { super.onPause();
}
protected void onResume()
{
super.onResume();
**new ProgressTask6().execute();**
}
private class ProgressTask6 extends AsyncTask<String, Void, Boolean> {
private ProgressDialog dialog;
private Context context;
@Override
protected void onPreExecute() {
dialog = new ProgressDialog(OpeningToday.this);
dialog.setMessage("Processing...");
dialog.setIndeterminate(true);
dialog.setCancelable(false);
dialog.show();
}
@Override
protected void onPostExecute(final Boolean success) {
if (dialog.isShowing())
{
dialog.dismiss();
setListAdapter(new MyAdapter(OpeningToday.this));
}
}
@Override
protected Boolean doInBackground(String... args) {
try{
} catch (Exception e){
Log.e("tag", "error", e);
return false;
}
return null;
}
class MyAdapter extends BaseAdapter implements OnClickListener
{
}
@Override
public int getCount() {
} }
/* Not implemented but not really needed */
@Override
public Object getItem(int position) {
return null;
}
/* Not implemented but not really needed */
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View ConvertView, ViewGroup parent)
{
View v = inflater.inflate(R.layout.listitem_layout, parent, false);
// Log.i("array galoijewdh..",keywordresulttab.array_galleryname[position]);
Log.i("saurabh trivedi","saurabh trivedui");
// Variables.a=3;
String gallerynames = keywordresulttab.array_galleryname[position];
String addresses = keywordresulttab.array_address[position];
TextView tv = (TextView) v.findViewById(R.id.barrio);
tv.setText(gallerynames);
tv = (TextView) v.findViewById(R.id.ciudad);
tv.setText(addresses);
((BaseAdapter)(getListAdapter())).notifyDataSetChanged();
return v;
}
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
}
}
사이트 목록이란 무엇입니까? 파싱 된 데이터를 저장하는 목록입니까? –
클래스 내 getter 및 setter metho 있고 가변 데이터를 저장하기위한 배열 목록을 사용합니다 .. 더 아래에 내 qus 일부로 이동합니다 또한 사이트 목록 클래스를 추가했습니다 – SRam