Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

How to read text file in memory card from MIDlet?

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
 
Bharathi Dhas Krishnasamy
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Mr.Gobinath
 
Gopinath Karyadath
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are Welcome .. Happy Coding
 
Bharathi Dhas Krishnasamy
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • 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.
 
Rancher
Posts: 2265
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • 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
  • 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
Rancher
Posts: 2265
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • Quote
  • Report post to moderator
Still I didn't get solution....!

Ranch help me soon...!
 
Grow a forest with seedballs and this tiny ad:
ScroogeXHTML 9.0 - RTF to HTML5 and XHTML converter
https://coderanch.com/t/731949/ScroogeXHTML-RTF-HTML-XHTML-converter
    Bookmark Topic Watch Topic
  • New Topic