mardi 18 octobre 2016

Decouple the View and Logic in building custom views

Where I am lost is the pattern that I think I am locked into. I cannot have the initializations in the loop , yet the design of the header forces me to have them specifically set to "get(0)/get(i)". Any I assume its due to the issues with a list view arch. but I am kind of lost on how this could be used.

View getCustomView(){
View header = getLayoutInflater().inflate(R.layout.custom_header, null);

Model modelObj = toDoListItems.get(0)  // but I want a loop so this will be i
View nextToDo = header.findViewById(R.id.item_one);

// more stuff 

return header;
}


// WHAT I want is 
//
//      for (int i = 0;i < toDoListItems.size(); i++){
//
//          modelObj = modelObj.get(i);
//          nextToDo = header.findViewById(R.id.item_upcoming_two);
//          // More Stuff
//
//      }

Aucun commentaire:

Enregistrer un commentaire