コード例 #1
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_chapter, container, false);

    DatabaseSubject dbHandler = new DatabaseSubject(getActivity(), null, null, 1);
    cursor = dbHandler.getSubjects();
    adapter = new SubjectListAdapter(getActivity(), cursor, 0, this);
    ListView listView = (ListView) view.findViewById(R.id.listView);
    listView.setAdapter(adapter);
    return view;
  }
コード例 #2
0
 @Override
 public void onMethodCallback(int call, String pClass) {
   switch (call) {
     case 0:
       DatabaseSubject db = new DatabaseSubject(getActivity(), null, null, 1);
       adapter.changeCursor(db.getSubjects());
       adapter.notifyDataSetChanged();
       break;
     case 1:
       mCall.chapterCallMethod(pClass);
       break;
     case 2:
       DialogFragment dialogFragment = new EditSubjectDialogFragment();
       Bundle args = new Bundle();
       args.putString("name", pClass);
       dialogFragment.setArguments(args);
       dialogFragment.show(getActivity().getFragmentManager(), "dialog");
       break;
   }
 }