Android 加载数据时显示viewpager选项卡而不加载/progressbar

Android 加载数据时显示viewpager选项卡而不加载/progressbar,android,android-viewpager,broadcastreceiver,android-progressbar,viewpagerindicator,Android,Android Viewpager,Broadcastreceiver,Android Progressbar,Viewpagerindicator,我正在实现在视图寻呼机中显示数据,该寻呼机是通过onReceive中的宽播接收器接收的 但我的确切要求是,我第一次需要读取整个数据,在根据这些数组列表大小对数据进行分类后,我需要检查该选项卡是否有任何数据,然后我需要在ViewPager中显示节点数据 我已经通过使用Async实现了这一点。但我的问题是,在第一次启动后,直到读取数据时,它才将消息显示为NODATA 如何避免这种情况 注意:我的要求是加载数据时不显示任何加载条或进度条 代码示例 我想您使用异步任务。只需在PreExecute上实现它

我正在实现在视图寻呼机中显示数据,该寻呼机是通过onReceive中的宽播接收器接收的

但我的确切要求是,我第一次需要读取整个数据,在根据这些数组列表大小对数据进行分类后,我需要检查该选项卡是否有任何数据,然后我需要在ViewPager中显示节点数据

我已经通过使用Async实现了这一点。但我的问题是,在第一次启动后,直到读取数据时,它才将消息显示为NODATA

如何避免这种情况

注意:我的要求是加载数据时不显示任何加载条或进度条

代码示例

我想您使用异步任务。只需在PreExecute上实现它:


我试过这个。但是,在使用onReceive获取数据之前的一段时间内,每次都会显示该通知。您需要添加一些代码,以了解您所做的工作和尝试实现的内容
public class InformationTabsActivity extends FragmentActivity implements OnClickListener
{
    protected void onCreate(Bundle savedInstanceState)
    {
        -
        -
        -
    mAsync = new LoadNotificationsASYNC(this);
        mAsync.execute();
        -
        -
        -

    }
    public void getNotificationsList()
    {
        Intent broadcastIntent = new Intent("NOTIFICATION_LISTENER_SERVICEE");
        broadcastIntent.putExtra("command", "list");
        sendBroadcast(broadcastIntent);
    }

        -
        -
        -
    private class LoadNotificationsASYNC extends AsyncTask<Void, Void, Void>
    {
        Context context;

        public LoadNotificationsASYNC(Context mContext)
        {
            context = mContext;
        }

        @Override
        protected void onPreExecute()
        {


        }

        @Override
        protected Void doInBackground(Void... params)
        {

            getNotificationsList();
            return null;
        }

        @Override
        protected void onPostExecute(Void result)
        {
        }
            -
            -
            -

        lass NotificationReceiver extends BroadcastReceiver
    {
        public NotificationReceiver()
        {
        }

        public void onReceive(Context context, Intent intent)
        {
            //Read broadcastIntent and clacify by properties

            if(some cond..)
            {
                mInformationFragment.updateInformationsList();
            }
            else
            {
                mExecutionFragment.updateExecutionsList();
            }


        }

    }
public class InformationFragment extends Fragment implements OnItemClickListener
{
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
        if (mInformationsList.size() == 0)
        {
            tv_info.setVisibility(View.VISIBLE);
            tv_info.setText(getResources().getString(R.string.no_infomation_message));
        }
        else
        {
            tv_info.setVisibility(View.GONE);
        }
    }

        -
        -
        -
    public void updateInformationsList()
    {
        if (mInformationsList.size() == 0 && infoTab.firstOnreceiveDone)
        {
            tv_info.setVisibility(View.VISIBLE);
            tv_info.setText(getResources().getString(R.string.no_infomation_message));
            listView.setVisibility(View.GONE);
        }
        else
        {
            listView.setVisibility(View.VISIBLE);
            tv_info.setVisibility(View.GONE);
        }

        mAdapter.notifyDataSetChanged();
    }
}
    @Override
    protected void onPreExecute() {
        //set your message to show nothing til the result come in onPostExecute()
    }