"With recent release of Android Support Library, revision 24 Google developers baked into v4 library a new helper class for asynchronous inflation of layouts"
This is my code:
Timber.e("Timeinflationstarts");
AsyncLayoutInflater asyncLayoutInflater=newAsyncLayoutInflater(this.getContext());
asyncLayoutInflater.inflate(R.layout.async_calendar,mLinearLayout,
new AsyncLayoutInflater.OnInflateFinishedListener() {
@Override
public void onInflateFinished(View view, int resid, ViewGroup parent) {
parent.addView(view);
Timber.e("timeWhenInflated");
}
});
and this is the output:
07-05 20:36:22.331 18250-18250/? E/PersonalFragment: Timeinflationstarts
07-05 20:36:22.371 18250-18250/? E/PersonalFragment: timeWhenInflated
the problem is that the view in async_calendar.xml is taking much more time(then 0.04s) to be seen on the screen, blocking the UI thread!
I made the view even heavier to be sure that the lag that I see is much more than 0.04.