Results 1 to 4 of 4
Thread: Method value not refreshing
- 04-27-2011, 09:28 PM #1
Member
- Join Date
- Apr 2011
- Posts
- 2
- Rep Power
- 0
Method value not refreshing
Hi to all.I am new to Java, and i've been so far developing in VB.NET.The syntax is very different, and that is a little problem to me.I am writing a program on JavaME in NetBeans and i have the method:
It's just fetching some string from webpage and it's working fine.I have a list with listitems that is calling the method:Java Code:private void pokazi(String link){ String url = link; if (zavrsna == null) { // write pre-init user code here zavrsna = new Form("form1"); zavrsna.addCommand(getBackCommand9()); zavrsna.setCommandListener(this); StringBuffer buffer = null; try{ StreamConnection conn = (StreamConnection) Connector.open(url); InputStream in = conn.openInputStream(); buffer = new StringBuffer(); int ch; while ( (ch = in.read())!= -1){ buffer.append( (char) ch); } } catch(Exception o){ o.printStackTrace(); } zavrsna.append(new StringItem(null, buffer.toString())); display=Display.getDisplay(this); display.setCurrent(zavrsna); url = null; } }
When it's called the first time, it works, but when I want to change to another item in list, nothing happens.I've tried to clean url in method byJava Code:public void polazak1Action() { // enter pre-action user code here String __selectedString = getPolazak1().getString(getPolazak1().getSelectedIndex()); if (__selectedString != null) { if (__selectedString.equals("Polazak M.Naselje")) { if (dan1.equals("Workday")){ pokazi("http://www.orion.naissus.info/index.asp?id=4"); } else if (dan1.equals("Satrday")){ pokazi("http://www.orion.naissus.info/index.asp?id=5"); } else if (dan1.equals("Sunday")){ pokazi("http://www.orion.naissus.info/index.asp?id=6"); } } }
orJava Code:url= null;
but it didn't work.I also don't know how NetBeans handle breakpoints in IDE.Java Code:url= "";
In hope that you will help me, best regards Aleksandar.
- 04-27-2011, 09:59 PM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 339
- Rep Power
- 5
It's hard to make out because the code is so poorly formatted, but it looks like pokazi only does something if zavrsna is null, and zavrsna is only null the first time through...
- 04-27-2011, 10:06 PM #3
Member
- Join Date
- Apr 2011
- Posts
- 2
- Rep Power
- 0
Wow,it works, i've missed that.Ty very much. 8)
- 04-27-2011, 10:21 PM #4
Senior Member
- Join Date
- Jun 2008
- Posts
- 339
- Rep Power
- 5
Similar Threads
-
JPanel not refreshing
By pahiker in forum SWT / JFaceReplies: 23Last Post: 07-14-2010, 02:59 PM -
Refreshing Jtable once again...
By Norther in forum AWT / SwingReplies: 2Last Post: 06-29-2010, 07:46 PM -
Refreshing JList - need help
By Unsub in forum New To JavaReplies: 1Last Post: 04-13-2010, 06:31 AM -
JTableHeader not refreshing
By aznboarder in forum AWT / SwingReplies: 4Last Post: 04-11-2009, 04:31 AM -
Bug in refreshing jsp
By anki1234 in forum JavaServer Pages (JSP) and JSTLReplies: 2Last Post: 12-31-2007, 07:09 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks