Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 81
Registered: ‎12-04-2012
My Device: BlackBerry@8520 smartphone(Edge,Wi-fi)
My Carrier: vodafone
Accepted Solution

Building My first App

Guys, I am new to the forum.I built a basic app which opens an Instant messaging menu-->System Messages.

However after giving a sleep of 1000ms the app switches to the MyScreen.java.However i Dont want My MyScreen to be visible.I want my IM Menu to stay on bb screen and then i want to navigate to menu-->options-->and to the screen that follows..Help me pzzz .And remember I am new to the community .Thanks


package mypackage;

import net.rim.device.api.system.ApplicationManager;
import net.rim.device.api.system.ApplicationManagerException;
import net.rim.device.api.system.SystemListener;
import net.rim.device.api.ui.UiApplication;

/**
 * This class extends the UiApplication class, providing a
 * graphical user interface.
 */
public class MyApp extends UiApplication implements SystemListener 
{
    /**
     * Entry point for application
     * @param args Command line arguments (not used)
     */ 
    public static void main(String[] args)
    {
    	//BlackBerryMessenger bbm= BlackBerryMessenger.getInstance();

   try {
			ApplicationManager.getApplicationManager().launchApplication("net_rim_bb_qm_peer");
		 } 
   	 catch (ApplicationManagerException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} 
   
   	 
   	 try {
			Thread.sleep(1000);
		 }
   	  catch (InterruptedException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

        // Create a new instance of the application and make the currently
        // running thread the application's event dispatch thread.
        MyApp theApp = new MyApp();       
        theApp.enterEventDispatcher();
    
        
   	 try
	 {
			Thread.sleep(1000);
	 }
	
   	 catch (InterruptedException e)
	 
	 {
			// TODO Auto-generated catch block
			e.printStackTrace();
	 }
   	
   }
   	 
   	 
    public MyApp()
    {        
        // Push a screen onto the UI stack for rendering.
        pushScreen(new MyScreen());
    }


	public void batteryGood() {
		// TODO Auto-generated method stub
		
	}


	public void batteryLow() {
		// TODO Auto-generated method stub
		
	}


	public void batteryStatusChange(int status) {
		// TODO Auto-generated method stub
		
	}


	public void powerOff() {
		// TODO Auto-generated method stub
		
	}


	public void powerUp() {
		// TODO Auto-generated method stub
		
	}    
}

 

Developer
Posts: 152
Registered: ‎07-28-2011
My Device: Bold 9900
My Carrier: MTN

Re: Building My first App

What you are saying and what your code is doing is very different.

 

Your code is launching BBM and then you create a new instance of your app but in your app constructor, you're pushing a new "MyScreen"

 

With a little more detail, nevermind the code at the moment, what is it that you are trying to achieve?

Developer
Posts: 434
Registered: ‎07-23-2012
My Device: Blackberry 10
My Carrier: Orange

Re: Building My first App

i have used your code so change MyScreen.java

 

import net.rim.device.api.system.Application;
import net.rim.device.api.system.ApplicationManager;
import net.rim.device.api.system.ApplicationManagerException;
import net.rim.device.api.ui.MenuItem;
import net.rim.device.api.ui.container.MainScreen;

/**
 * A class extending the MainScreen class, which provides default standard
 * behavior for BlackBerry GUI applications.
 */
public final class MyScreen extends MainScreen {
    /**
     * Creates a new MyScreen object
     */
    public MyScreen() {
        // Set the displayed title of the screen
        setTitle("MyTitle");
        addApplicationMenu(this);

    }

    /**
     * Adds a menu which allows the user to perform various message store
     * actions.
     *
     * @param mainScreen
     *            The screen to add the menu to
     */
    void addApplicationMenu(MainScreen mainScreen) {
        MenuItem appendUnreadMenuItem = new MenuItem("Open Messenger", 1, 1) {
            public void run() {
                try {
                    ApplicationManager.getApplicationManager()
                            .launchApplication("net_rim_bb_qm_peer");
                } catch (ApplicationManagerException e) {
                    e.printStackTrace();
                } finally {
                    Application.getApplication().requestBackground();
                }

            }
        };

        mainScreen.addMenuItem(appendUnreadMenuItem);

    }
}

 

and remove code from MyApp.java. your MyApp will be like this

 

**
 * This class extends the UiApplication class, providing a
 * graphical user interface.
 */
public class MyApp extends UiApplication
{
    /**
     * Entry point for application
     * @param args Command line arguments (not used)
     */
    public static void main(String[] args)
    {
        // Create a new instance of the application and make the currently
        // running thread the application's event dispatch thread.
        MyApp theApp = new MyApp();       
        theApp.enterEventDispatcher();
    }
    

    /**
     * Creates a new MyApp object
     */
    public MyApp()
    {        
        // Push a screen onto the UI stack for rendering.
        pushScreen(new MyScreen());
    }    
}

 

(or just copy pase code in your eclipse).

Thanks
-------------------------------------------------------------------------------------
Press the Accept as solution Button when u got the Solution
Press Kudo to say thank to developer.
-------------------------------------------------------------------------------------.
Developer
Posts: 81
Registered: ‎12-04-2012
My Device: BlackBerry@8520 smartphone(Edge,Wi-fi)
My Carrier: vodafone

Re: Building My first App

Alright, ir seems that i was a bit confusing in my previous post, i would like to reframe.

what i want is an application which when run,

1)opens my im icon

2)opens BlackBerry Messenger

3)then opens the popup menu

4)Goes to options

5)opens a new screen wherein we can see a field "save chat history" -

6)I just want to play with its setting

 

I found another way of doing this if i come 2 know the MenuId.

However i m not able to do so.

P.s. my code just takes me to the "System Messages" and thats it .I dont know how to go further.

If u cud help....

Highlighted
Developer
Posts: 81
Registered: ‎12-04-2012
My Device: BlackBerry@8520 smartphone(Edge,Wi-fi)
My Carrier: vodafone

Re: Building My first App

hiii yes you solved a majority of my problem.....Thanks

But there is a minor itch I want to automate the whole thing

That is.............i dont want to manually navigate through the menu bar.

What i want is on running my applications the

"Save my messages: to Device/to card be automatically be checked.

Is That possible????

Thanks a billion times however