List of all Iphone and Blackberry Development codes in a one click Iphone,objective C,xcode,blackberry Development,iOS Development

Wednesday, April 17, 2013

Image Animation in Blackberry (using a series of images)

final Bitmap image000 = Bitmap.getBitmapResource("1.png");
final Bitmap image001 = Bitmap.getBitmapResource("2.png");
final Bitmap image002 = Bitmap.getBitmapResource("3.png");
final Bitmap image003 = Bitmap.getBitmapResource("4.png");
final Bitmap image004 =Bitmap.getBitmapResource("5.png");
final Bitmap image005 = Bitmap.getBitmapResource("6.png");
final Bitmap image006 = Bitmap.getBitmapResource("7.png");
final Bitmap image007 = Bitmap.getBitmapResource("8.png");
final Bitmap image008 = Bitmap.getBitmapResource("9.png");
final Bitmap image009 =Bitmap.getBitmapResource("10.png");
final Bitmap image010 = Bitmap.getBitmapResource("11.png");
final Bitmap image011 =Bitmap.getBitmapResource("12.png");
final BitmapField animationField = new BitmapField(image000);
int counter=0;
Timer animationTimer = new Timer();
TimerTask animationTask;

animationTask = new TimerTask() {

public void run() { if(counter == 0){

animationField.setBitmap(image000); }

if(counter == 1){ animationField.setBitmap(image001); }
if(counter == 2){ animationField.setBitmap(image002); }
if(counter == 3){ animationField.setBitmap(image003); }
if(counter == 4){ animationField.setBitmap(image004); }
if(counter == 5){ animationField.setBitmap(image005); }
if(counter == 6){ animationField.setBitmap(image006); }
if(counter == 7){ animationField.setBitmap(image007); }
if(counter == 8){ animationField.setBitmap(image008); }
if(counter == 9){ animationField.setBitmap(image009); }
if(counter == 10){ animationField.setBitmap(image010); }
if(counter == 11){ animationField.setBitmap(image011);
counter = -1; } counter++;

 } };

animationTimer.scheduleAtFixedRate(animationTask, 0, 100);
add(animationField);

Thursday, March 28, 2013

Application Permissions in Blackberry

BlackBerry Enterprise Server administrators can control the data and APIs that BlackBerry Java Applications can access on BlackBerry devices, and the external data sources and network connections that BlackBerry Java Applications can access by using application control policies. For example, administrators can use application control policies to prevent users from installing an application on a BlackBerry device.
Application control policies enable administrators to perform the following actions:
  • prevent users from installing and running applications on BlackBerry devices
  • limit internal connections (connections behind a firewall)
  • limit external connections
  • limit local connections (serial, infrared, and USB connections)
  • limit access to the key store
  • limit access to particular APIs

You can determine whether an API is available for use on a BlackBerry device and request that the user change permissions, if necessary. In the following code sample, the application checks whether the application control settings permit access to location-based services. If the API is unavailable, the application prompts the user for permission to use this API.

ApplicationPermissionsManager appPermMgr = 
ApplicationPermissionsManager.getInstance();

// Query the Location permission
int locationPermission = appPermMgr.getPermission( 
ApplicationPermissions.PERMISSION_LOCATION_DATA );
        
if( locationPermission != ApplicationPermissions.VALUE_ALLOW ) {

    // Build the permission request
    ApplicationPermissions requestedPermissions = 
        new ApplicationPermissions();

    requestedPermissions.addPermission( 
        ApplicationPermissions.PERMISSION_LOCATION_DATA );

    // Invoke the request, the system takes over            
    appPermMgr.invokePermissionsRequest( requestedPermissions ); 
}
 

Friday, March 22, 2013

TreeField With CheckBox in Blackberry

The following code will help you in creating a TreeField with checkBox.











