すばやくスクロールするListview
と、アプリは Fatal Exception をスローしますOutofMemoryError
。
スクロール中に常に同じエラーが発生します。対処方法は?
public class UpcomingAdapter extends BaseAdapter{
Typeface typeFace;
private ArrayList<String> mEventName,mDate,mTime;
private LayoutInflater mInflater;
public UpcomingAdapter(LayoutInflater mInflater,
ArrayList<String> mDEventName,
ArrayList<String> mDdate,
ArrayList<String> mDtime,
Typeface typeface)
{
this.mEventName=mDEventName;
this.mDate=mDdate;
this.mTime=mDtime;
this.mInflater=mInflater;
this.typeFace=typeface;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return 0;
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
@Override
public View getView(int arg0, View view, ViewGroup parent) {
ViewHolder holder = null;
if(view==null) {
holder=new ViewHolder();
view=mInflater.inflate(R.layout.upcomingevent_list,null);
view.setTag(holder);
holder=(ViewHolder) view.getTag();
holder.holderDate=(TextView)view.findViewById(R.id.xTvUpcomingEvents_DateList);
holder.holderEventName=(TextView)view.findViewById(R.id.xTvUpcomingEvents_Events);
holder.holderEventName.setTypeface(typeFace);
holder.holderDate.setTypeface(typeFace);
} else {
holder=(ViewHolder) view.getTag();
}
//holder.employeeName.setTag(mEmpIds.get(arg0));
setText(mEventName.get(arg0), holder.holderEventName);
setText(mDate.get(arg0), holder.holderDate);
setText(mTime.get(arg0), holder.holderEventName);
holder.holderEventName.setTag(mEventName.get(arg0));
holder.holderEventName.setTypeface(typeFace);
//holder.holderArtistId.setTypeface(typeFace);
return view;
}
public static class ViewHolder{
TextView holderEventName;
TextView holderDate;
//TextView holderArtistId;
}
private void setText(String data,TextView view){
if(data.equals(StaticUtils.sNullString)){
view.setText(StaticUtils.sEmptyString);
} else {
view.setText(data);
}
}
}
これはエラーです:
08-17 15:08:22.950: E/AndroidRuntime(25423): FATAL EXCEPTION: main
08-17 15:08:22.950: E/AndroidRuntime(25423): java.lang.OutOfMemoryError: [memory exhausted]
08-17 15:08:22.950: E/AndroidRuntime(25423): at dalvik.system.NativeStart.main(Native Method)