BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 02-04-2010, 12:17 AM   #1 (permalink)
New Member
 
Join Date: Jan 2010
Model: 8520
PIN: N/A
Carrier: airtel-india
Posts: 11
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default how to Navigate from Menu to Screen?

Please Login to Remove!

hi..i have created new Menu and Screen. i have added this new Menu in exsiting BB application. now i want if i click on Menu , New Screen should display. Can any one send me source code of his?


thanks
Offline  
Old 02-04-2010, 01:19 AM   #2 (permalink)
Knows Where the Search Button Is
 
Join Date: Apr 2009
Model: 8800
PIN: N/A
Carrier: Airtel
Posts: 31
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by sam04 View Post
hi..i have created new Menu and Screen. i have added this new Menu in exsiting BB application. now i want if i click on Menu , New Screen should display. Can any one send me source code of his?


thanks
sample code:

addMenuItem(new MenuItem("Open Sample Screen", 0, 100)
{
public void run()
{
_app.pushScreen(_sampleScreen);
}
});
Offline  
Old 02-04-2010, 01:57 AM   #3 (permalink)
New Member
 
Join Date: Jan 2010
Model: 8520
PIN: N/A
Carrier: airtel-india
Posts: 11
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi..still i did't get this ..

i am sending my Source code...please check and tell me where i am doing mistake..

thanks



import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.blackberry.api.menuitem.*;

class TestMenuApp extends UiApplication {

public static void main(String args[]) {
System.out.println("main");
TestMenuApp tma = new TestMenuApp();
tma.enterEventDispatcher();
}

TestMenuApp() {

SmsMenu sm = new SmsMenu(3, "MyMenu");
ApplicationMenuItemRepository.getInstance().addMen uItem(
ApplicationMenuItemRepository.MENUITEM_MESSAGE_LIS T, sm);
ApplicationMenuItemRepository.getInstance().addMen uItem(
ApplicationMenuItemRepository.MENUITEM_SMS_VIEW, sm);
ApplicationMenuItemRepository.getInstance().addMen uItem(
ApplicationMenuItemRepository.MENUITEM_SMS_EDIT, sm);

pushScreen(new MyScreen());
}
}

class SmsMenu extends ApplicationMenuItem {
String myname;

SmsMenu(int order, String name) {
super(order);
myname = name;
}

public String toString() {
return myname;
}

public Object run(Object context) {
return context;
}

}

class MyScreen extends MainScreen {
public MyScreen() {
super();
LabelField lfd = new LabelField("Welcome ");
setTitle(lfd);
}
}
Offline  
Old 02-04-2010, 07:20 AM   #4 (permalink)
Knows Where the Search Button Is
 
Join Date: Apr 2009
Model: 8800
PIN: N/A
Carrier: Airtel
Posts: 31
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

You should be using MenuItem class for creating menu items just like in the sample code. Next you must also call addMenuItem on the application and define a run for the MenuItem.

You are using ApplicationMenuItemRepository that is used for adding menu items to other applications.
Offline  
Old 02-05-2010, 12:33 AM   #5 (permalink)
New Member
 
Join Date: Jan 2010
Model: 8520
PIN: N/A
Carrier: airtel-india
Posts: 11
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi.....After creating new Menu , i have to add this Menu in exiting BB application. suppose , i want add this menu in Phone Call application..for that what i have to do....

i wrote code for that but i am not getting exact


import net.rim.device.api.ui.MenuItem;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.RichTextField;
import net.rim.device.api.ui.container.MainScreen;

public class CreateMenu extends UiApplication {

public static void main(String args[]) {
CreateMenu theApp = new CreateMenu();
theApp.enterEventDispatcher();
}
}

class CreateMenuScreen extends MainScreen {
public CreateMenuScreen() {
addMenuItem(viewItem);
}

public MenuItem viewItem = new MenuItem("MyMenu", 100, 100) {

public void run() {

CreateMenuScreen myscreen = new CreateMenuScreen();
setTitle("Welcome Message");
add(new RichTextField("create menu"));
UiApplication.getUiApplication().pushScreen(myscre en);
}

};
}


please check this code and tell me ,where i am doing mistake...

thanks
Offline  
Old 02-05-2010, 02:41 AM   #6 (permalink)
Knows Where the Search Button Is
 
Join Date: Apr 2009
Model: 8800
PIN: N/A
Carrier: Airtel
Posts: 31
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Adding custom menu items to pre-existing applications should be done using ApplicationMenuItem as you were using previously.

On reviewing your previous code, the problem of screen not getting displayed is because you need to override the run method of SmsMenu class and call pushScreen for the desired screen object.

Last edited by pooja.a.maheshwari : 02-05-2010 at 02:42 AM.
Offline  
Old 02-05-2010, 04:31 AM   #7 (permalink)
New Member
 
Join Date: Jan 2010
Model: 8520
PIN: N/A
Carrier: airtel-india
Posts: 11
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

thank you .....finally , i got it..
Offline  
Old 02-09-2010, 11:07 PM   #8 (permalink)
New Member
 
Join Date: Jan 2010
Model: 8520
PIN: N/A
Carrier: airtel-india
Posts: 11
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default how to create screen like AutoText's Screen??

hi

can anyone tell me? how to create a screen like AutoText screen? where i can scroll and select. if anyone have solution pls send me..

thanks you
Offline  
Old 02-10-2010, 01:51 AM   #9 (permalink)
New Member
 
Join Date: Feb 2010
Model: 7100T
PIN: N/A
Carrier: bag
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

thank you for the information
Offline  
Closed Thread


Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.