• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

How to read text file in memory card from MIDlet?

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to read text file in memory card from MIDlet?
 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Bharathi Dhas Krishnasamy
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Mr.Gobinath
 
Gopinath Karyadath
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are Welcome .. Happy Coding
 
Bharathi Dhas Krishnasamy
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the error message? And what value are you getting in file variable?
 
Bharathi Dhas Krishnasamy
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Swastik Dey
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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()?
 
Bharathi Dhas Krishnasamy
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Bharathi Dhas Krishnasamy
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Still I didn't get solution....!

Ranch help me soon...!
 
He loves you so much! And I'm baking the cake! I'm going to put this tiny ad in the cake:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic