@Override public View onCreateView( LayoutInflater inflater, ViewGroup container2, Bundle savedInstanceState) { // Inflate the layout for this fragment // return inflater.inflate(R.layout.fragment_weekly_tasks, container2, false); View v = inflater.inflate(R.layout.fragment_weekly_tasks, container2, false); FloatingActionButton fab = (FloatingActionButton) v.findViewById(R.id.fabWeekly); fab.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { getActivity().finish(); Intent intent = new Intent(getActivity().getApplicationContext(), CreateWeeklyActivity.class); startActivity(intent); Snackbar.make(view, "New Task", Snackbar.LENGTH_LONG).setAction("Action", null).show(); } }); mDate = new Database(getActivity()); // ListView listView = (ListView) v.findViewById(R.id.list); // String List; TextView textView = (TextView) v.findViewById(R.id.textView4); // mCatList = new ArrayList<String>(List); // HashMap<String, Object> hm; String a = ""; List<WeeklyTD> weeklyTDList = mDate.getAllWeeklyTasks(); for (WeeklyTD cn : weeklyTDList) { a = a + cn.getName() + cn.getDescription(); } textView.setText(a); // for(WeeklyTD cn : weeklyTDList){ // hm = new HashMap<>(); // List = cn.getName(); // hm.put(ICON, R.drawable.a); // Картинка // hm.put(TITLE, cn.getName() ); // Название // hm.put(DESCRIPTION, cn.getDescription()); // mCatList.add(hm); // } // SimpleAdapter adapter = new SimpleAdapter(getActivity(), mCatList, // R.layout.list_item, new String[]{TITLE, DESCRIPTION}, // new int[]{R.id.text1, R.id.text2}); // listView.setAdapter(adapter); // listView.setOnItemClickListener(itemClickListener); return v; }
public void addWeeklyTD(WeeklyTD weeklyTD) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(NAME, weeklyTD.getName()); values.put(TIME, weeklyTD.getTime()); values.put(MONDAY, weeklyTD.getMonday()); values.put(TUESDAY, weeklyTD.getTuesday()); values.put(WEDNESDAY, weeklyTD.getWednesday()); values.put(THURSDAY, weeklyTD.getThursday()); values.put(FRIDAY, weeklyTD.getFriday()); values.put(SATURDAY, weeklyTD.getSaturday()); values.put(SUNDAY, weeklyTD.getSunday()); values.put(CLOCK_IMAGE, weeklyTD.getVibration()); values.put(SOUND, weeklyTD.getSound()); values.put(ORIGINAL_SOUND, weeklyTD.getOriginalSound()); values.put(DESCRIPTION, weeklyTD.getDescription()); values.put(ICON, weeklyTD.getIconD()); values.put(VOLUME, weeklyTD.getVolume()); values.put(COLOUR, weeklyTD.getColour()); values.put(WHISTLING, weeklyTD.getWhistling()); db.insert(TABLE_NAME_WEEKLY_TASKS, null, values); db.close(); }