Question

I am new in android development. I have two activities in first activity there is only a button by which i am calling next activity using intent and in second activity i am doing the actual work i.e. i am getting the values from web using SOAP. So , My problem is that when i go from 1st activity to the second activity it shows me a BLACK screen until the next activity gets loaded totally since the response fron web is large. I want to add a progress bar from my 1st activity to second gets loaded totally to avoid this black screen. Do anyone have any ides about this. Thanks in advance.....

Was it helpful?

Solution

You have four realistic solutions i would say in my opinion

1- Threads

2- Asyntask

3- Service

4- External lib

If you are doing lot of small downloads classic Theading is the best option maybe with a service to manage it, but not forced.

For one simple download you can use Asynctask alone. It can be enough but you must know several things about this method : AsyncTask can be "Bugged" according to the way you use it.

Service is good you can use it. A download module using service is a good idea to manage the requests.

The best solution for a quick/efficient developement is to use a library that do the work for you. But in your case you are using SOAP... If you where using Json you could make use of Volley which is very good and fast.

Maybe try to use this one which is well known

http://code.google.com/p/ksoap2-android/

with the how to http://code.google.com/p/ksoap2-android/wiki/HowToUse


For the moment when to do the operation you have several solutions

1- In background without blocking the ui, updating the ui View per View

2- Using a loading screen (bad for user experience but sometimes you don't have a choice)

In your case you would have the loading screen between the first activity and the second using a ProgressDialog maybe

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top