My custom listview is showing empty rows but when i use logcat to display the data it shows that the data is all there in my arraylist...how do i make the listview show my arraylist items?
public class Myarrayadapter extends ArrayAdapter<String> {
Context context;
ArrayList<String> values;
int resid;
public Myarrayadapter(Context context, int resid, ArrayList<String> values) {
super(context, resid, values);
this.resid = resid;
this.context = context;
this.values = values;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(resid, parent, false);
return rowView;
}
}
CLASSS HERE ////////////////////////////////////////////
final ListView HomeListView = (ListView) findViewById(R.id.HomeListView);
String[] filelist = fileList();
ArrayList<String> fileList = new ArrayList<String>();
for (int i=0; i < filelist.length; i++) {//displays only first half of job number
String[] stemp = filelist[i].split("\\.");
if(!fileList.contains(stemp[0])) {//makes sure only one job number is show in the list
fileList.add(stemp[0]);
}
}
Collections.reverse(fileList);
Myarrayadapter listAdapter = new Myarrayadapter(this, R.layout.homelistview, fileList);
HomeListView.setAdapter(listAdapter);
HomeListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//get the clicked items job no. and pass it to the next activity which will display all relevant jobs
Intent detailedlist_intent = new Intent(Home.this, Home2.class);
detailedlist_intent.putExtra("Jobno", HomeListView.getItemAtPosition(position).toString());
startActivity(detailedlist_intent);
}
});