@Override public void onClick(View v) { sc.addSelectedToDatabase(getContext().getApplicationContext()); ComputationsFragment computationsFragment = new ComputationsFragment(); getActivity() .getSupportFragmentManager() .beginTransaction() // TODO fix animation .setCustomAnimations(R.anim.fade_in, R.anim.exit_to_right) .replace(R.id.fragment_container, computationsFragment) .commit(); }
public void addSelectedToDatabase(Context context) { List<Computation> selected = SetupCompsFragment.getSelectedComps(); TworkDBHelper db = TworkDBHelper.getHelper(context); for (Computation comp : selected) { db.addComputation( comp.getId(), comp.getName(), comp.getDescription(), comp.getTopics(), TworkDBHelper.COMP_STATUS_ACTIVE); Log.i("SQLite", "added" + comp.getName()); } }
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); sc.populateList(getContext(), getView()); }