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
Contributor
Posts: 22
Registered: ‎03-29-2010
My Device: 8130
My Carrier: T1

how to Make small ticker screen Blackberry OS 6.0 same as in Breaking news app

I want to customize very first MainScreen of my Blackberry application as like small ticker screen. My aim is that the first MainScreen should be of size 320width,100height so when user launches the application then he will just see screen of size 320width and 100height (0,200,320,100) while remaining screen will be transparent and user will see other applications through transparent screen.

 

 i want something like BreakNews app ,very well-know blackberry app.

http://appworld.blackberry.com/webstore/content/41242?lang=en

 

 

Thanks in advance.

Developer
Posts: 19,628
Registered: ‎07-14-2008
My Device: Not Specified

Re: how to Make small ticker screen Blackberry OS 6.0 same as in Breaking news app

And which parts of doing this are you having problems with?

Contributor
Posts: 22
Registered: ‎03-29-2010
My Device: 8130
My Carrier: T1

Re: how to Make small ticker screen Blackberry OS 6.0 same as in Breaking news app

here is my code

package com;
import net.rim.device.api.system.EventLogger;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;


class HelloWorld extends net.rim.device.api.ui.UiApplication 
{
    public static void main(String[] args)
    {
        //EventLogger.register(0x9876543212557L, "Hello", EventLogger.VIEWER_STRING);
        HelloWorld instance = new HelloWorld();
        instance.enterEventDispatcher();
    }  
    public HelloWorld() 
    {
       // pushScreen(new SalutationScreen());
       //pushModalScreen(new SalutationScreen());
      // pushGlobalScreen(new SalutationScreen(),2,UiEngine.GLOBAL_SHOW_LOWER);
         
        
         UiApplication.getUiApplication().invokeLater(new Runnable()
                      {
                        public void run()
                        {
                            
                 // pushGlobalScreen(new CustomPopupScreen(),-1,UiApplication.GLOBAL_SHOW_LOWER | UiApplication.GLOBAL_MODAL);    
 pushGlobalScreen(new CustomPopupScreen(),-1,true);  
                            //pushModalScreen(new SalutationScreen());
                        }
                      });

    }
}


=================
/*
 * CustomPopupScreen.java
 *
 * © <your company here>, <year>
 * Confidential and proprietary.
 */

package com;
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.BackgroundFactory;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.system.Display;
import net.rim.device.api.ui.container.HorizontalFieldManager;
import net.rim.device.api.ui.container.VerticalFieldManager;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.component.EditField;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.container.PopupScreen;
import net.rim.device.api.system.GPRSInfo;
import net.rim.device.api.system.CoverageInfo;
import net.rim.device.api.system.WLANInfo;
import net.rim.device.api.ui.Manager;
import net.rim.device.api.servicebook.ServiceBook;
import net.rim.device.api.servicebook.ServiceRecord;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
import java.io.*;
import net.rim.device.api.ui.component.Dialog;
import javax.microedition.io.Connector;
import javax.microedition.io.file.FileConnection;
import javax.microedition.io.HttpConnection;
import net.rim.device.api.io.Base64OutputStream;

class CustomPopupScreen extends PopupScreen {
    
    private final static int _CUSTOM_SIZE   = 100;
    private final static int _ALPHA         = 0xBF; // 75% alpha
    private final static int _X             = ( Display.getWidth() - _CUSTOM_SIZE ) >> 1;
    private final static int _Y             = ( Display.getHeight() - _CUSTOM_SIZE ) >> 1; 
    
   
    
    CustomPopupScreen() {    
        super( new VerticalFieldManager( Manager.NO_VERTICAL_SCROLL | Manager.NO_VERTICAL_SCROLLBAR  ) );
        add( new LabelField( "hello, world" ) );
    }
    
