×
Namespaces

Variants
Actions
(Difference between revisions)

How to get device Java ME configuration information

From Nokia Developer Wiki
Jump to: navigation, search
valderind4 (Talk | contribs)
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot update - Add ArticleMetadata)
Line 1: Line 1:
[[Category:Java ME]][[Category:Code Examples]]
+
{{ArticleMetaData <!-- v1.2 -->
 +
|sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] -->
 +
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 +
|devices= <!-- Devices tested against - e.g. ''devices=Nokia 6131 NFC, Nokia C7-00'') -->
 +
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Qt SDK 1.1.4]) -->
 +
|platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later -->
 +
|devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) -->
 +
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 +
|signing= <!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
 +
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
 +
|keywords= <!-- APIs, classes and methods (e.g. QSystemScreenSaver, QList, CBase -->
 +
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 +
|translated-by= <!-- [[User:XXXX]] -->
 +
|translated-from-title= <!-- Title only -->
 +
|translated-from-id= <!-- Id of translated revision -->
 +
|review-by= <!-- After re-review: [[User:username]] -->
 +
|review-timestamp= <!-- After re-review: YYYYMMDD -->
 +
|update-by= <!-- After significant update: [[User:username]]-->
 +
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 +
|creationdate= 20090123
 +
|author= [[User:Mayurvihaar]]
 +
}}
 +
[[Category:Java ME]][[Category:Code Snippet]]
 
This is a very simple code of j2me. By implementing it and running it on your mobile device, you could learn some attributes of Java configuration of your mobile device.
 
This is a very simple code of j2me. By implementing it and running it on your mobile device, you could learn some attributes of Java configuration of your mobile device.
 
<code java>
 
<code java>

Revision as of 13:41, 18 July 2012

Article Metadata
Article
Created: User:Mayurvihaar (23 Jan 2009)
Last edited: hamishwillee (18 Jul 2012)

This is a very simple code of j2me. By implementing it and running it on your mobile device, you could learn some attributes of Java configuration of your mobile device.

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class AttributesMIDlet extends MIDlet{
private Display display;
private Command cExit;
public void startApp(){
display = Display.getDisplay(this);
cExit = new Command(”Quit”, Command.EXIT, 0);
Canvas canvas = new DummyCanvas();
Runtime runtime = Runtime.getRuntime();
Form form = new Form(Attributes);
form.append(new StringItem(”Know Your Mobile”, “”));
form.append(new StringItem(”Total Memory:”, String.valueOf(runtime.totalMemory()/1024)+”Kb”));
form.append(new StringItem(”Free Memory:”, String.valueOf(runtime.freeMemory()/1024)+”Kb”));
form.append(new StringItem(”n”, null));
form.append(System.getProperty(”microedition.configuration));
form.append(System.getProperty(”microedition.profiles));
boolean isColor = display.isColor();
form.append(new StringItem(isColor ? “Colors:: “Grays:”, String.valueOf(display.numColors())));
form.append(new StringItem(”Width: “, String.valueOf(canvas.getWidth())));
form.append(new StringItem(”Height:”, String.valueOf(canvas.getHeight())));
form.append(new StringItem(”Repeat:”, String.valueOf(canvas.hasRepeatEvents())));
form.append(new StringItem(Double Buff:”, String.valueOf(canvas.isDoubleBuffered())));
form.addCommand(cExit);
form.setCommandListener(
new CommandListener(){
public void commandAction(Command c, Displayable d){
if (c == cExit){
destroyApp(false);
notifyDestroyed();
}
}
}
);
display.setCurrent(form);[[Category:[[Category:Java ME]]]]
}
public void pauseApp(){
}
public void destroyApp(boolean unconditional){
}
}
class DummyCanvas extends Canvas{
public void paint(Graphics g){
;
}
}
72 page views in the last 30 days.
×