ads

Porting JavaME apps to Android is easier with J2ME Polish

March 4th, 2009 1 Comment   Posted in Android, J2ME / JavaME, Mobile Software

Great news for JavaME developers! The J2ME Polish project has announced that their upcoming j2mepolish 2.1 toolkit suite will support porting JavaME apps to Google Android mobile platform automatically! This means that the current JavaME developers will enjoy the advantages of porting their existing mobile application to Android effortlessly.

Android Logo

According to their press release, the next j2mepolish release will focus on automating the process of converting JavaME MIDlets to iPhone application.

J2ME Polish 2.1: Android support?

Android Logo

Currently I’ve yet to see how a ported JavaME application would look like on an Android mobile phone, but hopefully it would be as good as the ordinary Google Android app. At this time of this writing, J2ME Polish 2.1 is only available as a preview release which can be downloaded from J2ME Polish website.

I’ll update this blog about this feature once J2ME Polish 2.1 has been released.

p/s: I’m Eager to know how a JavaME app will look like once its ported to Android.

Download J2ME WheelItem CustomItem

October 6th, 2007 1 Comment   Posted in J2ME / JavaME

This is an example of J2ME / JavaME CustomItem called WheelItem. It does nothing beside showing a spinning wheel on the phone screen. WheelItem is a perfect candidate to be displayed on a wait form screen replacing Gauge class while your application is performing lengthy operating.

WheelItem Screenshot

JAVA:
  1. import javax.microedition.midlet.*;
  2. import javax.microedition.lcdui.*;
  3. import java.util.*;
  4.  
  5. public class WheelItem extends CustomItem
  6. {
  7.   private int mCount,mMaximum;
  8.   private int mInterval;
  9.   private int mWidth,mHeight,mX,mY,mRadius;
  10.   private String mMessage;
  11.    
  12. public WheelItem(String title)
  13. {
  14.     super(title);
  15.     mCount=0;
  16.     mMaximum = 36;
  17.     mInterval = 100;
  18.  
  19.     TimerTask task = new TimerTask() {
  20.         public void run() {
  21.             mCount = (mCount+1) % mMaximum;
  22.             repaint();
  23.         }
  24.     };
  25.     Timer timer = new Timer();
  26.     timer.schedule(task,0,mInterval);
  27. }
  28.     public void setString(String string)
  29.     {
  30.         mMessage = string;
  31.         repaint();
  32.     }
  33.    
  34.     public void paint(Graphics g, int iWidth, int iHeight) {
  35.         mWidth = iWidth;
  36.         mHeight = iHeight;
  37.         int halfWidth = mWidth/2;
  38.         int halfHeight = mHeight/2;
  39.  
  40.         mRadius = Math.min(halfWidth,halfHeight);
  41.         mX = halfWidth - mRadius/2;
  42.         mY = halfHeight - mRadius/2;
  43.  
  44.         int theta = -(mCount*360/mMaximum);
  45.  
  46.         g.setColor(255,255,255);
  47.         g.fillRect(0,0,mWidth,mHeight);
  48.         g.setColor(0,0,0);
  49.         g.drawArc(mX,mY,mRadius,mRadius,0,360);
  50.         g.fillArc(mX,mY,mRadius,mRadius,theta+90,90);
  51.         g.fillArc(mX,mY,mRadius,mRadius,theta+270,90);
  52.        
  53.         if (mMessage !=null)
  54.         {
  55.             g.drawString(mMessage,mWidth/2,mHeight,Graphics.BOTTOM | Graphics.HCENTER);
  56.         }
  57.     }
  58.   public int getMinContentWidth() { return 80; }
  59.   public int getMinContentHeight() { return 80; }
  60.   public int getPrefContentWidth(int width) {return getMinContentWidth();}
  61.   public int getPrefContentHeight(int height) {return getMinContentHeight();}
  62. }

Download example application with WheelItem source : WaitFormDemo.zip

Ported (rather poorly) from Wheel canvas written by Jonathan Knudsen from his article - Networking, User Experiences and Threads.

Any suggestions or improvements are welcomed!

iPhoneCanvas – Fancy List component class for J2ME

October 1st, 2007 No Comments   Posted in J2ME / JavaME, Open Source

I found a really nice but simple to use fancy list chooser class that emulates an iPhone display. The class requires MIDP 2.0 supported phones and can replace the default and boring List chooser class into a stunning, smooth scrolling graphical menu (includes reflections) for your users to see

Here's example screenshot of iPhoneCanvas demo in action :

These menu icons are generated from flat and boring thumbnails like these :

Download
iPhoneCanvas is licensed under the GNU General Public License and can be downloaded from listchooser Google Code project page

Demo
The iPhoneCanvas demo featured in above screenshot can be downloaded here - fancylist.jar, fancylist.zip (demo source code)

Please submit bug reports or suggestions at Google Code listchooser page