Home | Русский

Finding multimedia content-type support of a mobile device

MMAPI gives facility of playing audio/video on mobile phones. MMAPI’s content-type/protocol support depends upon the mobile device capabilities.
The example below displays the mulitmedia file formats that are supported on a mobile phone:

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.media.Manager;

public class Midlet extends MIDlet implements CommandListener {

private static final Command exit = new Command(”Exit”, Command.EXIT, 0);
private static final Command detail [...]

Posted in: J2ME by admin No Comments , , ,

How to use ChoiceGroup in J2ME

This J2ME tips illustrates method of using a ChoiceGroup in mobile applications.
ChoiceGroup is a group of selectable elements intended to be placed within a Form.

import javax.microedition.lcdui.Choice;
import javax.microedition.lcdui.ChoiceGroup;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.midlet.*;

public class Midlet extends MIDlet implements CommandListener {

private Display display;
private Form form;
[...]

Posted in: J2ME by admin No Comments , ,

Validate the size of a TextField

import com.planstick.business.User;
import com.planstick.event.PlanStickEvent;
import com.planstick.event.PlanStickEventListener;
import com.planstick.main.OC;
import com.planstick.net.Session;
import com.planstick.utils.Record;
import javax.microedition.lcdui.*;

public class LoginSettings extends Form implements CommandListener{
private TextField pasw = null;
private TextField login = null;
private Command save = new Command(”Save”, Command.OK, 0);
private Command back = new Command(”Back”, Command.BACK, 1);
private Command ok = new Command(”OK”, Command.ITEM, 1);

public LoginSettings(User user) {
super(”");
if(user == null){
login = new TextField(”Login:”, “”, 30, TextField.ANY);
pasw = [...]

Posted in: J2ME by admin No Comments , ,

Android – TableLayout Samples

Today’s sample code will implement very similar UI to the one created in the LinearLayout Example. But here we will be using a TableLayout widget instead.
Each TableLayout consists of a number of TableRow objects and each TableRow object contains zero or more cells. Each cell can hold one View object. The table has as many [...]

Posted in: Android by admin No Comments ,

Detect Bluetooth API optional package (JSR 82)

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class MMain extends MIDlet implements CommandListener
{
private Form form;

// Check if Bluetooth API optional package (JSR 82) is present.
public static boolean hasBluetoothAPI ()
{
try
{
Class.forName (”javax.bluetooth.LocalDevice”);
return true;
}
catch (Exception _ex)
{
return false;
}
}

// Return the Bluetooth API version of this device, null if API is not present…
public static String verBluetoothAPI ()
{
// Initialize return value…
String version = null;
// First [...]

Posted in: J2ME by admin No Comments , , ,

Java – Applet

Here is a suitable piece of HTML to test a simple HelloWorld class:
You can not see this brilliant Java Applet.
Test
Put this in a file called:
test.HelloWorld.html
The code for the HelloWorld applet has to be a public class called “HelloWorld” that extends Applet and is in in a Java file called:
HelloWorld.java
Here is the Java code:

import java.applet.*;

import java.awt.*;

public [...]

Posted in: J2SE by admin No Comments , ,

J2ME – Images, Tickers and Gauges

Using images, tickers, and gauges as UI elements in MIDlets is quite straightforward. A gauge, as you saw in the last section, is an item that can only be displayed on a form to indicate progress or to control a MIDlet feature (like volume). A ticker, on the other hand, can be attached to any [...]

Posted in: J2ME by admin 1 Comment , , , ,

J2ME – Form

A form is a collections of instances of the Item interface. The TextBox class (discussed in the preceding section) is a standalone UI element, while the TextField is an Item instance. Essentially, a textbox can be shown on a device screen without the need for a form, but a text field requires a form.
An item [...]

Posted in: J2ME by admin No Comments , ,

J2ME – TextBox

TextBox
Text is entered by the user using a textbox. Like the other UI elements, a textbox has simple features that can be set based on your requirements. You can restrict the maximum number of characters that a user is allowed to enter into a textbox, but you need to be aware of the fact that [...]

Posted in: J2ME by admin No Comments , ,

Convert ARGB to RGB in J2ME

Creating an image from an array of data is an easy task, but to create a byte-array of data from an image is a little more complicated.
To create a byte-array of data from an image, we can use the getRGB(..) method in the image class in MIDP 2.0.
From the getRGB method we get an int-array [...]

Posted in: J2ME by admin No Comments , ,