Honestly, I am glad I got this to work the first time. Otherwise, I totally would have been stuck for who knows how long.

It probably had been more than 2 years since I used ListView and modified its contents like adding, removing and updating. When I made another go recently, I was confused why the ListView does not refresh its content.

I thought calling the notifyDataSetChanged() of ArrayAdapter after add() or remove() will do the trick in the onPostExecute() of the AsyncTask class.

The solution is not to use the add() or remove() method of the ArrayAdapter class. Instead, you place a global variable in your class for the ArrayList object that you will pass to the ArrayAdapter.

I instantiate an ArrayAdapter like this:

Make sure the myArrayList variable is global. So that within your AsyncTask class, you can call add() or remove() method of the ArrayAdapter class within doInBackground() of AsyncTask and call adapter.notifyDataSetChanged() onPostExecute().

That should refresh your ListView contents.

See sample below:

Suppose your code for adding items to a Ext.carousel.Carousel in Sencha Touch looks like this

To add these same data dynamically, place the code within its initialize function and do your looping there. Check out this sample code.

If your IIS (Internet Information Server) cannot interpret an ASPX file and returns an error, there is a big chance that you did not register ASP.Net in IIS.

To do so, just run the commend aspnet_regiis and it handles everything behind the scenes including adding a mime type of ASPX type to IIS so that it will be able to interpret it.

Related Posts Plugin for WordPress, Blogger...