java-me

How to read and write data into same file simultaneously

元气小坏坏 提交于 2019-11-28 11:41:10
I have read many a posts where-in they speak about reading and writing into the file NOT simultaneously using JavaME. I have a special use case scenarios where-in my log file (maybe full file or just portion of the file) is uploaded to the server on regular basis. This must continue without hampering the current logging of the application in this same file. The code sample is a under: boolean writing = true; boolean reading = true; void main() { new Thread("THREAD-FILE-READ") { public void run() { InputStream instream = getFileInStream(); if (null != instream) { while (reading) { try { try {

reading JSON on Blackberry OS pre 6.0

寵の児 提交于 2019-11-28 11:38:56
问题 I am trying to implement web services within an app, and the response of the web serivce is in JSON. How is it possible to parse simple json without net_rim_json_org module of BBOS 6.0? 回答1: For pre-6 BB OS people use JSON ME lib. 来源: https://stackoverflow.com/questions/7288204/reading-json-on-blackberry-os-pre-6-0

Processing chunked encoded HTTP POST requests in python (or generic CGI under apache)

混江龙づ霸主 提交于 2019-11-28 11:32:48
I have a j2me client that would post some chunked encoded data to a webserver. I'd like to process the data in python. The script is being run as a CGI one, but apparently apache will refuse a chunked encoded post request to a CGI script. As far as I could see mod_python, WSGI and FastCGI are no go too. I'd like to know if there is a way to have a python script process this kind of input. I'm open to any suggestion (e.g. a confoguration setting in apache2 that would assemble the chunks, a standalone python server that would do the same, etc.) I did quite a bit of googling and didn't find

How to modify values of a XML in J2ME?

泪湿孤枕 提交于 2019-11-28 11:25:56
问题 Suppose there is a XML in my J2ME application : <?xml version="1.0"?> <appli> <client id=134447> <name>Patrick</name> <email>patrick@mail.com</email> </client> </appli> How to modify from J2ME the node value "patrick@mail.com" for example ? 回答1: For you XML sample you could write a class like: class Client { String id; String name; String email; } And unmarshall your XML to it. I have shared a way of doing this with SAX from JSR 172 at http://smallandadaptive.blogspot.com.br/2010/11/xml-data

BlackBerry/J2ME - SAX parse collection of objects with attributes

匆匆过客 提交于 2019-11-28 10:59:19
问题 I have a problem with using the SAX parser to parse a XML file. It is a complex XML file, it is like the following. <Objects> <Object no="1"> <field name="PID">ilives:87877</field> <field name="dc.coverage">Charlottetown</field> <field name="fgs.ownerId">fedoraAdmin</field> </Object> <Object no="2">...... I am confused how to get the names in each field, and how to store the information of each object. import java.util.Enumeration; import java.util.Hashtable; public class XMLObject { private

How to use web service in J2ME application?

浪尽此生 提交于 2019-11-28 10:38:30
Can somebody specify the step for using web services in a J2ME application` I have downloaded Eclipse (SOA), have included the wsdl file in my code and have prepared web service in visual studio 2008. I want to use a .net web service in my J2ME application. Thanks You can consume webservices in j2me, following would be the architecture look like, Read More Here is a quick youtube tutorial If your phone does not support JSR172, or you want to target every phone in the market, you still can consume webservices manually. That is to say, you need to create an XML to invoke the service, and parse

Schedule a BlackBerry application

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-28 10:37:51
I want to schedule my application. try this // Get the current application descriptor. ApplicationDescriptor current = ApplicationDescriptor .currentApplicationDescriptor(); // Schedules are rounded to the nearest minute so ensure the // application is scheduled for at least 1 minute in the future. ApplicationManager.getApplicationManager().scheduleApplication( current, System.currentTimeMillis() + 60001, true); For more details you can read this article also. Schedule an application to run at a specific time 来源: https://stackoverflow.com/questions/3236108/schedule-a-blackberry-application

How to format a Date in Java ME?

大城市里の小女人 提交于 2019-11-28 10:21:53
问题 So I have a Date object and I want to create a method so that it prints the Date in the following format: 11 September 2011, 9:15pm How do I do that? As of now I am just doing a toString to the date and it gives me all the GMT information and seconds precision that I don't need. Do I have to use a DateFormatter or is there an easier way to do this? This was edited to include Java ME in the title and the tags after some of the answers that were correct for the original question were posted.

How to remove installed Java programs on the simulator?

邮差的信 提交于 2019-11-28 10:14:32
问题 There are lots of java apps on my simulator menu screen which I have been coding and testing? Now I want to remove some of them to clean my simulator a bit. How do I remove them? 回答1: Quote from Reset and clean the blackberry simulator: Are you sick of having a million icons on your BlackBerry simulator for every HelloWorld and demo project you have every tested? Try this to remove old programs from the simulator and start with a clean ribbon. From the command line browser to your rim jde

A unique identifier for cell phone other than IMEI or IMSI?

一世执手 提交于 2019-11-28 10:08:46
问题 I'd like to have an unique identifier for a cell phone. Since there is not a particular way to find IMEI or IMSI on every mobile, I want to know if there are other ways to find an unique identifier for a cellphone. Can anyone suggest a way? 回答1: You can use just time in millis if you don't need strong UID. Or you can get UUID implementation from J2SE and port it to J2ME. In this way UUID should be stored in RMS. One of the best way is to build server side and distribute app only via this