aspose file tools*
The moose likes Android and the fly likes how to get progress bar after selecting a view Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "how to get progress bar after selecting a view" Watch "how to get progress bar after selecting a view" New topic
Author

how to get progress bar after selecting a view

Suzzane Pinto
Ranch Hand

Joined: Feb 10, 2012
Posts: 213
can anyone tell how to implement progressbar in andriod,
iam selecting an image den while uploading i want a progress bar to check if it is loaded successfully
santhana samy
Greenhorn

Joined: Mar 15, 2012
Posts: 1
hi,

onClick() of the image put this piece of code...


AsynTask<Void, Void,Void > lTask = new AsynTask<Void, Void,Void >(){

ProgressDialog lDialog;
protected void onPreExecute(){
lDialog = ProgressDialog .show(context, "","Your msg",true);
}

protected void doInBackground(Void... params){
// do your uploading task here
return null;
}

protected void onPostExecute(){
lDialog.dismiss();
}
};
lTask.execute();

Suzzane Pinto
Ranch Hand

Joined: Feb 10, 2012
Posts: 213
hey thanks for the above post,

i have added the following lines in my code but the avd says to force close




and my logcat says:



i dont understd where is it going wrong
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()

This seems quite clear, no?

Next time, please post only the operative code - not anything that's commented out- and only a relevant logcat excerpt that shows the output related to your app. Nobody is going to try and look through 1000 lines of something.
Suzzane Pinto
Ranch Hand

Joined: Feb 10, 2012
Posts: 213
i have doubt in this particular lines



i am passing string in doinbackground() and my ftp storefile() returns boolean which is used to store image to server..little confused with that.
please suggest
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
What does the input parameter of that method have to do with the result of the FTP operation?

You should use the string to pass in the information about what to do, though - it seems that is currently in "var".
Suzzane Pinto
Ranch Hand

Joined: Feb 10, 2012
Posts: 213
thankyou Tim,

now i have modified the code as


still the image is not getting uploaded...im wondering if running in a different thread really solving the problem of not uploading the whole image to the server.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
You don't seem to be doing any error checking of the result. The javadocs of the FTPClient class talk about what you should be doing.
Suzzane Pinto
Ranch Hand

Joined: Feb 10, 2012
Posts: 213
yeppieee i hav uploaded the image successfuly,just changed one line in my code
private static final int TEN_KILOBYTES = 1024 * 10*10*10*10;
n its done


thnanks to all those who took interest and replied to me patiently
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to get progress bar after selecting a view