Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- JSONArray tasks = obj.getJSONArray("activities");
- Map<Integer, List<Task>> childs = Parser.parseActivitiesIntoGroups(tasks.toString());
- final TodoAdapter adapter = new TodoAdapter(getActivity(), groups, childs);
- list.setAdapter(adapter);
- list.setOnChildClickListener(new OnChildClickListener() {
- @Override
- public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
- Adapter a = parent.getAdapter();
- Task task = (Task) ((TodoAdapter) parent.getExpandableListAdapter()).getChild(groupPosition, childPosition);
- Intent intent = new Intent(getActivity(), TodoTaskEditActivity.class);
- intent.putExtra(INTENT_TASK, task);
- startActivity(intent);
- return true;
- }
- });
- public void onCreate(Bundle savedInstanceState) {
- Intent intent = getIntent();
- if (intent != null) {
- Task task = intent.getParcelableExtra(TodoFragment.INTENT_TASK);
- //This is fine and task has the proper values
- if (task != null) {
- //it enters this way
- date.setText(format.format(task.ActivityDate));
- ... //set a lot of edittexts, etc
- } else {
- ... //set some default values in edittexts, etc
- }
- }
- //at this point task is already null
- date.setOnClickListener(new OnClickListener() {
- ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement