BlackBerry Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsMobile ProgrammingBlackBerry Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 28th, 2009, 02:45 PM
jamespayne's Avatar
jamespayne jamespayne is offline
Editor-in-Beef
Developer Shed Admin.
 
Join Date: Sep 2008
Location: South Florida
Posts: 326 jamespayne User rank is Lieutenant General (80000 - 90000 Reputation Level)jamespayne User rank is Lieutenant General (80000 - 90000 Reputation Level)jamespayne User rank is Lieutenant General (80000 - 90000 Reputation Level)jamespayne User rank is Lieutenant General (80000 - 90000 Reputation Level)jamespayne User rank is Lieutenant General (80000 - 90000 Reputation Level)jamespayne User rank is Lieutenant General (80000 - 90000 Reputation Level)jamespayne User rank is Lieutenant General (80000 - 90000 Reputation Level)jamespayne User rank is Lieutenant General (80000 - 90000 Reputation Level)jamespayne User rank is Lieutenant General (80000 - 90000 Reputation Level)jamespayne User rank is Lieutenant General (80000 - 90000 Reputation Level)jamespayne User rank is Lieutenant General (80000 - 90000 Reputation Level)jamespayne User rank is Lieutenant General (80000 - 90000 Reputation Level)jamespayne User rank is Lieutenant General (80000 - 90000 Reputation Level)jamespayne User rank is Lieutenant General (80000 - 90000 Reputation Level)jamespayne User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 5 Days 13 h 34 m 36 sec
Reputation Power: 10
Send a message via Yahoo to jamespayne
Post Advanced Java Programming for BlackBerry Smartphones

BlackBerry and Java have a long and storied history together. Since the launch of the BlackBerry 5810 in 2002, all BlackBerry smartphones have been Java-based. All core BlackBerry applications have been written in Java. As you can see, there are many benefits to being familiar with Java, especially as it pertains to being a BlackBerry developer. Read More...

Reply With Quote
  #2  
Old August 5th, 2009, 09:27 AM
Maxood Maxood is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2009
Posts: 3 Maxood Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 35 m 9 sec
Reputation Power: 0
Navigating through menu to other facts

I have written the following code and having problem incrementing/decrementing the variable 'idx' so that the user can navigate to the other fact by means of a menu. But for some reason the value of 'idx' does not alter. Why is that happening?

class FactScreen extends MainScreen{
public int idx;
public FactScreen()
{
super();

HorizontalFieldManager hfm = new HorizontalFieldManager(Manager.FIELD_HCENTER|Manager.NON_FOCUSABLE);
//LabelField lblFact = new LabelField("Sex Fact");
//add(lblFact);
String SexFacts[] = {"Light is a bad stimulus for sex", "It is always best to have sex after dinner", "Apart from humans dolphins do enjoy sex as well"};

int LeftEmptySpace = (Display.getWidth() - hfm.getPreferredWidth())/2;

int TopEmptySpace = Display.getHeight()/5; //- hfm.getPreferredHeight()*2);

hfm.setMargin(TopEmptySpace,0,0,LeftEmptySpace);

this.add(hfm);

RichTextField rtfFact = new RichTextField(SexFacts[idx]);
add(rtfFact);

// MenuItem MyMenuItem;

// MyMenuItem.toString("Next Fact");


addMenuItem(nextFact);
addMenuItem(MenuItem.separator(0));

addMenuItem(prevFact);
addMenuItem(MenuItem.separator(2));

}

private final MenuItem nextFact = new MenuItem("Next Fact",0,0)
{
public void run()
{
//Dialog.alert("Next Fact!");
idx = idx + 1; /*incrementing to go to the next fact*/
}


};

private final MenuItem prevFact = new MenuItem("Previous Fact",0,0)
{
public void run()
{
Dialog.alert("Previous Fact!");
idx = idx - 1;/*decrementing to go to the previous fact*/
}

};

}

Thanks,
Maxood

Reply With Quote
Reply

Viewing: Dev Shed ForumsMobile ProgrammingBlackBerry Development > Advanced Java Programming for BlackBerry Smartphones

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap