BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 10-03-2010, 01:29 PM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Jan 2010
Model: 8300
PIN: N/A
Carrier: T-Mobile
Posts: 62
Post Thanks: 1
Thanked 0 Times in 0 Posts
Default Trouble with SplashScreen program

Please Login to Remove!

Hi

I am having trouble using the SplashScreen example proved in the RIM website

I get it compiled without error but when I load it in the Simulator , i the app never shows up

Has anyone else experienced it ?

What are the project settings to be used while using the program ?
Offline  
Old 10-09-2010, 04:55 AM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: Jan 2010
Model: 8300
PIN: N/A
Carrier: T-Mobile
Posts: 62
Post Thanks: 1
Thanked 0 Times in 0 Posts
Default

Any one able to help ? !!
Offline  
Old 10-09-2010, 10:10 AM   #3 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

Not much here to go on. Most likely, the program has errors.
Offline  
Old 10-13-2010, 12:29 PM   #4 (permalink)
Knows Where the Search Button Is
 
Join Date: Sep 2010
Model: 9700
PIN: N/A
Carrier: 9700
Posts: 15
Post Thanks: 0
Thanked 0 Times in 0 Posts
Smile Solution for SplashScreen

Quote:
Originally Posted by MobileDeveloperUK View Post
Hi

I am having trouble using the SplashScreen example proved in the RIM website

I get it compiled without error but when I load it in the Simulator , i the app never shows up

Has anyone else experienced it ?

What are the project settings to be used while using the program ?
I have already worked with a Splash screen and its working nicely. Have implemented KeyListener for Enter and Menu keys and on click on the screen also takes it ahead i.e. kills the duration period and moves to next screen.

Code:
/**
 * 
 */
package gd;

import java.util.Timer;
import java.util.TimerTask;

import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.system.*;
import backend.UserBean;
import backend.Data;
import backend.XmlReply;

/**
 * @author Trupti
 */
public class SplashScreen extends FullScreen  {
        private Timer timer = new Timer();
        private Bitmap bitmap;
        private BitmapField bf;
        private String next = "";
        private UserBean user = null;
        
        public SplashScreen(String nextScreen, UserBean ub) {
                super(Field.FIELD_HCENTER);
SplashScreen");
                next = nextScreen;
                this.user = ub;
                try {
                    bitmap  = Bitmap.getBitmapResource("flash.png");
                } catch(Exception e) {
                    System.out.println("********* Exception : " + e.getMessage());
                    e.printStackTrace();
                }
                bf = new BitmapField(bitmap, DrawStyle.HCENTER | DrawStyle.VCENTER | BitmapField.FOCUSABLE);
                this.add(bf);
                SplashScreenListener listener = new SplashScreenListener(this);
                this.addKeyListener(listener);
                this.setChangeListener(listener);
                timer.schedule(new CountDown(), 5000);
        }
        
        public void dismiss() {
                timer.cancel();
                bitmap = null;
                timer = null;
                UiApplication.getUiApplication().popScreen(this);
                
                if (next.equalsIgnoreCase("l")) {
                    UiApplication.getUiApplication().pushScreen(new LoginScreen());
                }else if(next.equalsIgnoreCase("a")) {
                    UiApplication.getUiApplication().pushScreen(new LoggedUserScreen(user));
                }
        }
        
        // class CountDown
        private class CountDown extends TimerTask {
                public void run() {
                        DismissThread thread = new DismissThread();
                        UiApplication.getUiApplication().invokeLater(thread);
                }
        }
        
        // class DismissThread
        private class DismissThread implements Runnable {
                public void run() {
                        dismiss();
                }
        }

        // class SplashScreenListener
        public static class SplashScreenListener implements KeyListener, FieldChangeListener {
            private SplashScreen screen;
            
            public void fieldChanged(Field f, int context) {
                screen.dismiss();
            }
            
            public boolean keyChar(char key, int status, int time) {
               //intercept the ESC and MENU key - exit the splash screen
               boolean retval = false;
               switch (key) {
                  case Characters.CONTROL_MENU:
                  case Characters.ESCAPE:
                  screen.dismiss();
                  retval = true;
                  break;
               }
               return retval;
            }
            public boolean keyDown(int keycode, int time) {
               return false;
            }
            public boolean keyRepeat(int keycode, int time) {
               return false;
            }
            public boolean keyStatus(int keycode, int time) {
               return false;
            }
            public boolean keyUp(int keycode, int time) {
               return false;
            }
            public SplashScreenListener(SplashScreen splash) {
               screen = splash;
            }
         }

    protected boolean navigationClick(int status, int time) {
       fieldChangeNotify(0);
       return true;
    }
    
    protected boolean navigationUnclick(int status, int time) {
      return false;
    }
    
    protected boolean navigationMovement(int dx, int dy, int status, int time) {
      return false;
    }
        
}
You can change certain things like in const, you can have a MainScreen object
private MainScreen next;

public SplashScreen(MainScreen nextScreen) {
.....
this.next = nextScreen;
}

public void dismiss() {
timer.cancel();
bitmap = null;
timer = null;
UiApplication.getUiApplication().popScreen(this);
UiApplication.getUiApplication().pushScreen(next);
}


Hope this helps.
Offline  
Old 10-13-2010, 03:08 PM   #5 (permalink)
Thumbs Must Hurt
 
Join Date: Jan 2010
Model: 8300
PIN: N/A
Carrier: T-Mobile
Posts: 62
Post Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hi

Thanks for sharing the code , but unfortunately it doesn't compile

I am using JDE only

The package "backend" is not defined in JDE and so it is giving compile error
along with the LoggedUserScreen() methods
Offline  
Old 10-14-2010, 02:56 AM   #6 (permalink)
Knows Where the Search Button Is
 