    protected void sublayout( int width, int height ) {
        setExtent( _CUSTOM_SIZE, _CUSTOM_SIZE );
        setPosition( _X, _Y );
        layoutDelegate( _CUSTOM_SIZE, _CUSTOM_SIZE );
    }
    
    protected void paintBackground( Graphics g ) {
        XYRect myExtent = getExtent();
        int color = g.getColor();
        int alpha = g.getGlobalAlpha();
        g.setGlobalAlpha( _ALPHA );
        g.setColor( 0xE3E3E3 );
        g.fillRect( 0, 0, myExtent.width, myExtent.height );
        g.setColor( color );
        g.setGlobalAlpha( alpha );
    }
    
   /* protected boolean keyDown( int keycode, int status ) {
        if ( Keypad.key( keycode ) == Keypad.KEY_ESCAPE ) {
            close();
            return true;
        }
        return super.keyDown( keycode, status );
    }*/
         public boolean onClose()
    {
     
      UiApplication.getUiApplication().requestBackground();
        return true;
    }

}

output of this code is attached as ticker.png

ticker.png

 

but i was unable to interact with blacklberry native apps like messages,browser while my screen is on homescreen.

i want that user can interact with messages,browser,calnedar etc while seen my ticker application running on homescreen

 

 

Contributor
Posts: 22
Registered: ‎03-29-2010
My Device: 8130
My Carrier: T1

Re: how to Make small ticker screen Blackberry OS 6.0 same as in Breaking news app

any reply plz...
Contributor
Posts: 22
Registered: ‎03-29-2010
My Device: 8130
My Carrier: T1

Re: how to Make small ticker screen Blackberry OS 6.0 same as in Breaking news app

[ Edited ]

i have solved my problem :smileyhappy: by using

 

pushGlobalScreen(new myPopupScreen(),-1,false);

This false boolean do the trick and enable me to interact with other blackberry apps :smileysad:

But i got struck now at some other point, i add a button on myPopupscreen which i just pushed as globalscreen.
now myPopupscreen donot get focused but other BB native apps get focused :smileysad:

 

please help me out

Developer
Posts: 729
Registered: ‎05-04-2011
My Device: 9700

Re: how to Make small ticker screen Blackberry OS 6.0 same as in Breaking news app

Hi @kashif_pucitian

 

 

Do note that:

 

1. The method that you are using is deprecated.

 

2. You can not click the button in your screen since the 'false' flag indicates that your screen does not require user input and so the OS remove the focus from it (and that is why you can interact with other applications). If you require user input, you will have use another solution.

 

E.

Contributor
Posts: 22
Registered: ‎03-29-2010
My Device: 8130
My Carrier: T1

Re: how to Make small ticker screen Blackberry OS 6.0 same as in Breaking news app

oh :smileysad: ,
really feel bad now.

means i cannot interact tickerApp and blackberry native apps at the same time?

Then please suggest me an alternate solution :smileysad: ..
Contributor
Posts: 22
Registered: ‎03-29-2010
My Device: 8130
My Carrier: T1

Re: how to Make small ticker screen Blackberry OS 6.0 same as in Breaking news app

any reply maadani?

Developer
Posts: 729
Registered: ‎05-04-2011
My Device: 9700

Re: how to Make small ticker screen Blackberry OS 6.0 same as in Breaking news app

Hi @kashif_pucitian

 

 

As I posted before, I don't know any API which enables your requirements.

 

The exceptions that I can think about are:

 

1. The widget SDK - I hadn't got the chance to investigate it.

 

2. Using a theme rather than a Java application.

 

3. Have RIM develop it / give you access to hidden APIs (if there are any...).

 

Another option that you have is handling the user input on your own. Recognize user interactions, handle them, and then re-layout your application.

 

E.

Developer
Posts: 19,628
Registered: ‎07-14-2008
My Device: Not Specified

Re: how to Make small ticker screen Blackberry OS 6.0 same as in Breaking news app

Like maadani, I am not aware of an approach that will work for you in the way you require.