July 27, 2014

Variables and Types in Java

Variables and Types These are given below list of primitives data type in Java. byte, short, int, long, float, double, char, Boolean. byte consume 1 byte in memory, and use to store number data. short consume 2 byte in memory, and use to store number data. int consume 4 byte in memory and use to store number data. long consume 8 byte in memory and use to store number data. float consume 4 byte in memory and ...

Read more
July 26, 2014

How to download Image from Server in Blackberry ?

This function will download the image and will return byte code for that image. public static synchronized byte[] downloadImg(String path ) { // TODO Auto-generated method stub InputStream is = null; is = getInputStream(path); byte[] _byte = null; try { _byte = new byte[is.available()]; _byte = IOUtilities.streamToBytes(is); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } ...

Read more
July 26, 2014

How to create Custom Button in Blackberry ?

package com.a1smartapps.util; import net.rim.device.api.system.Bitmap; import net.rim.device.api.ui.DrawStyle; import net.rim.device.api.ui.Field; import net.rim.device.api.ui.Font; import net.rim.device.api.ui.FontFamily; import net.rim.device.api.ui.Graphics; import net.rim.device.api.ui.Keypad; import net.rim.device.api.ui.component.ButtonField; public class FocusButton extends Field { private String lab ...

Read more
July 26, 2014

How to create SearchField in Blackberry ?

/** * */ package com.a1smartapps.ui import net.rim.device.api.ui.Color; import net.rim.device.api.ui.Font; import net.rim.device.api.ui.Graphics; import net.rim.device.api.ui.XYRect; import net.rim.device.api.ui.component.EditField; /** * @author pawan.jha * */ public class SearchField extends EditField{ Font boldFont = null; String _str = null; Font font = getFont().getDefault().derive(Font.PLAIN, SizeSpec ...

Read more
July 26, 2014

How to make Hyperlink class in Blackberry?

package com.a1smartapps.util; import net.rim.device.api.ui.Color; import net.rim.device.api.ui.DrawStyle; import net.rim.device.api.ui.Field; import net.rim.device.api.ui.Font; import net.rim.device.api.ui.FontFamily; import net.rim.device.api.ui.Graphics; import net.rim.device.api.ui.component.LabelField; public class HyperLink extends LabelField{ public int textColor,focusTextColor = Color.BLUE; private i ...

Read more
July 26, 2014

CustomRichText in BlackBerry?

import net.rim.device.api.ui.Color; import net.rim.device.api.ui.Graphics; import net.rim.device.api.ui.component.ButtonField; import net.rim.device.api.ui.component.RichTextField; public class CustomRichText extends RichTextField{ public int textColor = Color.WHITE; private int maxWidth = -1; public CustomRichText(String text){ super(text, ButtonField.CONSUME_CLICK|FIELD_HCENTER); } public void setColor(in ...

Read more
July 26, 2014

How to get application version in Blackberry?

public static String getAppVersion(String moduleName) { String version = ""; ApplicationDescriptor[] runnningApps = ApplicationManager.getApplicationManager().getVisibleApplications(); for (int i = 0; i < runnningApps.length; i++) { ApplicationDescriptor desc = runnningApps[i]; if (desc.getModuleName().equalsIgnoreCase(moduleName)) { version = desc.getVersion(); break; } } return version; } ...

Read more
July 26, 2014

How to check SDCard is available or not in Blackberry?

public static boolean checkSDCard() { // TODO Auto-generated method stub boolean sdCardPresent = false; String root = null; Enumeration e = FileSystemRegistry.listRoots(); while (e.hasMoreElements()) { root = (String)e.nextElement(); if(root.equalsIgnoreCase("sdcard/")) { sdCardPresent = true; } } return sdCardPresent; } ...

Read more
Scroll to top