3

I am stuck in a weird problem for some 2 days now, kindly help if someone knows what exactly it is.

Problem being, I have a note making app with tab view (3 swipe tabs somewhat like watsapp's tabs).

FYI , I have Android View Pager swipe tabs.

Tabs are simply created from TabLayout

Say Tab1 , Tab2 ,Tab3 .

Tab1 just has an edittext (where user enters text data (notes)).

Tab2 has a (list view) list of all notes created by user.

Tab3 just has some setting options for app.

Problem is -- when user enters lots of text in Tab1 (edittext) (a lot here means say 1 Mb of text),

Then the swipe becomes really heavy, and if you try to move to other tabs (from Tab1 -->to--> Tab2 and vice versa ,also switching from tab3 to tab1 ),it stucks a lot .

Although (Tab2--->tab3 or tab3 to tab2) is smooth. (tab2 and 3 do not have anything in it right now).

THINGS I HAVE TRIED :

1) Read most related questions on SO , none helped.

2) checked logcat to see if my fragments are created again n again when I switch to it... so they are not recreated.

3) set viewPager.setOffscreenPageLimit(3); to prevent reloading of fragment on each swipe.

Here is the link to some part of my code.

Wanderer
  • 31
  • 3
  • Can you share your code (inline and not as a link) - specifically the part where you create the heavy list. – Doron Yakovlev Golani May 01 '17 at 14:35
  • Yeah sure but I have not created any heavy list yet just 2 items in list for testing purpose..,so that's not the reason ..Reason being huge text in Tab1 and not list items in tab2 – Wanderer May 01 '17 at 14:37
  • Getting upvotes not answers ..Don't upvote but give answers,I need answer and not upvotes .. Pls somebody give me some suggestions. – Wanderer May 01 '17 at 15:18
  • Did you find the solution for this... I am facing the same issue... Could you please tell me, if you found the solution. @Wanderer – Thrinadh Reddy Apr 07 '18 at 15:45

1 Answers1

0

Having a TextView with 1MB of text is not a common scenario. I am not sure if the problem is the rendering or the creation.

If it is the rendering, perhaps you can consider breaking the text into many small pieces and putting them in a ListView. If it is the creation, you can try creating the TextView once and reusing it each time.

Doron Yakovlev Golani
  • 5,188
  • 9
  • 36
  • 60
  • it is edittext and not text view. And since it is a notes app, 1MB is just like you created notes in same file for 20-30 consecutive days in your class and it goes to 1MB..,so it can be common enough. – Wanderer May 01 '17 at 14:48
  • EditText is a TextView. I understand why it would be hard to break it then. – Doron Yakovlev Golani May 01 '17 at 14:50
  • "you can try creating the TextView once and reusing it each time." It is like you noted down some notes each day ..which gets saved in external memory and rendered then .., so not static..breaking text to form list view is something I m not too sure – Wanderer May 01 '17 at 14:52