Tuesday, June 15, 2010

SOAP on Android

Some projects require to communicate with Web services.
The JDK provides tool called wsimport that generates classes from WSDL, and user works with them like with other Java classes and may not know that he works with a Web service.

But it does not work on Android... Android  SDK does not provide classes to work with Web services. So, it needs to manually work with Web services by using SOAP.

There is a good library called kSOAP 2 that is a lightweight SOAP Web service client library for constrained Java environments such as Applets or J2ME applications. There is a port of this library to Android platform that is allowed on Google code.

Wednesday, June 2, 2010

Wheel UI contol: ideas for the future

The wheel control described in previous posts contains all necessary functionality and is ready for using by other applications.
But I would consider it just as a draft for a real wheel view. It needs to "tune" this control to make it more attractive.
Next are some ideas that I'd like to realize:
  1. Implement the animation like in the original iPhone widget
  2. Add the ability to work not only with numbers. Make it to use Adapters like the ListView.
  3. Make the control to be composed. It should contain as much wheels as necessary, so it will allow to avoid defining a set of the wheels for complex widget, like for password and date time picker widgets from the first post about the wheel widget. It can be used by next way:



     // Get the wheel view
     WheelView picker = (WheelView) findViewById(R.id.date_time);
    
     // Add the hours wheel
     WheelViewSection hours = picker.addSection("hours");
     // Set adapter for hours.
     hours.setAdapter(new NumericAdapter(0, 23));
    
     // Add the mins wheel
     WheelViewSection mins = picker.addSection("mins");
     // Set adapter for it
     mins.setAdapter(new NumericAdapter(0, 59));
    
     // Set current values
     Calendar c = Calendar.getInstance();
     mins.setSelectedIndex(c.get(Calendar.MINUTE));
     hours.setSelectedIndex(c.get(Calendar.HOUR_OF_DAY));
    
     // ...
    
     // Get password view
     WheelView passw = (WheelView) findViewById(R.id.passw);
     // Set count of sections
     passw.setSectionCount(4);
     // Set numeric adapter for all sections
     passw.setAdapter(new NumericAdapter(0, 9));
    

  4. Repeat the wheel items when necessary. It means to show the first item after the last one. For example, when user select 59 mins there will be shown the 0 and 1 value below; for hours it can be not used and it can show blank items below the 23 and above the 0 hours.
It's all the ideas that I have at this moment. If you have more ideas please let me know.

See also
    Introduction to the Wheel control
    The Wheel control layouts
    The Wheel control backgrounds
    Scrolling the wheel control


Updated: I've posted sources of the Wheel widget to Google code. Please use this link.