midp

Textbox on canvas in j2me

荒凉一梦 提交于 2020-01-15 09:23:06
问题 I am going to make application on j2me using canvas. I want to take textbox or textfield on my canvas. 回答1: You can draw a basic textbox and display a string , and when it receives focus, you can switch the view to that particular textbox ,something like this textBox = new TextBox(....); Midlet.display.setCurrent(textBox); This would create your data entry more robust and save you from the pain of implementing various keyboard issues yourselves 回答2: These items are only available for adding

In J2ME, How I obtain reference of all controls of the form to record form's controls state changes?

↘锁芯ラ 提交于 2020-01-03 03:24:08
问题 In my J2ME app, I want show an alert dialog box only when the user changes the state of any controls—that is, when the user uses any of the control of the form and then try to cancel the form without saving typed data. For example among all 5-6 controls of form if the user types in 1-2 textfields and tries to cancel the form without saving that typed data into database. An alert box should then display with the message "Save changes?" with Yes, No command. How to do this? This is my code

Find application mode, is it idle or not, in Java ME

跟風遠走 提交于 2020-01-03 01:23:24
问题 I want to send stored RMS data using an HTTP connection when the application is in idle mode. So if the user is not doing anything with the application at that time, my thread will invoke and send RMS data to server. For this requirement, how do I how find out if the application in active mode or idle mode? 回答1: You could wait for the backlight to go off, if that's enough of an indication of whether the application is active. Implement the SystemListener2 interface, there's a method

Reading UTF8 strings from a server through http using MIDP

瘦欲@ 提交于 2020-01-02 04:56:09
问题 I want to read UTF-8 strings from a server that I have control of, using java MIDP. My server is sending UTF-8 data. The following code gets close: c = (StreamConnection) Connector.open( myServer, Connector.READ_WRITE); InputStream is = c.openInputStream(); StringBuffer sb = new StringBuffer(); int ch; while((ch = is.read()) != -1) sb.append((char)ch + "->" + ch + "\n"); I print the char and its code to debugging purposes. I think it is reading ASCII chars here, so, when I have some char that

HttpConnection - javax.microedition, returning -1 for getLength() method

99封情书 提交于 2019-12-31 04:12:08
问题 I am trying to program a very simple Mobile Application (J2ME) in java. The idea is to access a website via URL input and read the contents of the website into a buffer. Here's the problem. This works perfectly fine for some URL's but not others? The example below (wikipedia) works fine. But take "http://java.com/en/about/" as an example and the "HttpConnection hc" returns -1 for getLenght() so there is no content to read into the buffer? Here's my code: String url = "http://en.wikipedia.org

HTTP authentication in J2ME

邮差的信 提交于 2019-12-29 06:56:34
问题 I'm trying to create a J2ME app, which talks to webserver using HttpConnection connector. When I am talking to the WebServer, I have to authenticate using Basic HTTP auth, which normally goes like http://username:password@website.com/rest/api/method But in J2ME, when I construct a url of this form, it doesn't work. I also tried adding request property, hc = (HttpConnection) Connector.open(url); hc.setRequestProperty("User", "alagu"); hc.setRequestProperty("pass", "mypassword"); but didn't

How to convert 12 hours time to 24 hours time in j2me?

你说的曾经没有我的故事 提交于 2019-12-24 16:27:24
问题 I am getting time from server it's like this 12:00PM-3:00PM,7:00PM-10:30PM This time in 12 Hours format. I applied some operation on this string and I separated all times. Now I have four strings like following (aftr1=> 12:00PM aftr2=> 3:00PM) (evng1=> 7:00PM evng2=> 10:30PM) Now I want to convert them in 24 hours time, because I want to check the time which was entered by user it is between afternoon time 12:00pm to 3:00pm or in evening 7:00pm to 10.30pm. Or any other idea how to complete

J2ME button command not working

会有一股神秘感。 提交于 2019-12-24 15:34:53
问题 I'm currently working on an j2me application and I'm having a hard time dealing with command button. Can someone please help me. The button was suppose to direct in a second form but when I click it, it's not working. Here's my code: import javax.microedition.midlet .*; import javax.microedition.lcdui .*; import javax.microedition.lcdui.StringItem; import javax.microedition.lcdui.TextField; import javax.microedition.lcdui.DateField; import javax.microedition.lcdui.Command; import javax

Upload a wav file using J2ME

这一生的挚爱 提交于 2019-12-24 04:07:13
问题 I am trying to upload a wav file to server using j2me httpconnection. However I am not able to do it. It throws null pointer exception when it's writing the bytes to the server. Sample is below. Exception is thrown at os.write(postBytes); line. Anyone with any idea? And the file I am uploading is test.pcm . public String send() throws Exception { form.append("Inside Send()"); bos = new ByteArrayOutputStream(); try { form.append("Making connections"); hc = (HttpConnection) Connector.open(url,

Trigonometry in CLDC 1.0 / MIDP 2.0 application

我是研究僧i 提交于 2019-12-24 02:07:32
问题 How can I use trigonometry in CLDC 1.0 / MIDP 2.0 application? I need "sin cos tan asin acos atan atan2" functions from standart Math library. Thanks 回答1: gnat knows 回答2: update to prior answer gnat knows Above link to Sun Forums became dead after migration to Oracle. If memory serves, back then I suggested to consider MicroFloat library. There is also a chance that mentioned Sun forums thread was migrated to this one: Sin & Cos with CLDC. Since message formatting was broken in migration and