android - When I load image and text, block click tab several seconds, why? -


i in create method on activity second tab

public void infotabs(){      //tab1: works     .......      // tab 2:     image.setimageresource(panel.getphoto());     string infocasilla = panel.getinfotext();     informacioncasilla.settext(infocasilla); } 

then when press second tab, takes 3-4 seconds load image , text , locked showing content tab. can think of idea prevent being blocked seconds? thank much.

if photo large , take lot of time (i.e. 3-4 sec) load image imagebutton(or imageview,whatever using). should load in worker(background) thread, not in ui thread (like now). use separate thread this:

 new thread(new runnable() {              public void run() {                  image.post(new runnable(){                      public void run() {                        image.setimageresource(panel.getphoto());                                   }                   }             }        }).start();  

or use picasso or fresco libs, load image in separate thread you.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -