×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Regular Contributor
    Join Date
    May 2008
    Location
    Kochi,Kerala,India
    Posts
    105

    rms reading problem in S40

    when i am reading data from rms in S60 (E50)device its coming like.
    a
    b
    c
    but when i am reading in S40(6220 classic) device its coming like
    c
    b
    a
    this is the expected behavior or i am doing something wrong.
    Be hungry,Be foolish
    vivart pandey

  2. #2
    Nokia Developer Expert
    Join Date
    Aug 2007
    Posts
    1,595

    Re: rms reading problem in S40

    Hello vivart pandey,

    i am reading in S40(6220 classic) device
    Do you mean this device?: http://www.forum.nokia.com/devices/6220_classic/

    Or this instead?: http://www.forum.nokia.com/devices/6220/


    Regards,
    r2j7
    [URL="http://library.forum.nokia.com/java"][B] >>> Java Developer's Library <<<[/B][/URL]
    [URL="https://www.developer.nokia.com/Resources/Support/Technical_support.xhtml"] [B]>>> Technical Support for Java ME development <<<[/B][/URL]
    [URL="https://publish.ovi.com/info/"][B]>>> Nokia Publish: reach millions of Nokia users worldwide through Nokia Store <<<[/B][/URL]

  3. #3
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: rms reading problem in S40

    AFAIK this is not the excepted behavior for sure. you should get the data in the same order in which you have saved the same.

    Are you directly reading the data from the RMS and displaying this or are you doing some sort of sorting?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  4. #4
    Regular Contributor
    Join Date
    May 2008
    Location
    Kochi,Kerala,India
    Posts
    105

    Re: rms reading problem in S40

    Quote Originally Posted by r2j7 View Post
    Hello vivart pandey,



    Do you mean this device?: http://www.forum.nokia.com/devices/6220_classic/

    Or this instead?: http://www.forum.nokia.com/devices/6220/


    Regards,
    r2j7
    ohh sorry i think its not the problem of S40 than whats the problem.
    here i have created simple rms demo for testing this.
    Code:
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    package hello;
    
    import javax.microedition.rms.RecordEnumeration;
    import javax.microedition.rms.RecordStore;
    import javax.microedition.rms.RecordStoreException;
    import javax.microedition.rms.RecordStoreNotOpenException;
    
    /**
     *
     * @author vivart
     */
    public class Store {
    
        private RecordStore rs = null;
        static final String REC_STORE = "store";
    
        void open() {
            try {
                rs = RecordStore.openRecordStore(REC_STORE, true);
            } catch (RecordStoreException ex) {
                ex.printStackTrace();
            }
        }
    
        void close() {
            try {
                rs.closeRecordStore();
            } catch (RecordStoreException ex) {
                ex.printStackTrace();
            }
        }
    
        public void add(String name) {
            open();
            try {
                byte[] bytes1 = name.getBytes();
                rs.addRecord(bytes1, 0, bytes1.length);           
            } catch (RecordStoreException ex) {
                ex.printStackTrace();
            } finally {
                close();
            }
        }
    
    
    
        public String[] read(){
             RecordEnumeration re = null;
              String[] data = null;
            open();
            try {
             re = rs.enumerateRecords(null, null, false);
             data = new String[rs.getNumRecords()];
            for (int i = 0;re.hasNextElement();i++) {
                  byte[] nextRec = re.nextRecord();
                 data[i] = new String(nextRec);
            }
            }catch (RecordStoreNotOpenException ex) {
                ex.printStackTrace();
            }catch (RecordStoreException ex) {
                    ex.printStackTrace();
                }finally{
                    close();
                }
                return data;
        }
    
    }
    i have tested on RDA nokia devices
    nokia 5630 xpressMusic
    nokia 5320 xpressmusic
    and its displaying
    D
    C
    B
    A
    i have attached the jar file and screen shot of E50 and nokia 5320 xpressmusic.
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by vivartpandey; 2010-05-13 at 10:09.
    Be hungry,Be foolish
    vivart pandey

  5. #5
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: rms reading problem in S40

    Can you try this using the for loop rather than the enumeration just for the testing ?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  6. #6
    Regular Contributor
    Join Date
    May 2008
    Location
    Kochi,Kerala,India
    Posts
    105

    Re: rms reading problem in S40

    Quote Originally Posted by raj_J2ME View Post
    Can you try this using the for loop rather than the enumeration just for the testing ?

    yeah without enumeration i am getting expected output.

    Code:
    public String[] read() {
    
            String[] data = null;
            open();
            try {
               
                data = new String[rs.getNumRecords()+1];
                for (int i = 1; i <= rs.getNumRecords(); i++) {
                    // Allocate more storage if necessary
                  
                    data[i] = new String(rs.getRecord(i));
                }
    
    
            } catch (RecordStoreNotOpenException ex) {
                ex.printStackTrace();
            } catch (RecordStoreException ex) {
    
                ex.printStackTrace();
            } finally {
                close();
            }
            return data;
        }
    Be hungry,Be foolish
    vivart pandey

  7. #7
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: rms reading problem in S40

    Well done..

    For this time being you can continue with the For Loop. We hope that some Forum Nokia Expert/Champion/Other will put some light on this and we can discuss the same in much more details.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  8. #8
    Regular Contributor
    Join Date
    May 2008
    Location
    Kochi,Kerala,India
    Posts
    105

    Re: rms reading problem in S40

    Quote Originally Posted by raj_J2ME View Post
    Well done..

    For this time being you can continue with the For Loop. We hope that some Forum Nokia Expert/Champion/Other will put some light on this and we can discuss the same in much more details.
    yeah i will wait for that because i don't like this method over enumeration.
    Be hungry,Be foolish
    vivart pandey

  9. #9
    Nokia Developer Expert
    Join Date
    Aug 2007
    Posts
    1,595

    Re: rms reading problem in S40

    Hello,

    checked this further: based on hands-on testing, the affected devices seem to be those of S60 3rd Edition and S60 3rd Edition, Feature Pack 1. Tests with S60 3rd Edition, Feature Pack 2 devices which use latest sw version suggest that this seems to be fixed in those i.e. enumeration works there as expected. Unfortunately I don't have older sw versions for S60 3rd Ed., FP2 devices to test whether they are affected also. Will have to check this to ensure.

    A premature suggestion to troubleshoot this for S60 and Symbian devices: according to this article in Forum Nokia Wiki, the System.getProperty("microedition.platform"); query returns Java Runtime information (java_build_version) for the latest builds with the fix, while the S60 devices without the fix return the standard device model / firmware version info pair. So accordingly this could be used as follows:

    String mep = System.getProperty("microedition.platform");

    int value = value=mep.indexOf("java_build_version");

    if(value!=-1) {

    doEnum();

    }

    else{

    doWithoutEnum();

    }


    Regards,
    r2j7
    Last edited by r2j7; 2010-05-23 at 22:20.
    [URL="http://library.forum.nokia.com/java"][B] >>> Java Developer's Library <<<[/B][/URL]
    [URL="https://www.developer.nokia.com/Resources/Support/Technical_support.xhtml"] [B]>>> Technical Support for Java ME development <<<[/B][/URL]
    [URL="https://publish.ovi.com/info/"][B]>>> Nokia Publish: reach millions of Nokia users worldwide through Nokia Store <<<[/B][/URL]

  10. #10
    Nokia Developer Expert
    Join Date
    Aug 2007
    Posts
    1,595

    Re: rms reading problem in S40

    Checked with Java Runtime for Symbian architects, according to them this is based on MIDP spec which specifies the following for the enumerateRecords:

    "If both the filter and comparator is null, the enumeration will traverse all records in the record store in an undefined order."

    So basically what the enumerateRecords(null, null, <boolean>) returns (i.e. sorting order) is dependable of the implementation by each platform.

    In case of need to have records in specified order, then RecordComparator needs to be used for the purpose.

    Regards,
    r2j7
    [URL="http://library.forum.nokia.com/java"][B] >>> Java Developer's Library <<<[/B][/URL]
    [URL="https://www.developer.nokia.com/Resources/Support/Technical_support.xhtml"] [B]>>> Technical Support for Java ME development <<<[/B][/URL]
    [URL="https://publish.ovi.com/info/"][B]>>> Nokia Publish: reach millions of Nokia users worldwide through Nokia Store <<<[/B][/URL]

Similar Threads

  1. Modules required :)
    By neil.young in forum Symbian
    Replies: 20
    Last Post: 2009-06-07, 11:35
  2. Rms problem
    By vigneshkrish in forum Mobile Java General
    Replies: 16
    Last Post: 2009-04-17, 07:09
  3. STLPort namespace issue
    By yickhong in forum Open C/C++
    Replies: 0
    Last Post: 2009-04-09, 08:54
  4. 3500 (s40) playing audio problem
    By ahmadi2c in forum Mobile Java General
    Replies: 2
    Last Post: 2007-03-07, 08:03
  5. Facing problem with RMS
    By aditya.binju in forum Mobile Java General
    Replies: 1
    Last Post: 2006-12-04, 12:06

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×