First thing which you should take care of is to watch about calculations / loading a big set of data should be places on a different worker thread than main UI thread. The best option to do that (in my opinion) is to use AsyncTask
. You can use something like this in your Fragment :
private class LoadData extends AsyncTask<Void, Void, Void>{
@Override
protected void onPreExecute(){
super.onPreExecute();
// this is the place where you can show
// progressbar for example to indicate the user
// that there is something which is happening/loading in the background
}
@Override
protected void doInBackground(Void... params){
// that's the place where you should do
// 'the heavy' process which should run on background thread
}
@Override
protected void onPostExecute(Void result){
super.onPostExecute();
// you should update your UI here.
// For example set your listview's adapter
// changes button states, set text to textview and etc.
}
}
This is the way you can make your tabs work faster.Hope this will help you! : )