TreKing's point is, it's safer to do this asynchronously. There are so many things that can go wrong with an HTTP request, you don't want to have your users waiting for it to return. Especially if there's nothing being displayed to the user, they don't know or care about the response from the server.
Instead, create a service to make the request instead. It will run in the background and still guarantee the request will be made with as much certainty as doing it within your Action. You can even add some retries within the exception handling in case the server is unreachable. K. On 13 May 2010 15:13, dillipk <[email protected]> wrote: > Thanks TreKing for your replies.. > > Basically my requirement is, as soon as you try to leave out of the > screen(Whether by hitting BACK key), it makes a HTTP request (by > sending some data from the current screen) to get some data from the > server and once it receives the response from the server, it can leave > out. > > > > On May 13, 1:45 pm, TreKing <[email protected]> wrote: > > On Thu, May 13, 2010 at 11:24 AM, dillipk <[email protected]> > wrote: > > > Is there any api which would wait there on the activity/screen till > there > > > is a response from a server or the task is complete instead of > displaying > > > ProgressDialog etc,,? > > > > Your question doesn't really make sense. An API is not something that > "would > > wait". You should add a little more detail as to what you're really > trying > > to do here. > > > > Obviously you're not required to use a progress dialog - you could have a > > static message you show at first and update after the response, or > > something. But in this case the user can back out at any time (which is > > good), in which case you would want to cancel your ongoing task. > > > > I guess you COULD handle the back key press and prevent this, like the > > dialog scenario, but again, my previous comments apply. > > > > > ------------------------------------------------------------------------------------------------- > > TreKing - Chicago transit tracking app for Android-powered deviceshttp:// > sites.google.com/site/rezmobileapps/treking > > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to [email protected] > > To unsubscribe from this group, send email to > > [email protected]<android-developers%[email protected]> > > For more options, visit this group athttp:// > groups.google.com/group/android-developers?hl=en > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

