Forums Register Login

How to read text file in memory card from MIDlet?

+Pie Number of slices to send: Send
How to read text file in memory card from MIDlet?
+Pie Number of slices to send: Send
+Pie Number of slices to send: Send
Thank you Mr.Gobinath
+Pie Number of slices to send: Send
You are Welcome .. Happy Coding
+Pie Number of slices to send: Send
Hi Gobinath actually I have to retrieve data from file in memory card and show in display.
I’m still struggle with that.
I got a error in “ FileConnection fileConnection = (FileConnection) Connector.open(file);” line.
But I could get memory card path.
+Pie Number of slices to send: Send
What is the error message? And what value are you getting in file variable?
+Pie Number of slices to send: Send
 

Swastik Dey wrote:What is the error message? And what value are you getting in file variable?



MCTest.java



MCReadDemo.java


I got this output in my Mobile

Your file location:
file:///E:/download/MyFile.txt

Your file Data:
Your Data:

My Track:
1 2 3 5 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 9 11 14
+Pie Number of slices to send: Send
You track counter never gets a value of 8, it means it is failing to satisfy

if (ch == 13) {

and the data is not getting appended to the vector.

So in addition to new line character, there might be carriage return character as well.

Instead of checking for one character, how about using readUTF()?
+Pie Number of slices to send: Send
MCReadDemoMidlet


MCTest



I got this Exception


Starting emulator in execution mode
Installing suite from: http://127.0.0.1:1993/MCReadDemo-2.jad
java.lang.IllegalArgumentException
at javax.microedition.io.Connector.openPrim(), bci=51
at javax.microedition.io.Connector.open(), bci=3
at javax.microedition.io.Connector.open(), bci=3
at javax.microedition.io.Connector.open(), bci=2
at hello.MCTest.readfile(MCTest.java:31)
at hello.MCTest.<init>(MCTest.java:18)
at hello.MCReadDemoMidlet.<init>(MCReadDemoMidlet.java:17)
at java.lang.Class.newInstance(), bci=0
at com.sun.midp.main.CldcMIDletLoader.newInstance(), bci=46
at com.sun.midp.midlet.MIDletStateHandler.createMIDlet(), bci=66
at com.sun.midp.midlet.MIDletStateHandler.createAndRegisterMIDlet(), bci=17
at com.sun.midp.midlet.MIDletStateHandler.startSuite(), bci=27
at com.sun.midp.main.AbstractMIDletSuiteLoader.startSuite(), bci=52
at com.sun.midp.main.CldcMIDletSuiteLoader.startSuite(), bci=8
at com.sun.midp.main.AbstractMIDletSuiteLoader.runMIDletSuite(), bci=161
at com.sun.midp.main.AppIsolateMIDletSuiteLoader.main(), bci=26

Anyone can help?
+Pie Number of slices to send: Send
+Pie Number of slices to send: Send
Still I didn't get solution....!

Ranch help me soon...!
I’m tired of walking, and will rest for a minute and grow some wheels. This is the promise of this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 4859 times.
Similar Threads
reading file from server?
How to read a huge file from memory card?
Need to access Record Store from another midlet
How to play an mp3 file
Reading file from memory card
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 02:04:36.