BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 10-03-2010, 12:29 PM   #1
MobileDeveloperUK
Thumbs Must Hurt
 
Join Date: Jan 2010
Model: 8300
PIN: N/A
Carrier: T-Mobile
Posts: 62
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, 03:55 AM   #2
MobileDeveloperUK
Thumbs Must Hurt
 
Join Date: Jan 2010
Model: 8300
PIN: N/A
Carrier: T-Mobile
Posts: 62
Default

Any one able to help ? !!
Offline  
Old 10-09-2010, 09:10 AM   #3
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Default

Not much here to go on. Most likely, the program has errors.
Offline  
Old 10-13-2010, 11:29 AM   #4
trupti
Knows Where the Search Button Is
 
Join Date: Sep 2010
Model: 9700
PIN: N/A
Carrier: 9700
Posts: 15
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, 02:08 PM   #5
MobileDeveloperUK
Thumbs Must Hurt
 
Join Date: Jan 2010
Model: 8300
PIN: N/A
Carrier: T-Mobile
Posts: 62
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, 01:56 AM   #6
trupti
Knows Where the Search Button Is
 
Join Date: Sep 2010
Model: 9700
PIN: N/A
Carrier: 9700
Posts: 15
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, 09:34 AM   #7
MobileDeveloperUK
Thumbs Must Hurt
 
Join Date: Jan 2010
Model: 8300
PIN: N/A
Carrier: T-Mobile
Posts: 62
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-18-2010, 11:34 PM   #8
twola
Knows Where the Search Button Is
 
Join Date: Sep 2010
Model: bold
PIN: N/A
Carrier: tmobile
Posts: 16
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, 12:01 AM   #9
trupti
Knows Where the Search Button Is
 
Join Date: Sep 2010
Model: 9700
PIN: N/A
Carrier: 9700
Posts: 15
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, 10:02 AM   #10
twola
Knows Where the Search Button Is
 
Join Date: Sep 2010
Model: bold
PIN: N/A
Carrier: tmobile
Posts: 16
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 10:14 AM..
Offline  
Closed Thread



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Digital Ohmmeter LCD Audio Impedance Test Meter Speaker Voice Resistor System picture

Digital Ohmmeter LCD Audio Impedance Test Meter Speaker Voice Resistor System

$56.99



Tenma Audio Impedance Tester 72-6948 picture

Tenma Audio Impedance Tester 72-6948

$64.95



IMPEDENCE MATCHING TRANSFOMER BNC F-BNC F, 50 OHM TO 75 OHM, 20-1100 MHZ picture

IMPEDENCE MATCHING TRANSFOMER BNC F-BNC F, 50 OHM TO 75 OHM, 20-1100 MHZ

$28.00



TC ESI Impedance Bridge Model 250-DA Serial 1394 Electro-MeasurementS Oregon USA picture

TC ESI Impedance Bridge Model 250-DA Serial 1394 Electro-MeasurementS Oregon USA

$69.99



TOA ZM-104A Impedance Meter Measures Impedance of Speaker Lines Up to 100k Ohms picture

TOA ZM-104A Impedance Meter Measures Impedance of Speaker Lines Up to 100k Ohms

$59.97



Gold Line ZM-1P Impedance Meter with Protection Relay picture

Gold Line ZM-1P Impedance Meter with Protection Relay

$648.98







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