I have GridView and I want to be able to switch between adapters.
Context:
I have data from two separate sources and I want to be able to easily switch between those.
Is it possible to just switch adapters or there is other solution?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should be able to call
setAdapteron lists or grids (or anyAdapterView) multiple times. One caveat: On ListViews, you can’t calladdHeaderVieworaddFooterViewonce you’ve made asetAdaptercall. Alternatively, if it’s giving you a hard time just put two GridViews in aViewSwitcher(or FrameLayout) with each set to one of the adapters you want and show/hide one or the other when you need to, rather than swapping out sources on one GridView.