Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. JSONArray tasks = obj.getJSONArray("activities");
  2.  
  3. Map<Integer, List<Task>> childs = Parser.parseActivitiesIntoGroups(tasks.toString());
  4.  
  5. final TodoAdapter adapter = new TodoAdapter(getActivity(), groups, childs);
  6. list.setAdapter(adapter);
  7. list.setOnChildClickListener(new OnChildClickListener() {
  8. @Override
  9. public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
  10. Adapter a = parent.getAdapter();
  11. Task task = (Task) ((TodoAdapter) parent.getExpandableListAdapter()).getChild(groupPosition, childPosition);
  12.  
  13. Intent intent = new Intent(getActivity(), TodoTaskEditActivity.class);
  14. intent.putExtra(INTENT_TASK, task);
  15. startActivity(intent);
  16.  
  17. return true;
  18. }
  19. });
  20.  
  21. public void onCreate(Bundle savedInstanceState) {
  22. Intent intent = getIntent();
  23. if (intent != null) {
  24. Task task = intent.getParcelableExtra(TodoFragment.INTENT_TASK);
  25. //This is fine and task has the proper values
  26. if (task != null) {
  27. //it enters this way
  28. date.setText(format.format(task.ActivityDate));
  29. ... //set a lot of edittexts, etc
  30. } else {
  31. ... //set some default values in edittexts, etc
  32. }
  33. }
  34.  
  35. //at this point task is already null
  36. date.setOnClickListener(new OnClickListener() {
  37. ...
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement