Adding a progress bar to a listview? How does it work?

Put your problem here if it does not fit any of the other categories.

Adding a progress bar to a listview? How does it work?

Postby benni2100 » Sun Mar 13, 2011 3:26 pm

Hello!

How can i add a progress bar to my list view?
(The class "Test" extends ListView)

Code: Select all
   
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
Object[] names;
   try {
           //This part is very slow, i will add a progressbar here
                XMLParserFactory factory = new XMLParserFactory(
            "http://10.0.0.2:8080/TestServlet");
      names = factory.parseMultipleTags("anyxmltag");
   } catch (Exception e) {
      names = new String[] { "ERROR" };
   }
   Test.this.setListAdapter(new ArrayAdapter<Object>(this,
   R.layout.list, R.id.label, names));
}


Thank you very much for your solutions :D
benni2100
Once Poster
Once Poster
 
Posts: 1
Joined: Sun Mar 13, 2011 3:14 pm

Top

Re: Adding a progress bar to a listview? How does it work?

Postby raj_J2ME » Mon Mar 14, 2011 6:50 am

I think you are parsing the XML inside the method. I would recommend you to do such kind of time taken activities inside the different thread itself. You can go through the ProgressDialog class and use this one to draw the progress bar. This following link will help to get the details for the same, please check this.
http://guides.wikinut.com/Progress-Bar-On-Android/4ws2d1y7/

Check and revert.
Thanks with Regards,
Raj - The Kernel
raj_J2ME
Master Developer
Master Developer
 
Posts: 311
Joined: Tue Feb 15, 2011 7:40 am
Location: The Capital of India,

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 15 guests