Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Please help me, you all are my last change

Dear all,

I am new programmer of j2me.I have made a program which read data(text data) from a perticular webpage and after parsing it will show the data on a Form.When i run this program on PC using "J2ME Wireless Toolkit2.2" it works fine but when i run downloaded .jad/.jar file on a mobile it cannot read data from net shows "empty".All other part of the program run fine on mobile but cannot read data from a page.What should i do now.Please give me a solution,I am in deep trouble,please help me.My email address : sumon_192003@hotmail.com

Any help ,please send to this address.

Thank u all,

sumon.

Simple version of my program are as follows:

import java.io.*;

import javax.microedition.midlet.*;

import javax.microedition.io.*;

import javax.microedition.lcdui.*;

public class QuotesMIDlet extends MIDlet {

private Display display;

private String url = "http://www.yahoo.com";

public Form first_form;

public QuotesMIDlet() {

display = Display.getDisplay(this);

first_form = new Form("Updated list");

display.setCurrent(first_form);

}

public void startApp() {

try {

downloadPage(url);

} catch(IOException e)

{

first_form.append(new StringItem("","Error##"+e));

}

}

private void downloadPage(String url) throws IOException

{

StringBuffer b = new StringBuffer();

InputStream is = null;

HttpConnection c = null;

TextBox t = null;

try {

int ch;

c = (HttpConnection)Connector.open(url);

is = c.openInputStream();

//c.setRequestMethod(HttpConnection.GET);

while((ch=is.read())!=-1)

{

System.out.println("Charecter "(char)ch"Value of charecter "+ch);

first_form.append(new StringItem("# ",""+(char)ch));

}

//first_form.append(new StringItem("# ",""+is.read()));

}

catch(IOException e)

{

first_form.append(new StringItem("","Error##"+e));

}

finally {

is.close();

c.close();

}

}

public void pauseApp() {

}

public void destroyApp(boolean unconditional) {}

}

Former Member
Not what you were looking for? View more on this topic or Ask a question