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: 950
Registered: ‎06-22-2010
My Device: 9550

Re: use the values of one screen to nextscreen

When U concat the two String then U should check that the Final String is right Or not

from print that String on console.

Trusted Contributor
Posts: 204
Registered: ‎07-14-2010
My Device: 8100
My Carrier: Blackberry developer

Re: use the values of one screen to nextscreen

the format which yu all gave is right.

 

but the list items are generated at runtime by parsing

and in my first screen the list contains abt 10 items

and i cant generate 10 screens or 10 .java files it ll make more

complicated.

 

so i want to use something like getselecteditem in the place

                        UiApplication.getUiApplication().pushScreen(new screen2(getselecteditem))ld

which pushes to the screen2 of selecteditem.

whatever listitem i select it shoud take me to screen2 and it should direct to the selected


items link

 

Developer
Posts: 282
Registered: ‎02-25-2010
My Device: curve,bold,storm
My Carrier: Verizon,AT&T

Re: use the values of one screen to nextscreen

hey kirtiga

 

its not necessary to create 10 screens

u need to create only one screen ,

u just have to change the arguments

like:

 

 

String str="";// this will contain data that u need to pass on to the Screen2

if(mylist.getSelectedIndex==2)

 {

   str="link2"; //suppose link2 is the data that u want to pass to next screen

   UiApplication.getUiApplication.pushscreen(new Screen2(str))

}

if(mylist.getSelectedIndex==3)

 {

   str="link3"; //suppose link3 is the data that u want to pass to next screen

   UiApplication.getUiApplication.pushscreen(new Screen2(str))

}

 

 

 

in Screen 2:

 

 

class Screen2 extends MainScreen

 {

    Screen2(String str)

     {

          if(str=="link2")

            //do coding

          if(str=="link3")

           //do coding

     }

 }


 

 

 

its just a matter of passing arguments to 1 screen

just a basic concept

Trusted Contributor
Posts: 204
Registered: ‎07-14-2010
My Device: 8100
My Carrier: Blackberry developer

Re: use the values of one screen to nextscreen

its not vvorking ..

please correct the code if its wrong

 

 

SCREEN 1

class appl extends ...
{
private appl app;




 String str="";

                //for(int i = 0;i <= _list.getSelectedIndex();i++)
                	 if(_list.getSelectedIndex()==0)
                	{
                       	 str= "Home";                                  	 
                		
                   		UiApplication.getUiApplication().pushScreen(new ascreen(str));
                    }
                	 if(_list.getSelectedIndex()==1)
                	 {
                	     str="Sports";
                	     
                	     UiApplication.getUiApplication().pushScreen(new ascreen(str));
                	 }
                		  
                	 }

SCREEN 2
                	 
                

private class Connection extends Thread
	{ 
	    public Connection()
	    { 
	       super(); 
	    } 
	    
	    public void run() {  
	    	Document doc;  
	    	StreamConnection conn = null; 
	    	InputStream is = null;  
	    	
	    	
	    	try {     
	    			  
	    		if(app.str=="Home"){
	    		String u =" http://www.test.com/category?type=cat&name=";
	    		String s = app.str;
	    		String k = ";deviceside=true";
	    		String url = u + s + k ;
	    		 	
	    			    		///+ app.str;deviceside=true ";
	    		conn = (StreamConnection) Connector.open (url); 

 

 

Highlighted
Developer
Posts: 282
Registered: ‎02-25-2010
My Device: curve,bold,storm
My Carrier: Verizon,AT&T

Re: use the values of one screen to nextscreen

[ Edited ]

i think u didnt understand the concept of passing arguments!!!

 u wrote in your first screen:

 

UiApplication.getUiApplication().pushScreen(new ascreen(str));

it means ascreen is a class that extends Mainscreen and u r passing arguments to it

 

u should collect it like:

 

 

class ascreen extends MainScreen
{
ascreen(String str)
{
super();
Connection obj = newConnection(str);
//now here u have passed the string to connection class
}
}

 

 

 

now

private class Connection extends Thread
{
public Connection(String str)
{
super();
}
//now inside run u can do comparison with str
.........
.....
.
.

.
}