Then you just need to rewrite the AJAX XMLHttpRequest to send a request using Java's Connection : HTTPConnection/HTTPSConnection instead. Methods GET and Post are supported by HTTPConnection, the url is of course supported, and you can use a Thread/Runnable combo for async=true).

Java ME can also process XML using the SAX parser from SAXParserFactory (javax.xml.parsers) In JSR 172. So that takes care of the response part. But, with SAX you need to do your own work overwriting the methods of the DefaultHandler class.

Java ME can do SMS.

Priyanka Gawada

Greenhorn

Posts: 12

posted 4 years ago

Thanks for the reply.
Call up server is fine, still Javascript will be required to send asynchronous call. So, may be AJAX is still not possible on J2ME.
I heard about Java ME. But not understood what it is clearly?
Do you have any idea regarding this?

That means the screen graphics forms:
Alert,
Form (and its associated items: ChoiceGroup, CustomItem, DateField, Gauge, ImageItem, Spacer, StringItem, TextField),
List,
TextBox
Or make your own screens with Canvas, or GameCanvas and their assosiated paint() method and Graphics object.

Walter Gabrielsen Iii

Ranch Hand

Posts: 158

posted 4 years ago

You don't need Javascript for asynchronous tasks because you've got Java! To be more specific asynchronous (done at the same time) tasks are done in Java using Threads.

In Java ME you have the following options:

1. run() method and Thread Object:
java.lang.Runnable -- the run() method a class needs to implement to run its run() asynchronously.
java.lang.Thread -- the object that you need to "start()" the Runnable task in its own thread of execution(asynchronous task).

2. Timer, TimerTaskjava.util.TimerTask -- this is like Runnable but for tasks that can be scheduled with a time setting.
java.util.Timer -- this is like Thread but with time scheduling instead of starting things right away.

Also if you learn about methods Object.wait(), Object.notify(), Thread.interrupt(), Timer.cancel(), and the synchronized block features of Java then you can extend the lifetime of your threads, and have them wait in the background not wasting resources until something happens.

Walter Gabrielsen Iii

Ranch Hand

Posts: 158

posted 4 years ago

What is Java ME? Java ME is the mobile edition (ME) of the Java programing language. Java is an object-oriented, platform independent --so you don't need a specific Operating System or computer platform to run it-- language for programmers who want their programs to run on many different platforms without needing to recompile their program for each one.