In Main Screen Class Add the CBTreeField to thhe Screen.

           CBTreeField tree = new CBTreeField("root", false);
            add(tree);
            int ch01 = tree.addChildNode(0, "child 0-1", true, null);
            int ch02 = tree.addChildNode(0, "child 0-2", false, null);
            int ch03 = tree.addChildNode(0, "child 0-3", false, null);
            int ch011 = tree.addChildNode(ch01, "child 0-1-1", false, null);
            int ch012 = tree.addChildNode(ch01, "child 0-1-2", true, null);
            int ch031 = tree.addChildNode(ch03, "child 0-3-1", true, null);

The CBTreeField class is given below -

public class CBTreeField extends VerticalFieldManager implements TreeFieldCallback,
        DrawStyle {
    boolean[] mBooleanValues = new boolean[] {};
    String[] mStringValues = new String[] {};

    public boolean getNodeBooleanValue(int node) {
        return mBooleanValues[node];
    }

    public void setNodeBooleanValue(int node, boolean value) {
        mBooleanValues[node] = value;
    }

    TreeField mRootField = null;

    public CBTreeField(String rootString, boolean rootBoolean) {
        mRootField = new TreeField(this, TreeField.FOCUSABLE);
        add(mRootField);
        mStringValues = insertAt(mStringValues, 0, rootString);
        mBooleanValues = insertAt(mBooleanValues, 0, rootBoolean);
    }

    public int addSiblingNode(int previousSibling, String stringValue,
            boolean booleanValue, Object cookie) {
        int index = mRootField.addSiblingNode(previousSibling, cookie);
        mBooleanValues = insertAt(mBooleanValues, index, booleanValue);
        mStringValues = insertAt(mStringValues, index, stringValue);
        return index;
    }

    public int addChildNode(int parent, String stringValue,
            boolean booleanValue, Object cookie) {
        int index = mRootField.addChildNode(parent, cookie);
        mBooleanValues = insertAt(mBooleanValues, index, booleanValue);
        mStringValues = insertAt(mStringValues, index, stringValue);
        return index;
    }

    static boolean[] insertAt(boolean[] inArray, int index, boolean value) {
        int newLen = inArray.length + 1;
        boolean[] outArray = new boolean[newLen];
        for (int i = 0, j = 0; i < newLen; i++, j++) {
            outArray[i] = (i != index) ? inArray[j] : value;
            if (i == index)
                j++;
        }
        return outArray;
    }

    static String[] insertAt(String[] inArray, int index, String value) {
        int newLen = inArray.length + 1;
        String[] outArray = new String[newLen];
        for (int i = 0, j = 0; i < newLen; i++, j++) {
            outArray[i] = (i != index) ? inArray[j] : value;
            if (i == index)
                j++;
        }
        return outArray;
    }

    public void drawTreeItem(TreeField treeField, Graphics g, int node, int y,
            int width, int indent) {
        String check = String
                .valueOf(mBooleanValues[node] ?
                Characters.BALLOT_BOX_WITH_CHECK : Characters.BALLOT_BOX);
        g.drawText(check, indent, y, DrawStyle.LEFT);
        g.drawText(mStringValues[node], indent + 20, y, DrawStyle.RIGHT
                | ELLIPSIS);
    }

    protected void makeMenu(Menu menu, int instance) {
        super.makeMenu(menu, instance);
        menu.add(new MenuItem("Change value", 0, 0) {
            public void run() {
                int node = mRootField.getCurrentNode();
                mBooleanValues[node] = !mBooleanValues[node];
                invalidate();
            }
        });
    }
}

Wednesday, March 6, 2013

BlackBerry Internet Service (BIS)

The BlackBerry Internet Service is designed to provide users with real-time delivery of email messages, mobile access to attachments, and convenient access to Internet content.

The BlackBerry Internet Service uses the security of the wireless network that it connects to. Email messages that are sent between the BlackBerry Internet Service and a BlackBerry device are not encrypted. When email messages are sent over the wireless network, they are subject to the existing or available network security model(s). However, email messages that are sent between the BlackBerry Internet Service and a messaging server can be encrypted using Secure Sockets Layer (SSL) encryption. SSL encryption can also be used by the BlackBerry® Browser and other applications on a BlackBerry device to help protect data when a user connects to the Internet (for example, while shopping and banking online).