In my application for Android 2.2 + I will use ListView
and communicate with the existing XmlRpc
server. User will manually add items to the ListView
and application will receive additional information about items from the xmlrpc server.
The application will do the following activities:
ListView
ListView
These activities I plan to implement as:
in onCreate()
I will use AsyncTask
to call xmlrpc function and then I will show OK/ERROR in status bar of application
after pressing the ADD button I will use AsyncTask
to call xmlrpc function to obtain information about the item (name, price, image) and then I will update the item just added.
after pressing the GET ALL button I will use AsyncTask
to call xmlrpc function to get information about all the items in the list (name, price, image) and then I will update all the items.
after pressing the SEND button I will use IntentService
to call xmlrpc function and after I will display the result in the dialog box.
Is it appropriate to use AsyncTask
and IntentService
for my needs? Thank you.
All internet communication shall happen in separate background thread, U NOT HOG UI THREAD, or your application will be killed by android OS. List views are not updated directly, but via their adapter which provides data and views for it. Assuming you have created and configured appropriate adapter, workflow will be as follows: - rpc calls are processed in some background thread - they update datastore in your adapter - they signal via notifyDatasetChanged() ( from UI thread ) - list view asks adapter to provide views for all visible list items - your interface is updated.
You do not neet to mess with intents when you stay inside same java process - standart multithreading will do.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.