Adolfok3
Adolfok3

Reputation: 310

Show Activity and after load its elements

There's any way to call a activity and when it's appear to the user, load the elements in it? Something like facebook, when you go to any screen, it's appear and after load the contents (example below). Everytime I call my activity, it takes 2 seconds to appear.

enter image description here

Upvotes: 1

Views: 957

Answers (2)

Mohsen Mohseni
Mohsen Mohseni

Reputation: 70

make your main views visibility gone and replace that with some default views and then use asynctask and load your data in doInBackground() method. then make your main views visible again and default views gone in onPostExecute() method

also you can simply change your views background before and after data loading in asynctask

Upvotes: 1

Mohammed Gamal
Mohammed Gamal

Reputation: 234

You can make your content view hidden till data is loaded then set visibility with visible , add loading layout visible till data is loaded then make it gone when your data load

Upvotes: 1

Related Questions