×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    102

    Post resize an array in j2me

    can somebody please tell me how to resize array while keeping old values
    something like redim preserve in vb
    thanks

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: resize an array in j2me

    There is no direct equivalent of this.

    If you need a dynamically resizing array, use the Vector class.

    Graham.

  3. #3
    Super Contributor
    Join Date
    Jun 2007
    Location
    Mumbai
    Posts
    539

    Re: resize an array in j2me

    Try this :

    //these are the members
    private Object[] increaseCapacity(Object[] storedObjects, int growthFactor) {
    if(storedObject == null){
    throw new NullPointerException();
    }
    int currentCapacity = storedObjects.length;
    int newCapacity = currentCapacity + ((currentCapacity * growthFactor) / 100);
    if (newCapacity == currentCapacity ) {
    newCapacity++;
    }
    Object[] newStore = new Object[ newCapacity ];
    System.arraycopy( storedObjects, 0, newStore, 0, storedObjects.length );
    return newStore;
    }
    au revoir
    Prakash Raman

Similar Threads

  1. Acessing voice channel using J2ME
    By diegomello in forum VoIP
    Replies: 1
    Last Post: 2008-10-21, 15:57
  2. Porting BlackBerry: Carbide & J2ME Comparison.
    By skynetchris in forum Symbian
    Replies: 0
    Last Post: 2008-05-22, 07:09
  3. Can J2ME be used for sending MMS Message ?
    By seno_ap in forum Mobile Java General
    Replies: 1
    Last Post: 2006-11-24, 14:36
  4. need urgent guidance on j2me
    By cogni_niru in forum Mobile Java General
    Replies: 1
    Last Post: 2005-11-13, 15:02
  5. Does J2ME support array?
    By ongchiboon in forum Mobile Java General
    Replies: 1
    Last Post: 2003-12-17, 19:21

Posting Permissions

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