I have an activity ‘Activity1’ and also another activity named ‘Activity2’. The ‘Activity2’ is loaded upon clicking a button in ‘Activity1’. I wanted to display the progress dialog until the new activity is loaded . Can you please show me the code to do this
I have an activity ‘Activity1’ and also another activity named ‘Activity2’. The ‘Activity2’ is
Share
There is two ways to
First approach To use Async Task
If you are doing heavy tasks eg loading data from server or parsing xml in that case use AsynTask<>
If you want to call ActivityB from ActivityA then
*step-1*create a AsyncTask class. write all background tasks inside
doBackground()method and after completion of task you want to call an activity that code write insideonPostExecute()post execute methodstep-2 In the activity fro where you want to jump to new activity (eg in ActivityA) call the execute() of AsynTask
Second approach
the task then cancel the progress dialog and call the next activity
or
object (progress dialog) and inside that new activity dismiss this
dialog.