• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

how to get progress bar after selecting a view

 
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Saloon Keeper
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Saloon Keeper
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Saloon Keeper
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Hey cool! They got a blimp! But I have a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic