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

Reply
Developer
Posts: 587
Registered: ‎01-19-2010
My Device: BOLD 9700 OS5.0.0.x on Rogers Canada
My Carrier: Rogers

Re: Problems storing information

Wow, I can't believe that I missed that his method was outside main XD.

----------------------------------------------------------------------------
chown -R us ./base
~J!NX
Contributor
Posts: 10
Registered: ‎03-04-2010
My Device: Blackberry Curve 8300
My Carrier: Telus

Re: Problems storing information

Hi,

 

I've been able to store the infos I needed to be stored into the BlackBerry and also had these infos ouputed into the console window.

 

But I'm still not able to view my  "Hello World" into that console. I tried to debug the line in error with breakpoints but when it comes to that lines I have an error in the "problems" console.

 

Here is a printscreen of the errors I have. Considering my lack of knowing into JAVA/BlackBerry dev. I really have no idea what this could be. I searched out on the Web but without success.

 

 

Thanks for all the support you're giving me.

 

Developer
Posts: 77
Registered: ‎01-27-2010
My Device: Bold 9000
My Carrier: AT&T

Re: Problems storing information

[ Edited ]

Look at the screenshot you provided.  Notice that under the "Problems" tab there are two things listed, the second one says "Warning: Ecrire() not invoked".  Since this is the method that prints "Hello, World" and you never call that method "Hello World" will never be printed. Here's the code you would need

 

public class Example extends UiApplication
{

public static void main(String[] args)
{
//Beginning of program
Example app = new Example();
app.enterEventDispatcher();

}

public Example() //Constructor
{
ecrire();
}

public void ecrire()
{
System.out.println("Hello, World");
}
}

I'll try to go through it.  The main method is the first one you'll see in that code.  This is what starts the program (you must always have a main method somewhere in your program).   From there it calls the constructor of the class when we type "new Example()".  That executes the constructor, the constructor then calls the method ecrire() which prints "Hello, World".  The enterEventDispatcher() method is specific to BlackBerry.

 

 

I'd really recommend trying to learn just Java first and then go into BlackBerry development once you've got the hang of that. 

Contributor
Posts: 10
Registered: ‎03-04-2010
My Device: Blackberry Curve 8300
My Carrier: Telus

Re: Problems storing information

Thanks a lot!

 

Yeah, you're right. I never developped in Java before and I usually developp in PHP and it's really not the same thing.

 

Thanks again for your support!

Developer
Posts: 77
Registered: ‎01-27-2010
My Device: Bold 9000
My Carrier: AT&T

Re: Problems storing information

 


lucas_cote wrote:

Thanks a lot!

 

Yeah, you're right. I never developped in Java before and I usually developp in PHP and it's really not the same thing.

 

Thanks again for your support!


Not a problem.  The area where you're having problems is that PHP starts executing at the top of the file and works its way down.  This does not work in Java: all code must be in methods and their position in the file does not matter.  Have you done any object oriented programming with PHP?  If you have it might be possible to go directly into BlackBerry development but if not I would definitely learn Java by itself first.  Alternatively if you really want to develop for BlackBerry you can develop web applications for the BlackBerry.

 

Highlighted
Developer
Posts: 587
Registered: ‎01-19-2010
My Device: BOLD 9700 OS5.0.0.x on Rogers Canada
My Carrier: Rogers

Re: Problems storing information

There are many Java tutorials available if you need to brush up. No shame in inexperience Smiley Happy

 

Bonne chance,

~Dom

----------------------------------------------------------------------------
chown -R us ./base
~J!NX