public View getView(int position, View convertView, ViewGroup parent) { View v; if (convertView == null) { v = LayoutInflater.from(getApplicationContext()).inflate(R.layout.row, null); } else { v = convertView; } // later: return v; }
Do that in one line!
View v = convertView != null? convertView: LayoutInflater.from(getApplicationContext()).inflate(R.layout.row, null);
This seems easy but at first I didn't think of that!
No comments:
Post a Comment