Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: j2me

  1. #1
    Junior Member
    Join Date
    Sep 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question j2me

    Hi...i want to print table format values from rms...am using this code...but not working properly...last values only printing multiple times...how to rectify tis error..pls suggest me...

    public Table getTable2() {
     
    		try {
    			//select data from OrderTempList database show on grid table
    		//recordstoretemp = RecordStore.openRecordStore("OrderTempListDB", true);
    			openRecStore();
    			byte[] byteInputData = new byte[200];
     
    			ByteArrayInputStream inputStream = new ByteArrayInputStream(
    					byteInputData);
    			DataInputStream inputDataStream = new DataInputStream(inputStream);
    			numrec = recordstoretemp.getNumRecords();
    			System.out.println("Total records :"+ numrec);
    			for (int j = 1; j <= numrec; j++) {
    				recordstoretemp.getRecord(j, byteInputData, 0);
     
    				Salesname = inputDataStream.readUTF();
    				Partyname = inputDataStream.readUTF();
    				Itemlist = inputDataStream.readUTF();
    				Listofweight = inputDataStream.readUTF();
    				Quantity = inputDataStream.readUTF();
    				Datetime = inputDataStream.readUTF();
     
    				System.out.println(Partyname + ":::" + Itemlist + ":::"
    						+ Quantity + ":::" + Listofweight);
     
    				try {
     
    					if (table2 == null) {
    						int a = numrec;
    						String SivaStore = Partyname.toString();
    						String ToorDhall = Itemlist.toString();
    						String kg = Listofweight.toString();
    						String aa = Quantity.toString();
     
    						TableCell cells[][] = new TableCell[a][4];
    						for (int i = 0; i < a; i++)
    						{
     
    							System.out.println("table values");
    							cells[i][0] = new TableCell(
    									TableCell.CellType.STRING1, SivaStore);
    							cells[i][1] = new TableCell(
    									TableCell.CellType.STRING2, ToorDhall);
    							cells[i][2] = new TableCell(
    									TableCell.CellType.STRING3, kg);
    							cells[i][3] = new TableCell(
    									TableCell.CellType.NUMBER, String
    											.valueOf(aa));
    						}
    						String header[] = new String[] { "PartyName",
    								"ItemName", "WightItem", "Quantity" };
     
    						setData(new int[] { 120, 80, 70, 70 }, header, cells);
     
     
    					}
    				} catch (ArrayIndexOutOfBoundsException e) {
    					// TODO: handle exception
    					System.out.println("Error" + e.getMessage());
    					//e.printStackTrace();
    				}
     
    				inputStream.reset();
    			}
    			closeRecStore();
    			inputStream.close();
    		}
     
    		catch (Exception error) {
    			error.printStackTrace();
     
    		}
    		return table2;
    	}


  2. #2
    Member
    Join Date
    Sep 2011
    Posts
    32
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: j2me

    Hi,

    What are you expecting the code will return?
    What is the error you get?

    java memory
    Last edited by namhm; December 4th, 2011 at 05:52 PM.

Similar Threads

  1. j2me Problem with choicegroup
    By zero22hero in forum Java ME (Mobile Edition)
    Replies: 1
    Last Post: January 7th, 2011, 01:23 AM
  2. J2ME converter program
    By sackling in forum What's Wrong With My Code?
    Replies: 0
    Last Post: December 6th, 2010, 08:13 AM
  3. J2ME application not launching
    By vishal21 in forum Java ME (Mobile Edition)
    Replies: 0
    Last Post: November 22nd, 2010, 12:15 PM
  4. problem in j2me
    By Sunil Raghuvanshi in forum Java ME (Mobile Edition)
    Replies: 1
    Last Post: March 9th, 2010, 08:08 AM
  5. Runtime exception while developing J2ME mobile application with aspectJ
    By yousef atya in forum Java ME (Mobile Edition)
    Replies: 3
    Last Post: April 29th, 2009, 09:55 AM