java.lang.IllegalStateException:ViewPager尚未绑定(使用JakeWharton ViewPager指示器) [英] java.lang.IllegalStateException: ViewPager has not been bound (Using JakeWharton ViewPager Indicator)
问题描述
我有一个screen.One ViewPager两种查看传呼机使用JakeWhartoncircleindicator和第二个使用TabPage的指标。我需要使用异步call.Once的数据下载我应该显示在viewpagers将数据从后台下载数据。
这里是我的活动code片段。
I have two view pagers in a screen.One ViewPager uses JakeWharton' circleindicator and second one uses TabPage Indicator. I need to download the data from backend using Async call.Once the data is download i should be displaying the data in the viewpagers. Here is the Code snippet of my activity.
ViewPager pager1;
ViewPager pager2;
public onCreate(){
//I Set Up ContentView
//Locate ViewPagers & Indicators
//pager1 = ...
//pager2= ...
//Locate Indicators
CallAsyncTask().execute();
}
private class CallAsyncTask extends AsynTask{
doinbackground(){
//Download Data
}
onPostExecute(){
displayData();
}
}
private displayData(){
// Set Up Adapters & Indicators for ViewPagers
}
当我执行此code,我得到的 ViewPager未绑定异常。
是有它的溶液。我觉得一个解决方法是内部onPostExecute setUpContentView()AsyncTask.But的方法我还需要显示progressBars直到数据下载即可。我怎样才能做到这一切。
when i execute this code, i get ViewPager Not Bound Exception. Is there a solution for it. I think a workaround is to setUpContentView inside onPostExecute() method of AsyncTask.But i also need to display progressBars till the data is downloaded. How can i achieve all of this.
推荐答案
我只是放在可见性:走了
在 TabPageIndicator
,当我得到的数据显示更改知名度,可见
I just placed visibility: gone
on the TabPageIndicator
and when I get the data to display I change the visibility to visible
这篇关于java.lang.IllegalStateException:ViewPager尚未绑定(使用JakeWharton ViewPager指示器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!