Posts Tagged ‘Blackberry’

Blackberry: Video Recording in Blackberry

For video recording first we have to check the memory available in Blackberry. According to that we have to go to the next step.

Download the zip file for the example for Video recording in Blackberry

https://www.dropbox.com/s/tru6eb4gxm5yz1p/VideoRecording.zip

Advertisements

Blackberry : Any Type of Barcode Generator

We can scan Any type of barcode using blackberry. You can download the code from here.

First see the BarcodeScanner in blackberry 6.0 sample codes.

Take the code from this link : https://www.dropbox.com/sh/toddwzgakvkbwgz/mkNvzCJRST 

Blackberry: QR-Code Reader for BB-5.0

Yes, we can read the QRCode in Blackberry 5.0 api applications. For this we have to follow some points from this link:

http://supportforums.blackberry.com/t5/Java-Development/barcode-code-scanning/m-p/1561399

You can download the code from this below link:

https://www.dropbox.com/s/t6mwhpriorlsz8n/QRCodeForVersion5.zip

Create CUSTOM MENU in Blackberry Example

This is a sample example of showing CUSTOM menu in every screen as we like:

=============StartUp.java=================

package com.alishaik.custommenu;

import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.Dialog;

public class StartUp extends UiApplication
{
public static void main(String[] args)
{
StartUp theApp = new StartUp();
theApp.enterEventDispatcher();
}

public StartUp()
{
pushScreen(new FirstScreen());
}

public static void showAlertMessage(final String message)
{
UiApplication.getUiApplication().invokeLater(new Runnable()
{
public void run()
{
Dialog.alert(message);
}
});
}
}

==================FirstScreen.java===========

package com.alishaik.custommenu;

public class FirstScreen extends MainScreen implements MenuInterface
{
private ButtonField clickButton;
private CustomMenu firstMenu1,firstMenu2;

public FirstScreen()
{
createGUI();
}

private void createGUI()
{
firstMenu1=new CustomMenu(“First1”, 100, 101, 1);
firstMenu1.setMenuListener(this);
addMenuItem(firstMenu1);

firstMenu2=new CustomMenu(“First2”, 100, 101, 2);
firstMenu2.setMenuListener(this);
addMenuItem(firstMenu2);

add(new LabelField(“First Screen”, Field.FOCUSABLE));
//ButtonField.CONSUME_CLICK if you are not writing this every screen menu shows.
clickButton=new ButtonField(“Clik to go Next”, Field.FOCUSABLE|ButtonField.CONSUME_CLICK);
clickButton.setChangeListener(new FieldChangeListener()
{
public void fieldChanged(Field field, int context)
{
UiApplication.getUiApplication().pushScreen(new SecondScreen());
}
});
add(clickButton);
}

public void onMenuPressed(String menuText, int tag)
{
StartUp.showAlertMessage(“You Selected “+menuText);
if(tag==1)
{
//FirstMenu1 Selected;
}
else
{
//FirstMenu2 Selected;
}
}

protected boolean onSavePrompt()
{
return true;
}
}
==================SecondScreen.java===========

package com.alishaik.custommenu;

import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.MainScreen;

public final class SecondScreen extends MainScreen implements MenuInterface
{
private ButtonField clickButton;
private CustomMenu secondMenu1,secondMenu2;

public SecondScreen()
{
createGUI();
}

private void createGUI()
{
secondMenu1=new CustomMenu(“Second1”, 100, 101, 1);
secondMenu1.setMenuListener(this);
addMenuItem(secondMenu1);

secondMenu2=new CustomMenu(“Second2”, 100, 101, 2);
secondMenu2.setMenuListener(this);
addMenuItem(secondMenu2);

add(new LabelField(“Second Screen”, Field.FOCUSABLE));
//ButtonField.CONSUME_CLICK if you are not writing this every screen menu shows.
clickButton=new ButtonField(“Back button”, Field.FOCUSABLE|ButtonField.CONSUME_CLICK);
clickButton.setChangeListener(new FieldChangeListener()
{
public void fieldChanged(Field field, int context)
{
UiApplication.getUiApplication().popScreen(SecondScreen.this);
return;
}
});
add(clickButton);
}

public void onMenuPressed(String menuText, int tag)
{
StartUp.showAlertMessage(“You Selected “+menuText);
if(tag==1)
{
//SecondMenu1 Selected;
}
else
{
//SecondMenu2 Selected;
}
}

protected boolean onSavePrompt()
{
return true;
}
}
==================MenuInterface.java=============

package com.alishaik.custommenu;

public interface MenuInterface
{
public void onMenuPressed(String menuText,int tag);
}
=================CustomMenu.java=====================

package com.alishaik.custommenu;

import net.rim.device.api.ui.MenuItem;

public class CustomMenu extends MenuItem
{
private MenuInterface menuInterface;
private String menuText;
private int tag;

public CustomMenu(String text, int ordinal, int priority, int tag)
{
super(text, ordinal, priority);
this.menuText=text;
this.tag=tag;
}

public void run()
{
menuInterface.onMenuPressed(menuText, tag);
}

public void setMenuListener(MenuInterface listener)
{
this.menuInterface=listener;
}
}
===================*******================