I retrieved from DB texts + images and it was displayed in a Gridwu Kiiic Gridwu cell in which an image + text Was there. Now I have to endorse it. I allow it to display 4 cells per page. How can I do this? Example link or code is highly appreciated.
I hope this is helpful ..
I have an Android training page link Found an example on "" There you can download an example EffectiveNavigation.zip, very useful for pagers. From there you can get the basics of adapters and accessories for which you need it.
The way I have achieved a grid with endorsement:
having 2 layouts with pager
and for grid view
Android: GridView Android: id = "@ + id / Gridview "... Note: If the grid layout is wrapped in the other component then I had problems.
I load the pager within an activity Here you load the pygonator as an Android training example, for example I do not add information here, as well as I have the array of items in this case My argument is to load them, you load them with the Jason reaction. Once an asyncTask completes on:
protected void onPostExecute {String parameter} {RefresList (); ProgressDialog.dismiss (); } I call Refresh because it will not change anything to pager adapters "mGridPagerAdapter.notifyDataSetChanged ();" Also, I recapture the tab to call a refresh tabs method. Public Zero RefrestTabs () {actionBar.removeAllTabs (); For (int i = 0; i & LT; mGridPagerAdapter.getCount (); i ++) {actionBar.addTab (actionBar.newTab () .setText (mGridPagerAdapter.getPageTitle (i)) .setTabListener (this)); }} I've made loads FragmentPagerAdapter spread piece in a GridAdapter that GetItem pattern here
@Override public piece GetItem (I Int) {piece Piece = new grid-listfragment (); Bundle args = new bundle (); Args.putInt (GridListFragment.ARG_SECTION_NUMBER, i); Fragment.setArguments (args); Return piece; } The square gridlist increases the fragment fragment and here your argument goes to load whatever section you want. Here onCreateView method I)
@Override public view onCreateView (LayoutInflater inflater, ViewGroup container, bundle savedInstanceState) {bundle using args = getArguments (; status = args.getInt (ARG_SECTION_NUMBER ); views = inflater.inflate (R.layout.comp_grid_view, container, false); GridView = (GridView) view.findViewById (R.id.gridview); ApplicationItems = new Arrelist & lt; ApplicationItem & gt; (); Int resID = R.layout.comp_app_list_item; Aa = New ApplicationListItemAdapter (view.getContext (), resID, applicationItems); gridView.setAdapter (aa); gridView.setOnItemClickListener (New OnItemClickListener) {@Override Public Zero onItemClick (AdapterView & LT ;; & Gt; Parents, see and , Int position, long id) {mCallback.onApplicationSelected (applicationItems.get (status));}}); return view;} I refresh the grid when called Onstart method And I do it like this:
Public Zero Start on @Override () {applicationItems.clear (); AppShortcutApplication appState = ((AppShortcutApplication) getActivity (). GetApplicationContext ()); & Lt; ApplicationItem & gt; L = appState.getCurrentListApplications (); If (L! = Null) {applicationItems.clear (); ApplicationItems.addAll (L); Aa.notifyDataSetChanged (); } Super.OnStart (); } I pass items through this application question which you can get information about on this other link link ""
Then this is the most Can not be a good way, but coultn can not find anything else
Comments
Post a Comment