I have an activity
where I am showing single fragment
at a time, total there are three different fragments.
FirstFragment
and SecondFragment
containing RecyclerView
and ThirdFragment
have a ScrollView
.
The issue is when a fragment get attached in runtime, UI freezes, but custom OnItemClickListener
listener works fine. When I select any list item of FirstFragment
it redirect to SecondFragment
, which is another list view. SecondFragment
also get freeze. But if I go back using back button, FirstFragment
works smooth. Similarly when I select SecondFragment
list item I get redirect to last i.e ThirdFragment
which is a scroll view which also get freeze and if I come back to SecondFragment
it starts working smoothly, but If I go back to the FirstFragment
and select any list item again and come to SecondFragment
again UI freezes.
NOTE: This issue is only appearing on OS version 5.0 (lollipop and above) on 4.2.2 Jelly Bean everything is working good. There is same freezing issue with support library's TextInputLayout
animation on android OS version 5.0 but works good on 4.2.2 Jelly Bean
I have created a Gist of activity
, three respective fragments
, RecyclerView.Adapter
and custom OnItemClickListener
ProductActivity.java, ProductCategoryFragment.java, ProductListFragment.java, ProductDetailFragment.java, ItemClickSupport.java
Any help would be appreciated. Thanks
EDITS
On activity
launch I get following logs.
04-01 16:28:47.241 32176-32176/com.example.omkar D/ViewRootImpl: ViewPostImeInputStage ACTION_DOWN
04-01 16:28:47.371 32176-32176/com.example.omkar I/Timeline: Timeline: Activity_launch_request id:com.example.omkar time:77715999
04-01 16:28:47.381 32176-32176/com.example.omkar W/ResourcesManager: getTopLevelResources: com.example.omkar for user 0
04-01 16:28:47.391 32176-32176/com.example.omkar W/ResourcesManager: getTopLevelResources: com.example.omkar for user 0
04-01 16:28:47.401 32176-32176/com.example.omkar D/PhoneWindow: *FMB* installDecor mIsFloating : false
04-01 16:28:47.401 32176-32176/com.example.omkar D/PhoneWindow: *FMB* installDecor flags : -2139029248
04-01 16:28:47.431 32176-32176/com.example.omkar D/Activity: performCreate Call Injection manager
04-01 16:28:47.431 32176-32176/com.example.omkar I/InjectionManager: dispatchOnViewCreated > Target : com.example.omkar.userInterface.activity.product.ProductActivity isFragment :false
04-01 16:28:47.431 32176-32176/com.example.omkar D/DisplayManager: DisplayManager()
04-01 16:28:47.461 32176-32176/com.example.omkar D/PhoneWindow: *FMB* isFloatingMenuEnabled mFloatingMenuBtn : null
04-01 16:28:47.461 32176-32176/com.example.omkar D/PhoneWindow: *FMB* isFloatingMenuEnabled return false
04-01 16:28:47.491 32176-32176/com.example.omkar W/View: View too large to fit into drawing cache, needs 10563840 bytes, only 3686400 available
04-01 16:28:47.501 32176-32176/com.example.omkar W/View: View too large to fit into drawing cache, needs 10563840 bytes, only 3686400 available
04-01 16:28:47.511 32176-32176/com.example.omkar I/InjectionManager: dispatchCreateOptionsMenu :com.example.omkar.userInterface.activity.product.ProductActivity
04-01 16:28:47.511 32176-32176/com.example.omkar I/InjectionManager: dispatchPrepareOptionsMenu :com.example.omkar.userInterface.activity.product.ProductActivity
04-01 16:28:47.531 32176-32176/com.example.omkar W/View: View too large to fit into drawing cache, needs 10563840 bytes, only 3686400 available
04-01 16:28:47.561 32176-32176/com.example.omkar I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@1d12fb86 time:77716194
04-01 16:28:47.921 32176-32176/com.example.omkar W/View: View too large to fit into drawing cache, needs 10563840 bytes, only 3686400 available
04-01 16:28:47.961 32176-32191/com.example.omkar I/art: Background sticky concurrent mark sweep GC freed 32383(1734KB) AllocSpace objects, 7(112KB) LOS objects, 9% free, 16MB/18MB, paused 5.876ms total 38.048ms
The issue is resolved. It was because I mentioned android:hardwareAccelerated="false"
in AndroidManifest.xml
file.
Answer Found at: https://stackoverflow.com/a/21145043/4387543