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
Contributor
Posts: 28
Registered: ‎11-13-2012
My Device: none
My Carrier: 27768965251

Re: Basic HTTP Get or POST data

Hey Peter,

 

Could you perhaps explain to me how to use this site?

http://www.blackberry.com/developers/docs/6.0.0api/index.html

 

Since I'm new to blackberry development, this is like a complete overload to me.

Developer
Posts: 17,025
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Basic HTTP Get or POST data

i usually use ctrl+f to find the class i am looking for, then click on it and read about it in the right frame.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Basic HTTP Get or POST data

Yes there is a steep learning curve, not just for BB Java BTW.  I'm struggling with C++ for BB!) right now. 

 

I think the important thing here is understanding the basics of Java.  BB is not a great platform to learn Java on.  If you do not already know Java, then the platform has too many idiosyncrasies t make it nice to learn on.  Well that is my opinion.  So I recommend you grab a book in Java for your development platform (PC/Mac), and have a go at that so you get the basics of Java before you start with BB. 

 

I'm guessing you don't already know Java, because if you did you would probably have found your way to this:

http://docs.oracle.com/javase/6/docs/api/

which makes the Blackberry API look trivial....

 

Anyway, as Simon as suggested, you don't need to learn all of this at once, you can pick up the classes you want to know and use Eclipse short cuts to learn about them as you are coding.  But there is a certain basic level of understanding.

 

Speaking from experience, unless you are going to do a course or read a book, the best thing to do is to take samples and get them going. 

 

Anyway, not sure that helps. Let me know if it doesn't and I will try to add to this. 

Contributor
Posts: 28
Registered: ‎11-13-2012
My Device: none
My Carrier: 27768965251

Re: Basic HTTP Get or POST data

Awesome, thanks for all the tips and helpful links,

I'm a web developer, php python etc...

 

I have a new app launching soon, and I thought like doing the blackberry app myself. therefore I'm asking all these weird questions.

 

I have the basics all setup...screens and etc...it's just the data that's a bit of a mind crash for me.

 

I have one more question. I am using this to read some simple data from a text file....I can get the values to show when i parse the values as Dialog.alerts, how do I show it in the body of the screen?

 

// Get an input stream from the file.
InputStream stream = getClass().getResourceAsStream("/folder/text.txt");

if(stream != null)
{
LineReader lineReader = new LineReader(stream);

// We read data from input stream one line at a time until we
// reach end of file. Each line is parsed to extract data.
for(;Smiley Wink
{
try
{
String line = new String(lineReader.readLine());

// Parse the current line...
Dialog.alert(line);
}
catch(EOFException eof)
{
// We've reached the end of the file.
break;
}
catch(IOException ioe)
{
// Error reading data from file
}
}
}

Contributor
Posts: 28
Registered: ‎11-13-2012
My Device: none
My Carrier: 27768965251

Re: Basic HTTP Get or POST data

ah, I got it, I added this line

 

// Parse the current line...
RichTextField results = new RichTextField(line);
add(results);

Developer
Posts: 17,025
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Basic HTTP Get or POST data

watch this video:
http://supportforums.blackberry.com/t5/Java-Development/What-is-the-Event-Thread/ta-p/446865
the event thread is very important to know, if you do parsing, http or other blocking operations you have to do that on a separate thread.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter