Today my planning to Blackberry simple task but most of time it's use on our application.
1. Get IMEI No:
2. Set Font on LabelField:
3. get List of Install Application:
4.Sent Mail:
Thanks,,..
1. Get IMEI No:
private String getIMEINumber() { byte[] imeiByteArray = net.rim.device.api.system.GPRSInfo.getIMEI(); String imei = net.rim.device.api.system.GPRSInfo.imeiToString(imeiByteArray); imeiByteArray = null; return imei; }
2. Set Font on LabelField:
LabelField lblTemp = new LabelField("Temp"); FontFamily fontFamily[] = FontFamily.getFontFamilies(); Font font = fontFamily[1].getFont(FontFamily.CBTF_FONT, 12); lblTemp.setFont(font);
3. get List of Install Application:
net.rim.device.api.system.CodeModuleManager.getModuleHandles()get an array of handles into all modules now.
net.rim.device.api.system.CodeModuleManager.getApplicationDescriptors(int moduleHandle)To get ApplicationDescriptors associated with the module. You will have to sort out which modules are libraries and which are applications.
4.Sent Mail:
private void invokeMail(String emailID){ try{ Message m = new Message(); Address a = new Address(""+emailID, "Mail Title"); Address[] addresses = {a}; m.addRecipients(net.rim.blackberry.api.mail.Message.RecipientType.TO, addresses); m.setContent(""); m.setSubject("Mail Subject"); Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new MessageArguments(m)); }catch(Exception e){ System.out.println("Error on Open Mail"); } }5. Invoke Call
private void invokeCall(String callNo){ PhoneArguments call = new PhoneArguments(PhoneArguments.ARG_CALL, callNo); Invoke.invokeApplication(Invoke.APP_TYPE_PHONE, call); }Read Image from SD Card
public Bitmap getImage(){ Bitmap bitmapImage=null; try{ InputStream input; FileConnection fconn = (FileConnection) Connector.open("file:///store/home/user/dirname/imgname.png", Connector.READ_WRITE); input = fconn.openInputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); int j = 0; while((j=input.read()) != -1) { baos.write(j); } byte[] byteArray = baos.toByteArray(); bitmapImage = Bitmap.createBitmapFromBytes(byteArray,0,byteArray.length,1); }catch(Exception ioe){ System.out.println(ioe); } return bitmapImage; }
Thanks,,..
No comments:
Post a Comment