Rewriting the catalog Activity

At launch: The catalog items are retrieved using Android’s Native JSON RPC
binding to the Catalog Service.


[image: catalog]
*fig#1*

While the shopping cart’s tab may look :
Either like (see below) if the shopping cart is currently empty at the
server side
[image: shop_empty]*fig#2*
Or like (see fig#3) if in another session or from another client, items have
been added to the shopping cart. HttpGet is used there to receive the
shopping cart content via an atom binding to the ShoppingCart Service, and
the SAX parser helps parsing the received feed.

After clicking on an item in the catalog list, it’ll be added in the
shopping cart list with an associated key generated by the server. Items are
encoded in xml and sent via HttpPOST using again an atom binding to the
ShoppingCart Service. Consequently, the entity to be sent has its
contentType set to atom/xml as Android doesn’t support Atom yet. As on the
webstore, items can be added as many times as the user desires it. Below is
the result of five consecutives clicks on different items.
[image: shop_full]
*fig#3*

You should also notice that the shopping cart total has been calculated.
This is the result of the “Total” service invocation via JSON RPC.

Let’s now try to remove the second occurrence of “Apple”. Clicking on an
occurrence from the shopping cart send an HttpDelete request to the
ShoppingCartService. The shopping cart’s list is automatically refreshed,
and now looks like this:
[image: shop_del]
*fig#4*

Finally, the erase cart button is used to delete all items from the shopping
cart. After clicking on it, the user is requested a confirmation, before the
server side deletion is proceeded. And after performing the delete, the
shopping cart tab looks like in #fig2

[image: shop_erase]
*fig#5*


Todo List for next week

   - Run sample calculator on android and build an issues list
   - Test the 2 known ways resolving the issues:
      - Use the retranslator [9]
      - Rewrite needed stuffs




-- 
Best Regards

Lookman SANNI
http://blog.lookouster.org
MSBI Intern at Umanis Tours Services;

Reply via email to