hi,
i have got some problem that whenever i scroll down my list view to the most bottom it crashed and was being asked to forced close. below is my code. can anyone help me with it. cant figure it out what happen because there was no error called when running the program.
is there a limit to the number of items placed in it?
thousand thanks in advance
i have got some problem that whenever i scroll down my list view to the most bottom it crashed and was being asked to forced close. below is my code. can anyone help me with it. cant figure it out what happen because there was no error called when running the program.
is there a limit to the number of items placed in it?
thousand thanks in advance
Code:
package com.Z;
import com.Z.R;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
public class modulestudied extends Activity {
/** Called when the activity is first created. */
ListView listView;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.modulestudied);
Button buttonHomeView = (Button)findViewById(R.id.buttonHomeView);
buttonHomeView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(modulestudied.this, homeview.class);
startActivity(intent);
}
});
listView = (ListView) findViewById(R.id.lv_module);
listView.setAdapter(new EfficientAdapter(this));
}
private static class EfficientAdapter extends BaseAdapter {
private LayoutInflater mInflater;
public EfficientAdapter(Context context) {
mInflater = LayoutInflater.from(context);
}
public int getCount() {
return modulestudied2.code.length;
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.two_col_row, null);
holder = new ViewHolder();
holder.text1 = (TextView) convertView
.findViewById(R.id.TextView01);
holder.text2 = (TextView) convertView
.findViewById(R.id.TextView02);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.text1.setText(modulestudied2.code[position]);
holder.text2.setText(modulestudied2.modulename[position]);
return convertView;
}
static class ViewHolder {
TextView text1;
TextView text2;
}
}
}