Join Date: Sep 2010
Model: 9700
PIN: N/A
Carrier: 9700
Posts: 15
Post Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up

Quote:
Originally Posted by MobileDeveloperUK View Post
Hi

Thanks for sharing the code , but unfortunately it doesn't compile

I am using JDE only

The package "backend" is not defined in JDE and so it is giving compile error
along with the LoggedUserScreen() methods
There u go :
Code:
/**
 * 
 */


import java.util.Timer;
import java.util.TimerTask;

import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.ui.decor.Background;
import net.rim.device.api.ui.decor.BackgroundFactory;
import net.rim.device.api.system.*;

/**
 * @author Trupti
 */
public class SplashScreen extends FullScreen  {
        private Timer timer = new Timer();
        private Bitmap bitmap;
        private MainScreen nextScreenToCall;
        
        public SplashScreen(MainScreen nextScreen) {
                super(Field.FIELD_HCENTER);
                System.out.println("******************** Into SplashScreen");
                nextScreenToCall = nextScreen;
                try {
                    bitmap  = Bitmap.getBitmapResource("flash.png");
                } catch(Exception e) {
                    System.out.println("********* Exception : " + e.getMessage());
                    e.printStackTrace();
                }
                this.setBackground(BackgroundFactory.createBitmapBackground(bitmap, 0, 0, Background.REPEAT_SCALE_TO_FIT));

                SplashScreenListener listener = new SplashScreenListener(this);
                this.addKeyListener(listener);
                this.setChangeListener(listener);
                timer.schedule(new CountDown(), 5000);
                System.out.println("Showing splash .....");
        }
        
        public void dismiss() {
                timer.cancel();
                bitmap = null;
                timer = null;
                UiApplication.getUiApplication().popScreen(this);
                UiApplication.getUiApplication().pushScreen(nextScreenToCall);  // new SomeNEXTScreen());
                }
        }
        
        // class CountDown
        private class CountDown extends TimerTask {
                public void run() {
                        DismissThread thread = new DismissThread();
                        UiApplication.getUiApplication().invokeLater(thread);
                }
        }
        
        // class DismissThread
        private class DismissThread implements Runnable {
                public void run() {
                        dismiss();
                }
        }

        // class SplashScreenListener
        public static class SplashScreenListener implements KeyListener, FieldChangeListener {
            private SplashScreen screen;
            
            public void fieldChanged(Field f, int context) {
                screen.dismiss();
            }
            
            public boolean keyChar(char key, int status, int time) {
               //intercept the ESC and MENU key - exit the splash screen
               boolean retval = false;
               switch (key) {
                  case Characters.CONTROL_MENU:
                  case Characters.ESCAPE:
                  screen.dismiss();
                  retval = true;
                  break;
               }
               return retval;
            }
            public boolean keyDown(int keycode, int time) {
               return false;
            }
            public boolean keyRepeat(int keycode, int time) {
               return false;
            }
            public boolean keyStatus(int keycode, int time) {
               return false;
            }
            public boolean keyUp(int keycode, int time) {
               return false;
            }
            public SplashScreenListener(SplashScreen splash) {
               screen = splash;
            }
         }

    protected boolean navigationClick(int status, int time) {
       fieldChangeNotify(0);
       return true;
    }
    
    protected boolean navigationUnclick(int status, int time) {
      return false;
    }
    
    protected boolean navigationMovement(int dx, int dy, int status, int time) {
      return false;
    }
        
}
It seems you are a totally newbie in development also. The above code will work. Also make sure you have flash.png in the same folder as this file is in.

Regards,
Offline  
Old 10-14-2010, 10:34 AM   #7 (permalink)
Thumbs Must Hurt
 
Join Date: Jan 2010
Model: 8300
PIN: N/A
Carrier: T-Mobile
Posts: 62
Post Thanks: 1
Thanked 0 Times in 0 Posts
Default

Do you really think that code would work ?

I couldn't get it to compile properly


Were you too sure not to check it ? !!
Offline  
Old 10-19-2010, 12:34 AM   #8 (permalink)
Knows Where the Search Button Is
 
Join Date: Sep 2010
Model: bold
PIN: N/A
Carrier: tmobile
Posts: 16
Post Thanks: 1
Thanked 0 Times in 0 Posts
Default

Can you please post all your code? You can see some examples on how to implement a splash screen at: mobijournal.com/blackberry-splash-screens-by-rim/
Offline  
Old 10-19-2010, 01:01 AM   #9 (permalink)
Knows Where the Search Button Is
 
Join Date: Sep 2010
Model: 9700
PIN: N/A
Carrier: 9700
Posts: 15
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by twola View Post
Can you please post all your code? You can see some examples on how to implement a splash screen at: mobijournal.com/blackberry-splash-screens-by-rim/
I have already posted my complete code in above messages. In first mesage the way I am using it (I have setup to show next screen based on parameters passed). In other I have shown without any settings and just normally.

Now I guess, if this code can't help you in any way, refer to this site :
[http]://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800256/How_To_-_Create_a_splash_screen.html?nodeid=800334&vernum= 0
Offline  
Old 10-19-2010, 11:02 AM   #10 (permalink)
Knows Where the Search Button Is
 
Join Date: Sep 2010
Model: bold
PIN: N/A
Carrier: tmobile
Posts: 16
Post Thanks: 1
Thanked 0 Times in 0 Posts
Default

Sorry I am on mobile phone so can't see the code too well. I was however able to use the blackberry rim example from the website and get it to work successfully:

http://mobijournal.com/blackberry-sp...creens-by-rim/


I will go home later today and dissect your code to see. Sorry this is the best I can do for now.

Last edited by twola : 10-19-2010 at 11:14 AM.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.