I extend the ArrayAdapter
class that have getView(...)
method. Inside it I write something like this:
public class MyArrayAdapter<T> extends ArrayAdapter<String> {
...
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = inflater.inflate(R.layout.my_layout, null);
}
// ...
// LOTS of findViewById, onClickListeners, runOnUiThread methods etc.
// ...
return v;
}
...
}
So, using AndroidAnnotations
in Activity
I can easily implement findViewById
, listeners
etc.
But how can I do it in this case, when extending ArrayAdapter
, using AndroidAnnotations
(or maybe any other framework that will not make spaghetti code).
Check this following link:
https://github.com/excilys/androidannotations/wiki/Adapters-and-lists
This should explain how to use Adapters with Androidannotations