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
Sunilkumar
Posts: 75
Registered: ‎07-21-2009
My Device: Not Specified

java.lang.illegalstateexception field added to manager

Hi all,

         I have got this issue "java.lang.illegalstateexception field added to manager while it is already parented" in below code.

 

		final int deviceWidth = Display.getWidth();
		     final int deviceHeight = Display.getHeight();
		     flag=0;
		   
			
			
			Uiapp=app;
			       // Hang.png
			backgroundBitmap = Bitmap.getBitmapResource("A.png");
			
			 HorizontalFieldManager horizontalFieldManager = new HorizontalFieldManager(HorizontalFieldManager.USE_ALL_WIDTH | HorizontalFieldManager.USE_ALL_HEIGHT){
		            
		            //Override the paint method to draw the background image.
		            public void paint(Graphics graphics)
		            {
		                //Draw the background image and then call paint.
		            
		                graphics.clear();
		                graphics.drawBitmap(0, 0, deviceWidth, deviceHeight, backgroundBitmap, 0, 0);
		                System.out.println("devicewidth"+deviceWidth+"deviceHeight"+deviceHeight);
		                super.paint(graphics);

		                
		            }            
		            
		        };
			
		    VerticalFieldManager vfm = new VerticalFieldManager();
		        
	        LabelField name=  new LabelField("Label1:", LabelField.FIELD_LEFT| DrawStyle.VCENTER);
	        vfm.add(new LabelField(""));
	        vfm.add(name);
	      

	        vfm.add(new LabelField(""));
	        vfm.add(new LabelField(""));
		    
		    LabelField number=new LabelField("Label2:", LabelField.FIELD_LEFT | DrawStyle.VCENTER);
		
		    vfm.add(number);
	
		
		    vfm.add(new LabelField(""));
		    vfm.add(new LabelField(""));
		    
		    LabelField Adress=new LabelField("Label3:", LabelField.FIELD_LEFT | DrawStyle.HCENTER);
		 
		    
		    vfm.add(Adress);
		
		    vfm.add(new LabelField(""));
		    vfm.add(new LabelField(""));
		    
		    LabelField Awarad=new LabelField("Label4:", LabelField.FIELD_LEFT | DrawStyle.HCENTER);
		    
		    vfm.add(Awarad);
		 
		    vfm.add(new LabelField(""));
		    vfm.add(new LabelField(""));
		    
		    horizontalFieldManager.add(vfm);
		    add(horizontalFieldManager);
	
	        UIApplication.pushScreen(this);  

 

 

Please use plain text.
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: java.lang.illegalstateexception field added to manager

A field can only be added to a single manager.

 

What line throws the exception?

Please use plain text.
Developer
Sunilkumar
Posts: 75
Registered: ‎07-21-2009
My Device: Not Specified

Re: java.lang.illegalstateexception field added to manager

Hi,

thanks for reply.

       actually it doesn't work on client's phone blackberry 9700 5.3. v.i just want to know that is there any wrong method i used becouse i could not put log in that phones so i could not get which lines it gives me error.

 

Thanks ,

sunil

Please use plain text.
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: java.lang.illegalstateexception field added to manager

If you code catches Throwable, this will force a stack trace on the exception in the device event log.

 

You custoemr can access the event log using <alt> L G L G from the home screen and locate the exception, then open the exception to see the stack trace.

 

He can also copy the event log contents and email it to you.

 

 

Please use plain text.
Developer
Sunilkumar
Posts: 75
Registered: ‎07-21-2009
My Device: Not Specified

Re: java.lang.illegalstateexception field added to manager

Hi RexDoug,

 Thanks for  a valuable info.

 

 

Thanks,

sunil

Please use plain text.