Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    May 2013
    Posts
    280

    Image behind animation is not taking complete resolution of device

    I am making s40 app and testing my app on asha 501 .

    I applied animation code and i put my animation in a dialog. I hav shown that dialog as a loading window till my backend process is over but the image behind dialog is getting a white strip in bottom right. Here is the link of the image http://imgur.com/DlqFT4u image resolution is 240 by 320

    And here is my code i m facing error with
    Code:
    				final Image secondAnimation [] = new Image[10];
    			    final Form f=new Form();
    			      f.setScrollVisible(false);
    	           	RecordStore ri;
    	   			System.out.println("ooooooooooooooooo");
    	   			ri=RecordStore.openRecordStore("bbc",true);
    	   			System.out.println("MY BACKGROUND RECORDSTORE OPENED");
    	   			System.out.println("999999999999999999999");
    	   			int getback=ri.getNumRecords();
    	   			
    	   			if(getback==0)
    	   			{
    	   				System.out.println("In if block");
    	   				String str="1";
    					byte[] back9 = str.getBytes();
    					ri.addRecord(back9, 0, back9.length);
    					System.out.println("Record is added");
    					int u=ri.getNumRecords();
    					byte[] back=new byte[ri.getRecordSize(u)];
    					System.out.println("222222222222222222");
    						
    					
    					ri.getRecord(u, back, 0);
    					System.out.println("2333333333333333333332");
    					getbackground = new String(back);
    	   			}
    	   			else
    	   			{
    	   				System.out.println("In else block");
    	   				System.out.println("*********************");
    	   				System.out.println("last record id is "+getback);
    	   				System.out.println("9555555555555555555");
    	   				int u=ri.getNumRecords();
    	   				byte[] back=new byte[ri.getRecordSize(u)];
    	   				System.out.println("222222222222222222");
    				
    			
    	   				ri.getRecord(getback, back, 0);
    	   				System.out.println("2333333333333333333332");
    	   				getbackground = new String(back);
    	   				System.out.println("6666666666666666666666");
    
    	   			}
    	   				ri.closeRecordStore();
    			
    	   				System.out.println("Last value from background database is as follows : "+getbackground);
    	   				b5=Integer.parseInt(getbackground);
    	   				System.out.println("value of last element of database picture  is ____________________ "+b5);
    	   			 if(b5==1)
    				 {
    	   				 
    	   				 if(f.getWidth()==240&&f.getHeight()==400)
    	   				 {
    					Image image1 = Image.createImage("/Mix.png");
    					f.getStyle().setBgImage(image1);
    				
    					f.getStyle().setBackgroundType(Style.BACKGROUND_IMAGE_ALIGNED_RIGHT);
    	   				 }
    	   				 else
    	   				 {
    	   					Image image1 = Image.createImage("/Mix.png");
    	   					Image y=resizeImage(image1);
    	   					
    	   					f.getUnselectedStyle().setBgImage(y);
    						f.getStyle().setBackgroundType(Style.BACKGROUND_IMAGE_ALIGNED_CENTER); 
    	   				 }
    					
    						
    					f.repaint();
    						
    					f.show();
    					 
    				 }
    				 if(b5==2)
    				 {
    					 
    					 if(f.getWidth()==240&&f.getHeight()==400)
    	   				 {
    					 Image image2 = Image.createImage("/Blue.png");
    					 Image f9=resizeImage1(image2);
    					 f.getUnselectedStyle().setBgImage(f9);
    					 f.getStyle().setBackgroundType(Style.BACKGROUND_IMAGE_ALIGNED_CENTER);
    	   				 }
    					 else
    					 {
    						 Image image2 = Image.createImage("/Blue.png");
    						/* System.out.println("Resizing");
    						 Image f9=resizeImage(image2);
    						 System.out.println("Resized");*/
    						 f.getUnselectedStyle().setBgImage(image2);
    						 f.getStyle().setBackgroundType(Style.BACKGROUND_IMAGE_ALIGNED_CENTER); 
    					 }
    						
    					 f.repaint();
    						
    					 f.show();
    					 
    				 }
    				 if(b5==3)
    				 {
    					 if(f.getWidth()==240&&f.getHeight()==400)
    	   				 {
    					 Image image3 = Image.createImage("/Pink.png");
    				
    					 f.getUnselectedStyle().setBgImage(image3);
    					 f.getStyle().setBackgroundType(Style.BACKGROUND_IMAGE_ALIGNED_CENTER);
    	   				 }
    					 else
    					 {
    						 Image image3 = Image.createImage("/Pink.png");
    						// Image f9=resizeImage(image3);
    						 f.getUnselectedStyle().setBgImage(image3);
    						 f.getStyle().setBackgroundType(Style.BACKGROUND_IMAGE_ALIGNED_CENTER); 
    					 }
    					
    						
    					 f.repaint();
    						
    					 f.show();
    					 Runtime r=Runtime.getRuntime();
    					 System.out.println("free memroy.."+r.freeMemory());
    					 r.gc();
    				 } 
    			  /*  f.setScrollable(true);
    			   f.setScrollVisible(false);*/
    			   
    		        try {
    		            for(int i=0;i<10;i++)
    		            {
    		            secondAnimation[i]  = Image.createImage("/pic"+i+".png");
    		           
    		          
    		            }
    		        } catch (IOException ex) {
    		           
    		        }
    
    		            Label animation2 = new Label() {
    		            private int currentImage = 0;
    		            private long lastInvoke;
    
    		            public boolean animate() {
    		                 long current = System.currentTimeMillis();
    		                 if (current - lastInvoke > 75) {
    		                 lastInvoke = current;
    		                 currentImage++;
    		                 if (currentImage == secondAnimation.length) {
    		                      
    		                 currentImage = 0;
    		                  return true;
    
    		                 }
    		                  return true;
    		                 }
    		                 return false;
    		                 }
    
    		               public void paint(Graphics g) {
    		                if (currentImage != 11) 
    		                  {
    		                if(f.getWidth()==240&&f.getHeight()==400)
    		                 {
    		                    g.drawImage(secondAnimation[currentImage], 17,15);
    		                 }
    		                 else
    		                 {
    		                	g.drawImage(secondAnimation[currentImage], 17,15);
    		                 }
    		                 }
    		            }
    		        };
    
    		            animation2.setPreferredSize(new Dimension(50, 50));
    		            animation2.getStyle().setBgTransparency(0);
    
    					 
    		   				f.setShouldCalcPreferredSize(true);
    				        f.registerAnimated(animation2);
    				        Dialog d=new Dialog();
    				        d.setLayout(new BorderLayout());
    				        if(d.getWidth()==240&&d.getHeight()==400)
    				        {
    				        d.getDialogStyle().setMargin(155,155,65,65);
    				        }
    				        else
    				        { 
    				        	 d.getDialogStyle().setMargin(110,190,65,65);
    				        }
    				        d.getDialogStyle().setBorder(Border.createRoundBorder(10, 10,false));
    				        Label l=new Label();
    				        l.setText("Loading...");
    				        l.getUnselectedStyle().setAlignment(Component.CENTER);
    				        Font myFont = Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL);
    						l.getUnselectedStyle().setFont(myFont );
    						f.setLayout(new BorderLayout());
    						d.addComponent(BorderLayout.CENTER,animation2);
    						d.addComponent(BorderLayout.SOUTH, l);
    						f.addComponent(BorderLayout.CENTER,d);
    		               
    		                Thread th = new Thread(){
    		                	public void run(){
    						
    						try{
    
    							 
                            processing();
                            Runtime r=Runtime.getRuntime();
                  		    System.out.println("free memroy.."+r.freeMemory());
                  		    r.gc();
    						
    			               }
    						catch(Exception e){
    						System.out.println(""+e.toString());
    						}
    						
    					}
    					
    					
    				};
    				  th.start();
    				 /* f.setScrollVisible(false);
    				  f.setScrollable(false);*/
    				  f.show();
    			    }
    Plz Help
    Last edited by Manpreet_Singh; 2014-01-06 at 07:12.

  2. #2
    Regular Contributor
    Join Date
    Dec 2012
    Location
    India
    Posts
    272

    Re: Image behind animation is not taking complete resolution of device

    If I am not mistaken, that appears to be a scroll bar.

    Use formObject.setScrollVisible(false) before showing the dialog and make it visible after disposing the dialog(if needed).

  3. #3
    Registered User
    Join Date
    May 2013
    Posts
    280

    Re: Image behind animation is not taking complete resolution of device

    Hi,
    i am not showing dialog. I am showing form and i put the dialog(in which i have done animation) on form itself.
    Yes it is scroll bar, how to get rid of it in this case

    I am using formObject.setScrollVisible(false) before showing form but still i m not able to remove scroll bar .

    And actually i was not expecting scroll in this case as my image is perfectly the size of device(240 by 320)
    Last edited by Manpreet_Singh; 2014-01-06 at 12:12.

  4. #4
    Registered User
    Join Date
    May 2013
    Posts
    280

    Re: Image behind animation is not taking complete resolution of device

    Any ideas how to handle this issue??

  5. #5
    Regular Contributor
    Join Date
    Dec 2012
    Location
    India
    Posts
    272

    Re: Image behind animation is not taking complete resolution of device

    I am not sure if this will help..but why are you adding a Dialog to a form ? It seems to defeat its purpose and it might be the reason for the scroll bar visiblity.

    Try adding a container instead of a dialog.

Similar Threads

  1. App taking time on device ...but not on degugging.
    By Manpreet_Singh in forum Mobile Java General
    Replies: 3
    Last Post: 2013-09-28, 18:48
  2. prob whn taking release to device
    By kathir.s in forum Symbian
    Replies: 6
    Last Post: 2011-04-19, 13:10
  3. Taking pictures with a resolution different from that stated in the application -7230
    By ederfel in forum Mobile Java Media (Graphics & Sounds)
    Replies: 3
    Last Post: 2010-12-14, 12:24
  4. unknown errors in taking image and encoding
    By Chinu in forum Symbian Media (Closed)
    Replies: 3
    Last Post: 2009-09-01, 10:42
  5. Increasing number of pixels after taking an image
    By prasanth031 in forum Symbian Media (Closed)
    Replies: 8
    Last Post: 2009-03-11, 11:37

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×