! @Override public int getViewTypeCount() { return 2; } ViewType ? • Altering rows • Headers • Different content: Questions & Answers in 1 adapter with different views
final int position, final long id) { ! final GsonHelper<Question> gsonMarshaller = new GsonHelper<Question>(new TypeToken<Question>() { }.getType()); ! final Intent detailIntent = new Intent(this, QuestionsDetailActivity.class); detailIntent.putExtra("question", gsonMarshaller.toJson(adapter.getItem(position))); startActivity(detailIntent); } QuestionsActivity QuestionsDetailActivity
final int position, final long id) { ! final GsonHelper<Question> gsonMarshaller = new GsonHelper<Question>(new TypeToken<Question>() { }.getType()); ! final Intent detailIntent = new Intent(this, QuestionsDetailActivity.class); detailIntent.putExtra("question", gsonMarshaller.toJson(adapter.getItem(position))); startActivity(detailIntent); } QuestionsActivity QuestionsDetailActivity {! "question": "How does a number porting proceed?",! "created": "2014-04-02T08:37:43.766Z",! "modified": "2014-04-02T08:37:43.766Z",! "id": "8a558826d4a71bd2",! "answers": []! }
final int position, final long id) { ! final GsonHelper<Question> gsonMarshaller = new GsonHelper<Question>(new TypeToken<Question>() { }.getType()); ! final Intent detailIntent = new Intent(this, QuestionsDetailActivity.class); detailIntent.putExtra("question", gsonMarshaller.toJson(adapter.getItem(position))); startActivity(detailIntent); } QuestionsActivity QuestionsDetailActivity
"id": "dc86f5d2a7b1187f"! }! ]! },! {! "question": "Where can I learn Dutch or follow other lan "created": "2014-03-27T22:54:40.733Z",! "modified": "2014-03-27T22:54:40.733Z",! "id": "316333702e53187d",! "answers": [! {! "answer": "Lorum Ipsum is a simply dummy text of the pri dummy text every sinds the 1500s, when an unknown printe "created": "2014-04-01T22:12:28.357Z",! "modified": "2014-04-01T22:12:28.357Z",! "id": "8c5a3c674504c8a7"! },! {! "answer": "Yes! The first answer on this question. Thx!" "created": "2014-04-01T22:12:57.731Z",! "modified": "2014-04-01T22:12:57.731Z",! "id": "bcf257da749af86e"! }! ]! },! {! "question": "How does a number porting proceed?",! "created": "2014-04-02T08:37:43.766Z",! "modified": "2014-04-02T08:37:43.766Z",! "id": "8a558826d4a71bd2",! "answers": [! {! "answer": "When you port your number, it means that when http://kdg-inf-demo.herokuapp.com/questions