public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.list_fragment, container, false); if (dbHelper == null) { dbHelper = DBHelper.getInstance(getActivity()); } gridView = (GridView) view.findViewById(R.id.grid_view); gridView.setOnItemClickListener(onClickListener); // gridView.setFastScrollEnabled(true); // gridView.setFastScrollAlwaysVisible(true); gridView.setAdapter(adapter); hiddenCreateView = (CreateView) view.findViewById(R.id.create_alliance); hiddenCreateView.setVisibility(View.GONE); hiddenCreateView.setElevation(16); Button button = (Button) hiddenCreateView.findViewById(R.id.list_create); button.setTypeface(DemoActivity.getFont()); new LoadCursors().execute(""); return view; }
private Cursor getCursor(int type) { switch (type) { case MY_ALLIANCES: return dbHelper.getAlliances(); } return null; }
public void refreshAdapter() { if (adapter != null) { switch (type) { case MY_ALLIANCES: adapter.changeCursor(dbHelper.getAlliances()); break; } } }
@Override protected String doInBackground(String... params) { if (dbHelper == null) { dbHelper = DBHelper.getInstance(getActivity()); } cursor = getCursor(type); return null; }