I would like to know or understand how to load a screen. My app does query in a webservice, and sometimes depending on the connection it takes to bring the information. And the app is all white. To the end user it seems that caught. So I would like to put a loading screen.
HTTP request code
private static final String BASE_URL = "https://LINK DO MEU Json";
private static Retrofit mRetrofit;
private static ApiNOMEDOPROJETORequestInterceptor mInterceptor;
private static Gson mGson;
private static OkHttpClient mClient;
public static Retrofit getInstance() {
if (mRetrofit == null) {
//create Gson
mGson = new GsonBuilder()
.setDateFormat("yyyy-MM-dd HH:mm:ss")
.create();
//create interceptor
mInterceptor = new ApiNOMEDOPROJETORequestInterceptor();
//create httpClient with interceptor
mClient = new OkHttpClient.Builder().addInterceptor(mInterceptor).build();
//create retrofit
mRetrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create(mGson))
.client(mClient)
.build();
}
return mRetrofit;
}
}