I use an AsyncTask for loading operations that I implemented as an inner class. In onPreExecute() I show a loading dialog which I then hide again in onPostExecute(). But for some of the loading operations I know in advance that they will finish very quickly so I don't want to display the loading dialog. I wanted to indicate this by a boo...
Hey everyone!
I'm new to Android programming and I'm using AsyncTasks to fetch data in response to the user pressing a button. This works well and keeps the interface responsive while fetching the data, but when I checked out what was going on in the Eclipse debugger, I found out that every time a new AsyncTask was created (which is qui...
How do I replace the following lines of code with an Asynctask ?
How do you "get back" the Bitmap from the Asynctask ? Thank you.
ImageView mChart = (ImageView) findViewById(R.id.Chart);
String URL = "http://www...anything ...";
mChart.setImageBitmap(download_Image(URL));
public static Bitmap download_Image(String url) {
//-...
I'm trying to make a simple ProgressDialog appear while my AsyncTask is fetching data. In my onPreExecute() method I have this:
pd = ProgressDialog.show(c, "Loading...", "Please wait");
c is the context passed into the constructor of my AsyncTask from this.getApplicationContext(). Unfortunately, I keep getting an exception with this m...
I have a service, that requests another class, which launches an AsyncTask
Service->Weather Class->Execute Method->Asynctask->Execute
this is launched in the service by
new Weather(this).execute(); // the execute is a method of the class, not of the AsyncTask
how do I detect in Service that the AsyncTask finished so I can call stopS...
i have an android app with several activities. I need to start a timer when the first activity starts and end the timer when the last activity starts and show the elapsed time. How can i use Asynctask to do this.
...
Hey all,
I would like to know if it is possible to get 'leftover' calls to AsyncTask#onProgressUpdate after AsyncTask#onPostExecute has been called? I am setting text on the same TextView using both of them, and I don't want to set text such as "Done!" and then have it overwritten at a later point by text such as "Almost there - 90%"
...
Hi,
I'd like to set a ListView to data I get from a web service. I get the data in a AsyncTask instance, but when I try to set some of my ListView attributes, it crashes (on line "lv.setVisibility(View.VISIBLE);"). Anybody can help?
thanks
public class Atable extends Activity {
private EditText mSearch;
private static final i...
i have the following code in a TabHost/TabWdiget for an activity in a Tab that has a ListView that calls my MapView
if(_list.get(position).enabled)
{
convertView.setOnClickListener( new OnClickListener()
{
public void onClick(View v)
{
_context.startActivity(i);
}
});
}
When the animatio...
I am trying to add ListView items one by one. So if I have say -- 60 items -- the application would add the views to the list view one at a time -- thus showing the user that the application is loading more things.
This is my code:
try {
JSONArray j = getTaggsJSON();
Log.v(TAG, String.valueOf(j.length()));
a =...
I have an android application that parses some HTML, downloads an image, and displays it. I'm using an AsyncTask to do the HTML parsing and image downloading, but that shouldn't be relevant. I never have a problem when I'm on WiFi on my phone, when I'm using the Eclipse debugger on my phone, or when I'm using the emulator. When I have my...
Hi
When I try to compile to following code, I get two errors:
Description Resource Path Location Type
Syntax error on token "void", invalid Expression AsyncTask.java /AsyncTask Project/src/org/me/asynctask line 19 Java Problem
Description Resource Path Location Type
The type AsyncTask is not generic; it cannot be parameterized with arg...
I have an issue with the following error in Android:
CalledFromWrongThreadException;: Only
the original thread that created a
view hierarchy can touch its views
It appears to happen when I try to update a Textview in my Activity, the call to update the TextView is from within my Activity but I still get the above error.
I have...
Hello, I am trying to do what I think is a fairly simple task to authenticate a user on my server. I am using AsyncTask as a private subclass of my Activity, however when I try to populate the user object after authenticating it keeps setting it to null. Is there something strange in how the onPostExecute() method is called that is causi...
Hi,
I have a common class say for eg Class A which extends AsyncTask and has all the methods implemented i.e. onPreExecute, doinbackground and onPostExecute.
Now, there are other classes which want to use Class A object.
Say Class B uses class A in the below manner
A a = new A(context)
a.execute(url)
Then i fetch the result in get ...
Android documentation says that AsyncTask postExecute() is called on the UI thread. I was under the impression that postExecute() was called from the Thread where execute() was called : I have been using an AsyncTask in a background Service with its own thread, and postExecute() was called in the service thread, not the main thread.
Howe...
Does onPostExecute execute if the AsyncTask has been cancelled?
If it does execute, is it safe to say that I should always ask if the task has been cancelled (isCancelled) at the start of onPostExecute, before doing anything else?
...
*Updated: (See below)*I have been looking around for couple of days and can't find a straight answer to this.
Some say it possible to some say to accomplish some say it's not. I am getting crazy on this.
What I want is just to have the AsyncTaskTask showing a progressbar an external class. To do this I am passing the context as you ca...
Hi everyone. I've got the URL of a .png image, that needs to be downloaded and set as a source of an ImageView. I'm a beginner so far, so there are a few things I don't understand:
1) Where do I store the file?
2) How do I set it to the ImageView in java code?
3) How to correctly override the AsyncTask methods?
Thanks in advance, will h...
I'm trying to figure out the correct way to create an AsyncTask to retrieve some data from the internet and then to take that data and bundle it up in an Intent and pass it to a new activity(A list display). So in the first activity I just have an EditText and Button. In the event of an OnClick the task should be called and when it is ...