12-26-2011 06:21 AM
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/41
Thanks in advance.
12-29-2011 02:23 PM
And which parts of doing this are you having problems with?
12-30-2011 05:26 AM
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_L OWER | 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.HorizontalFieldMan ager;
import net.rim.device.api.ui.container.VerticalFieldManag er;
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
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
01-02-2012 12:11 AM
01-02-2012 12:12 AM - last edited on 01-02-2012 12:14 AM
i have solved my problem
by using
pushGlobalScreen(new myPopupScreen(),-1,false);
This false boolean do the trick and enable me to interact with other blackberry apps ![]()
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 ![]()
please help me out
01-02-2012 02:16 AM
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.
01-02-2012 02:36 AM
01-02-2012 05:17 AM
any reply maadani?
01-02-2012 07:48 AM
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.
01-02-2012 10:32 AM
Like maadani, I am not aware of an approach that will work for you in the way you require.