I want to make a timetable app for the buses of my city. But, my code is too long. I have a MyAdapter
class but as each bus line needs a different adapter my code started to seem like this:
MyAdapter list1 = new MyAdapter<String>(this,
android.R.layout.simple_list_item_1, R.id.timelist, List1);
MyAdapter list2 = new MyAdapter<String>(this,
android.R.layout.simple_list_item_1, R.id.timelist, List2);
MyAdapter list3 = new MyAdapter<String>(this,
android.R.layout.simple_list_item_1, R.id.timelist, List3);
// ...
And for each of this I have:
setAdapter(listx);
in regular places. Is there any easier way to write MyAdapter
object which will need less copy-paste things? (I cannot call that a code.)