Sunday, 9 June 2013

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

Monday, 3 June 2013

Create Route on Map in IOS 6


We can easily create Routes between two places.
Here we have 6 main methods:
-(void)addAnnotationsToMapView
-(NSArray*)getRoutePointFrom:(CLLocationCoordinate2D)origin to:(CLLocationCoordinate2D)destination
-(NSMutableArray *)decodePolyLine:(NSMutableString *)encodedString
-(void)drawRoute
-(void)centerMap
- (MKOverlayView*)mapView:(MKMapView*)theMapView viewForOverlay:(id <MKOverlay>)overlay

Take the code from below link:

Saturday, 18 May 2013

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:
You can download the code from this below link:

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 : 

Saturday, 6 April 2013

INSTAGRAM IN IOS

Find the below GITHUB link to download the INSTAGRAM sample DEMO.

https://github.com/alishaik001/Instagram-IOS

Thanks.

Create CUSTOM MENU in Blackberry Example

Here CustomMenu is a class which we create any number of menu and according to the tag value

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

package com.alishaik.custommenu;

public class StartUp extends UiApplication
{
    public static void main(String[] ali)
    {
        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;

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;

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;
    }       
}
 

any doubts feel free to mail on alishaik001@gmail.com 


Monday, 27 August 2012

Blackberry - Rotate an image in any degree

This BitmapRotation works from Blackberry Version 5.0 on-wards.

Do the following steps:

1. Download the zip file from this link: BitmapRotate at down side.

2. Extract and take the ImageManipulator.java from that add to your project;

3. and use this code from this link: RotatingBitmap on Blackberry;

or

take MY code from the below LINK for rotate an image in BB:

BitmapRotate.zip

Otherwise take this code:

1. Download the zip file from this link: BitmapRotate at down side.

2. Extract and take the ImageManipulator.java from that add to your project;

and then in our code:

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



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

public StartUp()
{
RotateScreen screen = new RotateScreen();
pushScreen(screen);
}

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


================ RotateScreen.java=============


public class RotateScreen extends MainScreen
{
private BitmapField bitmapField = new BitmapField();
private Bitmap bitmap = Bitmap.getBitmapResource("simple.png");
private ImageManipulator imageManip = new ImageManipulator(bitmap);
private int angle=0;

private VerticalFieldManager vfm = new VerticalFieldManager(VerticalFieldManager.USE_ALL_HEIGHT | VerticalFieldManager.USE_ALL_WIDTH)
{
protected void paintBackground(Graphics g)
{
g.setBackgroundColor(Color.GREEN);
g.clear();
}
};
public RotateScreen()
{
super(MainScreen.HORIZONTAL_SCROLLBAR | MainScreen.VERTICAL_SCROLLBAR);
bitmapField.setBitmap(bitmap);
vfm.add(bitmapField);
add(vfm);
addMenuItem(new Restore());
addMenuItem(new Rotate());
addMenuItem(new Continuous());
}

private class Restore extends MenuItem
{
public Restore()
{
super("Restore", 0, 100);
}
public void run()
{
try {
angle = 0;
imageManip.resetTransform();
bitmapField.setBitmap(imageManip.transformAndPaintBitmap());
invalidate();
} catch (Exception e) {
StartUp.showAlertMessage(e.toString());
}

}
}

private class Rotate extends MenuItem {
public Rotate() {
super("Rotate", 0, 100);
}

public void run()
{
try
{
angle +=90;
imageManip.transformByAngle(angle, false, false);
bitmapField.setBitmap(imageManip.transformAndPaintBitmap());
invalidate();
}
catch (Exception e)
{
StartUp.showAlertMessage(e.toString());
}
}
}

private class Continuous extends MenuItem {
public Continuous()
{
super("Continuous", 0, 100);
}

public void run()
{
try
{
new Thread()
{
public void run()
{
for (int angle = 1; angle <= 360; angle++)
{
imageManip.transformByAngle(angle, false, false);
synchronized (UiApplication.getEventLock())
{
bitmapField.setBitmap(imageManip.transformAndPaintBitmap());
invalidate();
}
try
{
Thread.sleep(500);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
}
}.start();

} catch (Exception e) {
StartUp.showAlertMessage(e.toString());
}

}
}
}

See the below Screen shots: