I have a different approach to solving the problem at hand.
In my opinion AsyncTask is an interesting approach but has too many flaws
(like cancel() only working if the Thread is interruptible or issues
dismissing Dialogs).
The added value of AsyncTask on the other hand is pretty small compa
This worked great, though it's quite a bit of setup for something that
I think ought to be handled by Android. I just wanted to say thanks,
this problem was driving me up the wall.
-Daniel
On Nov 10, 7:22 pm, Lance Nanek wrote:
> Here's a quick attempt at rewriting it without a static. Turned o
I have a similar problem. The fact that the Activity is destroyed and
re-created every time the orientation changes doesn't make sense to
me.
Mark Murphy's second suggestion (overriding the default orientation-
handling code, so your activity is not destroyed and recreated)
actually makes the mos
Ahh! That makes total sense, I was trying to do more or less the same
thing but it got tricky a there were a few flaws, this is great. I
have a much better understanding of things now.
Thanks
On 11 Nov, 01:22, Lance Nanek wrote:
> Here's a quick attempt at rewriting it without a static. Turned o
It's indeed a bit complex, but it's a nice way of doing this! :)
I have to look at it a bit closer, it looks like your solution will
work when having possibly more than one instance of your activity at
any given time. Using the static-solution, that i proposed, won't work
well in that scenario.
Yo
Here's a quick attempt at rewriting it without a static. Turned out
more complex than I'd like. Pastebin version:
http://pastebin.com/m7b8b184
Inline version:
public class MyActivity extends Activity {
private final static String LOG_TAG = MyActivity.class.getSimpleName
();
priva
I've tried that, too. But again to no avail, nothing I do seems to
work. I've tried using the callback features whilst also implementing
weak references which also doesn't work. Once I change orientation,
the progressDialog never disappears, it's bugging me to hell
On 8 Nov, 17:41, Streets Of Bost
If you do showDialog(dialogId) and dismissDialog(dailogId), Android
actively manages the showing and hiding of the dialog on configuration
changes.
E.g. if you called showDialog(id) and your rotate your screen, Android
will make sure that the dialog is shown again when the activity is
recreated fo
Well, that's the thing. It's not a progress 'bar' that I can just show/
hide which would seem a lot easier. I'm just using a ProgressDialog
that I dismiss in onPostExecute, The code you see above inside of my
AsyncTask is what I'm using to show/hide the dialog. I use showDialog
() in onPreExecute a
Show us your code that deals with showing/hiding the progress bar and
show exactly what doesn't work.
Maybe we can figure it out :)
On Nov 7, 5:32 pm, Lee Jarvis wrote:
> Any other suggestions? I keep trying different things out but nothing
> seems to work, I keep seeing common applications with
Any other suggestions? I keep trying different things out but nothing
seems to work, I keep seeing common applications with the same
functionality which is making it more frustrating because I know it
should work fine
On 7 Nov, 17:29, Lee Jarvis wrote:
> Thanks for your reply, it's made me unders
Thanks for your reply, it's made me understand things a little better.
Unfortunately that still doesn't seem to work..
The Toast popup appears twice, then the ProgressDialog just continues
to run regardless
On Nov 7, 5:14 pm, Streets Of Boston wrote:
> Lance is absolutely right. I ran into this
Lance is absolutely right. I ran into this problem a few months ago.
Possible solution:
Hold a static handle to your currently active instance of your
activity (works only if you have at most one active instance of your
activity at any given time in your process).
public class MyActivity extends
Ah ok, that makes sense. Thanks for your reply. I understand what
you're saying, but in all honesty after trying another 3 examples I'm
still unable to resolve this, could you possibly provide some kind of
example for what would work?
Seems if I use a reference to a ProgressDialog in my activity i
>private final class Task extends AsyncTask {
...
>dismissDialog(DIALOG_TASKING);
A non-static inner class like this has a reference to the instance of
the class that created it. So that dismissDialog call probably goes to
the previous instance of your activity in this case. Not the current
one if
Anyone other feedback on this? I'm confused as to why this isn't
simpler.. All I want to do is display the ProgressDialog until the
task is complete, then get rid of it.. Anyone would think this was
trivial.
No matter what I do I'm unable to remove the dialog once the screens
orientation has alter
I apologise if I'm missing something or just being stupid.. But i've
tried the following..
@Override
public void onDestroy() {
dismissDialog(DIALOG_TASKING);
super.onDestroy();
}
The dialog is only dismissed if I DONT change orientation, otherwise
the "finished" toast
Lee Jarvis wrote:
> This code (kinda) works, the only problem is dismissing the dialog if
> the activity is recreated. I've tried dismissing it if mTaskComplete
> is true but I guess by that time it's lost reference to the
> ProgressDialog.
You may need to dismiss the dialog in onDestroy() and reo
Ok great, thanks.
I've adapted my code and added a static flag to my activity, just for
testing purposes..
This is my code now..
package net.gullycorp.gully;
import android.app.Activity;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os
19 matches
Mail list logo