What exactly do you mean by "second usage"?

Just pressing the home key and then tapping your program icon won't
create a new activity instance, unless the old one has been deleted.
You can't depend on it being deleted, in fact, you'd prefer it not be.

Study the diagram in the Activity class documentation (a screen or two
down): http://developer.android.com/intl/de/reference/android/app/Activity.html

Note that there are paths that take you back into the activity.
Depending on what exactly what data is you're getting from the server,
you may want to reinitialize in onResume() or onStart(). My guess
would be onStart() -- I think you probably don't want to re-fetch data
just because a dialog popped up, then returned control to your
Activity.

Likewise, you may want to de-initialize the data (for example, null
out the variable containing it) in the onStop() method, which will
allow the memory to be reclaimed sooner.

On Apr 18, 7:24 pm, raqz <abdulraqee...@gmail.com> wrote:
> Hi,
>
> I am trying to receive some data from a servlet on to android. It
> works fine for the first run but if in case I happen to use the same
> activity again, the previous data is  getting appended to the new
> data.
> Could some one please tell me what is wrong. Why dont the variables
> get re initialized in the activity on the second usage of the same....
>
> Thanks,
> Raqeeb
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to