Create Notifications On Home Screen - blackberry

I want to create notification icon on home screen when the application is run in background,,in the application have thread for check upcoming respon,,and i want to show in home screen use notification icon,,can help me??

Use the following code:
public static void registerIndicator() {
EncodedImage mImageGreen = EncodedImage.getEncodedImageResource("res/mail.png");
ApplicationIcon mIconGreen = new ApplicationIcon(mImageGreen);
ApplicationIcon mIcon = mIconGreen;
try {
ApplicationIndicatorRegistry reg = ApplicationIndicatorRegistry.getInstance();
ApplicationIndicator indicator = reg.register(mIcon, false, true);
} catch (Exception ex) { }
}
public static void updateIndicatorValue(int value) {
try {
ApplicationIndicatorRegistry reg = ApplicationIndicatorRegistry.getInstance();
ApplicationIndicator appIndicator = reg.getApplicationIndicator();
appIndicator.setValue(value);
} catch (Exception e) { }
}
public static int getIndicatorValue() {
try {
ApplicationIndicatorRegistry reg = ApplicationIndicatorRegistry.getInstance();
ApplicationIndicator appIndicator = reg.getApplicationIndicator();
return appIndicator.getValue();
} catch (Exception e) { }
return -1;
}

Related

Close(kill) another app in my application by package name

I would like to close(kill) another app in my application by package name. I am trying something like this, but this code don't close any app. what am i doing wrong?
public void amKillProcess(string package_name)
{
ActivityManager am = (ActivityManager)this.GetSystemService(Context.ActivityService);
IList<RunningAppProcessInfo> runningProcesses = am.RunningAppProcesses;
foreach (RunningAppProcessInfo runningProcess in runningProcesses)
{
if (runningProcess.ProcessName.Contains(package_name))
{
Android.OS.Process.SendSignal(runningProcess.Pid, Signal.Kill);
am.KillBackgroundProcesses(runningProcess.ProcessName);
}
}
}
P.S I added android.permission.KILL_BACKGROUND_PROCESSES and by this code i can close only my own app
If you want to kill a background app , check the following code
public void amKillProcess(string package_name)
{
ActivityManager am = (ActivityManager)this.GetSystemService(Context.ActivityService);
var runningProcesses = am.RunningAppProcesses;
foreach (RunningAppProcessInfo runningProcess in runningProcesses)
{
if (runningProcess.ProcessName.Contains(package_name))
{
Android.OS.Process.KillProcess(runningProcess.Uid);
}
}
}
And if you want to kill a foreground app, you could use Adb
public class SuUtil
{
private static Java.Lang.Process process;
public static void kill(string packageName)
{
initProcess();
killProcess(packageName);
close();
}
private static void initProcess()
{
if (process == null)
try
{
process = Runtime.GetRuntime().Exec("su");
}
catch (IOException e)
{
}
}
private static void killProcess(string packageName)
{
System.IO.Stream output = process.OutputStream;
Java.Lang.String cmd = new Java.Lang.String("am force-stop " + packageName + " \n");
try
{
output.Write(cmd.GetBytes());
output.Flush();
}
catch (IOException e)
{
}
}
private static void close()
{
if (process != null)
try
{
process.OutputStream.Close();
process = null;
}
catch (IOException e)
{
}
}
}

Vaadin upload with PipedInputStream & PipedOutputStream example

I just started learning Vaadin 8 and my first example is Upload button. I was stuck with an issue where I could not solve the problem for many hours and hours.
Here it is,
I am returning PipedOutputStream in the receiveUpload method,
Here is the code for receiveUpload method,
public OutputStream receiveUpload(String filename, String mimeType) {
this.fileName = filename;
this.mimeType = mimeType;
try {
pipedOutputStream = new PipedOutputStream();
pipedInputStream = new PipedInputStream(pipedOutputStream);
if (filename == null || filename.trim().length() == 0) {
upload.interruptUpload();
} else {
}
} catch (Exception e) {
e.printStackTrace();
}
return pipedOutputStream;
}
In the uploadSucceeded method, I need to take the pipedinputstream and send it another method to load the stream into the database
public void uploadSucceeded(SucceededEvent event) {
try {
fileUploadOperation.upload(pipedInputStream); --> I need to push all the stream data in one go into a method to generate a file at the business layer
} catch (Exception e) {
e.printStackTrace();
}
}
When I was running the application, it hangs out for a long time and I could not figure out where it is. Later I could notice that both piped input and piped output streams should be created in separate threads or at least one of them in a separate thread but don't know how to handle it.
Any help
I am pasting the complete class for more information,
public class WebCommunityView implements Receiver, FailedListener, SucceededListener, StartedListener, FinishedListener {
private PipedOutputStream pipedOutputStream = null;
private PipedInputStream pipedInputStream = null;
private Upload upload = null;
private String fileName = null, mimeType = null;
private Grid<FileListProperties> fileListGrid = null;
public final static WebCommunityView newInstance(WebContentScreen screen) {
vw.initBody();
return vw;
}
protected void initBody() {
VerticalLayout verticalLayout = new VerticalLayout();
fileListGrid = new Grid<FileListProperties>();
fileListGrid.addColumn(FileListProperties::getCreatedDate).setCaption("Date");
fileListGrid.addColumn(FileListProperties::getFileName).setCaption("File Name");
fileListGrid.addColumn(FileListProperties::getUserName).setCaption("User Name");
fileListGrid.addComponentColumn(this::buildDownloadButton).setCaption("Download");
fileListGrid.setItems(loadGridWithFileInfo());
upload = new Upload("", this);
upload.setImmediateMode(false);
upload.addFailedListener((Upload.FailedListener) this);
upload.addSucceededListener((Upload.SucceededListener) this);
upload.addStartedListener((Upload.StartedListener) this);
upload.addFinishedListener((Upload.FinishedListener) this);
Label fileUploadLabel = new Label("Label"));
verticalLayout.addComponent(currentListLabel);
verticalLayout.addComponent(fileListGrid);
verticalLayout.addComponent(fileUploadLabel);
verticalLayout.addComponent(upload);
mainbody.addComponent(verticalLayout);
}
#Override
public void uploadSucceeded(SucceededEvent event) {
try {
//Model Layer
fileUploadOperation.upload(pipedInputStream);
fileUploadOperation.commit();
} catch (Exception e) {
e.printStackTrace();
}
}
#Override
public void uploadFailed(FailedEvent event) {
if (event.getFilename() == null) {
Notification.show("Upload failed", Notification.Type.HUMANIZED_MESSAGE);
}
try {
//Model Layer
fileUploadOperation.abort();
} catch (Exception e) {
e.printStackTrace();
}
}
public OutputStream receiveUpload(String filename, String mimeType) {
this.fileName = filename;
this.mimeType = mimeType;
try {
pipedOutputStream = new PipedOutputStream();
new Thread() {
public void run() {
try {
System.out.println("pipedInputStream Thread started");
pipedInputStream = new PipedInputStream(pipedOutputStream);
} catch (Exception e) {
e.printStackTrace();
}
};
}.start();
if (filename == null || filename.trim().length() == 0) {
screen.displayMessage("Please select a file to upload !", WebContentScreen.MESSAGE_TYPE_WARNING);
upload.interruptUpload();
} else {
Properties properties = new Properties();
properties.setProperty("NAME", fileName);
properties.setProperty("MIME_TYPE", mimeType);
//Model Layer
fileUploadOperation.initialize(properties);
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("pipedOutputStream:"+pipedOutputStream);
return pipedOutputStream;
}
private List<FileListProperties> loadGridWithFileInfo() {
List<FileListProperties> list = null;
DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
try {
list = new ArrayList<FileListProperties>(1);
Collection<FileInfo> fileInfoList = fileCommandQuery.lstFilesForDownload();
for (Iterator iterator = fileInfoList.iterator(); iterator.hasNext();) {
FileInfo fileInfo = (FileInfo) iterator.next();
Properties properties = fileInfo.getProperties();
Collection<String> mandatoryParameters = fileInfo.getMandatoryProperties();
FileListProperties fileListProperties = new FileListProperties();
for (Iterator iterator2 = mandatoryParameters.iterator(); iterator2.hasNext();) {
String key = (String) iterator2.next();
String value = properties.getProperty(key);
if (key != null && key.equalsIgnoreCase("NAME")) {
fileListProperties.setFileName(value);
} else if (key != null && key.equalsIgnoreCase("USER_NAME")) {
fileListProperties.setUserName(value);
} else if (key != null && key.equalsIgnoreCase("CREATED_DATE")) {
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(1550566760000L);
fileListProperties.setCreatedDate(dateFormat.format(calendar.getTime()));
}
}
if (fileListProperties != null) {
list.add(fileListProperties);
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
dateFormat = null;
}
return list;
}
private Button buildDownloadButton(FileListProperties fileListProperties) {
Button button = new Button("...");
button.addClickListener(e -> downloadFile(fileListProperties));
return button;
}
private void downloadFile(FileListProperties fileListProperties) {
}
}
The problem in your example is that you need to do the actual file handling in a separate thread. The Viritin add-on contains a component called UploadFileHandler that simplifies this kind of usage a lot. It will provide you InputStream to consume. The integration test for the component contains this kind of usage example.
Also, my recent blog entry about the subject might help.

How to save captured image in a folder in blackberry?

I am developing application which has camera functionality. i want to save that captured image in my project folder.Can any one help me please.
thanx in advance.
This below code may help you:
Add this to Main Screen which you want to show the camera:
captureImage=new MenuItem("Capture Images",10,100)
{
public void run()
{
synchronized (Application.getEventLock())
{
captureImage();
}
}
};
addMenuItem(captureImage);
The code for captureImage() method is:
private void captureImage()
{
try
{
player = javax.microedition.media.Manager.createPlayer("capture://video?encoding=jpeg&width=1024&height=768");
player.realize();
_videoControl = (VideoControl) player.getControl("VideoControl");
if (_videoControl != null)
{
Field videoField = (Field) _videoControl.initDisplayMode (VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");
_videoControl.setDisplayFullScreen(true);
_videoControl.setVisible(true);
player.start();
if(videoField != null)
{
add(videoField);
}
}
}
catch(Exception e)
{
if(player!=null)
{
player.close();
}
Dialog.alert(e.toString());
}
}
The below code is save the image into the sdcard or device card. Override the invokeAction(int action) Method
protected boolean invokeAction(int action)
{
boolean handled = super.invokeAction(action);
if(SdcardTest.SdcardAvailabulity())//I am checking here that the sdcard is there of or not.....?
{
//PATH = "file:///SDCard/BlackBerry/pictures/"+"Image_"+System.currentTimeMillis()+".jpg";
PATH = System.getProperty("fileconn.dir.memorycard.photos")+"Image_"+System.currentTimeMillis()+".jpg";//here "str" having the current Date and Time;
}
else
{
PATH = System.getProperty("fileconn.dir.photos")+"Image_"+System.currentTimeMillis()+".jpg";
}
if(!handled)
{
if(action == ACTION_INVOKE)
{
try
{
byte[] rawImage = _videoControl.getSnapshot(null);
fileconn=(FileConnection)Connector.open(PATH);
if(fileconn.exists())
{
fileconn.delete();
}
fileconn.create();
OutputStream os=fileconn.openOutputStream();
os.write(rawImage);
fileconn.close();
os.close();
Status.show("Image is Captured",200);
if(player!=null)
player.close();
}
catch(Exception e)
{
if(player!=null)
{
player.close();
}
if(fileconn!=null)
{
try
{
fileconn.close();
}
catch (IOException e1)
{
//if the action is other than click the trackwheel(means go to the menu options) then we do nothing;
}
}
}
}
}
return handled;
}
try this for image snap
Note: you can not store in resource folder you can only store in SDcard
class screen extends MainScreen implements FieldChangeListener
{
private VideoControl vc;
private String encoding;
private Player p;
private Field viewFinder;
private BitmapField bitmapField;
private ButtonField btn;
public screen() {
btn=new ButtonField("snap",Field.FOCUSABLE);
btn.setChangeListener(this);
add(btn);
}
public void fieldChanged(Field field, int context) {
if(field==btn)
{
try{
p = Manager.createPlayer("capture://video");
p.realize();
p.prefetch();
p.start();
vc = (VideoControl) p.getControl("VideoControl");
viewFinder = (Field)vc.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");
vc.setVisible(true);
final String imageType = "encoding=jpeg&width=640&height=480&quality=superfine";
UiApplication.getUiApplication().invokeLater(new Runnable(){
public void run(){
byte[] image = vc.getSnapshot(imageType);
FileConnection conn = (FileConnection)Connector.open("file:///store/home/user/pictures/"+System.currentTimeMillis()+".jpeg", Connector.READ_WRITE);
conn.create();
OutputStream out = conn.openOutputStream();
out.write(image);
out.flush();
out.close();
conn.close();
Bitmap image1 = Bitmap.createBitmapFromBytes(imageBytes, 0, imageBytes.length, 4);
bitmapField.setBitmap(image1);
add(bitmapField);
}
});
} catch (Exception me){
}
}
}
}
for more operations please use this
http://supportforums.blackberry.com/rim/attachments/rim/java_dev#tkb/226/1/SnapshotSample.zip
if you want to save an image from camera to your device you can use the following code.
try
{
focusControl.startAutoFocus();
byte[] image = videoControl.getSnapshot(null);
String message = "Captured "+image.length+" bytes of JPG data";
debug(message);
FileConnection conn = (FileConnection)Connector.open("file:///store/home/user/pictures/"+(new Date()).getTime()+".jpg", Connector.READ_WRITE);
conn.create();
OutputStream out = conn.openOutputStream();
out.write(image);
out.flush();
out.close();
conn.close();
Dialog.alert(message);
}
catch (Exception e) {
Dialog.alert("Capture failed due to: "+e.getMessage());
}
If you want to save the images in your Project/res or Project/src during runtime, you cant do that.
You can save image in SDcard/device.
Why would you want to save it in your project source?

How To Change the field on focus in blackberry

Hello Sir I m making an app in which i got stuck in a problem please help me out ...
in one page i m getting the data from server and displaying that data on the page now i m use Focusable for highlighting them ...now my requirement is that when focus come on any data the it should change the field taking that name on which focus is present ..
following is the code which is showing the data on the page now it is working on field change where i need to click the label field ....
static LabelField[] CrDrLabels;
public LowerCreditors() throws Exception {
super(VerticalFieldManager.VERTICAL_SCROLL);
CrDrLabels = new LabelField[CrDrList.VendorNameArr.length];
for (int i = 0; i < CrDrLabels.length; i++) {
final int t = i;
VerticalFieldManager hfm = new VerticalFieldManager(USE_ALL_WIDTH) {
protected void sublayout(int Width, int Height) {
// TODO Auto-generated method stub
super.sublayout(Width, Height);
setPositionChild(getField(0), 15, 0);
setPositionChild(getField(1), Display.getWidth()
- getFont().getAdvance(CrDrList.VendorValArr[t])
- 10, 0);
}
};
CrDrLabels[i] = new LabelField(CrDrList.VendorNameArr[i],
LabelField.FOCUSABLE | Field.USE_ALL_WIDTH) {
protected boolean navigationClick(int status, int time) {
fieldChanged(this, 0);
return true;
};
};
LabelField Value = new LabelField(CrDrList.VendorValArr[i]);
CrDrLabels[i].setPadding(0, 170, 0, 0);
hfm.add(CrDrLabels[i]);
hfm.add(Value);
add(hfm);
}
}
public void fieldChanged(Field field, int context) {
// TODO Auto-generated method stub
for (int i = 0; i < CrDrList.VendorNameArr.length; i++) {
getFieldWithFocus();
if (field == CrDrLabels[i]) {
String LN = CrDrLabels[i].getText();
CrDrList.cname1 = LN;
LabelField cname1 = CrDrLabels[i];
CrDrList.selLad = CrDrLabels[i];
}
}
}
and the the other code is
menu.add(new MenuItem("View last 5 days transaction", 20, 10) {
public void run() {
if(property.Status.equals("online"))
{
Viewlast5daystransaction();
}
else
{
Dialog.alert("Please login Online to access the data..");
}
}
String LedgerName = CrDrList.cname1;
private void Viewlast5daystransaction() {
//Dialog.alert("Last 5 Days Transaction");
int resCode = 0;
HttpConnection connection = null;
try {
connection = getConn(property.LedgerDetailsURL);
} catch (Exception e1) {
// TODO Auto-generated catch block
System.out.println(e1.getMessage());
e1.printStackTrace();
}
try {
resCode = connection.getResponseCode();
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
if(resCode==0)
{
Dialog.alert("Internet Connectivity not available.. Please try again later..");
TallyA TA;
try {
TA = new TallyA();
UiApplication.getUiApplication().popScreen();
UiApplication.getUiApplication().pushScreen(TA);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
sPostdata = "{\"tok\":\""
+ CompanyList.tok;
System.out.println("Postedddddd Dataaaaaaaaa" + sPostdata);
try {
String response = LedgerSearchReport();
System.out.println("response" + response);
ParseBankdetails.parsebankdetails(response);
System.out.println("response : " + response);
if(response != null)
{
LastFiveDaysCr LF;
try {
LF = new LastFiveDaysCr();
UiApplication.getUiApplication().pushScreen(LF);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
else
{
Dialog.alert("No Data..");
Creditiors LF;
try {
LF = new Creditiors();
UiApplication.getUiApplication().pushScreen(LF);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
catch (Exception e) {
e.printStackTrace();
}
}
});
in this field only i want that instead of field change there should be focus change ...
please help me on that ...
I think you should implement the logic in "onFoucus()" method ,instead of using "onfieldChanged()" for CrDrLabels[i];

Blackberry - Running Background Application

Good afternoon.
I'm starting programming in java and blackberry.
I am developing an application with three windows, which I will show basic information about the device, these windows are already done and working.
I need to create a process running in the background, this process will run every 10 minutes.
As I make this process run in the background and is working to close the windows?
This is the kind that runs the application:
public class InfoBerry extends UiApplication{
public vtnprincipal vtnprincipal;
public vtnbateria vtnbateria;
public vtnestado vtnestado ;
public vtnacerca vtnacerca;
public InfoBerry(){
}
public static void main(String[] args) {
InfoBerry theApp = new InfoBerry();
theApp.mostrarpantalla();
}
public void mostrarpantalla(){
vtnprincipal = new vtnprincipal(this);
vtnbateria = new vtnbateria(this);
vtnestado = new vtnestado(this);
vtnacerca = new vtnacerca(this);
// Inicailizamos los componentes de la pantalla principal
vtnprincipal.incventana();
// La pnemos en lo alto de la pila de pantallas
pushScreen(this.vtnprincipal);
}
}
And this is the class you need to run in the background.
As I have to make the call to this class to run in the background?
class iconnoti extends MainScreen{
//icono de la temperatura
EncodedImage imgtem =
EncodedImage.getEncodedImageResource("icon_bateria_t.png");
ApplicationIcon icontem = new ApplicationIcon(imgtem);
//icono de la carga de la bateria
EncodedImage imgcarga =
EncodedImage.getEncodedImageResource("icon_bateria.png");
ApplicationIcon iconcarga = new ApplicationIcon(imgcarga);
//icono de la memoria
EncodedImage imgmemo =
EncodedImage.getEncodedImageResource("icon_memoria.png");
ApplicationIcon iconmemo = new ApplicationIcon(imgmemo);
ApplicationIcon mIcon = icontem;
boolean act;
public iconnoti() {
}
public void rotar_temperatura(){
cron c1;
actualizar_icono(icontem);
actualizar_valor(DeviceInfo.getBatteryTemperature());
c1 = new cron(2,10000);
c1.start();
}
public void rotar_memoria(){
cron c1;
actualizar_icono(iconmemo);
actualizar_valor(34);
c1 = new cron(3,10000);
c1.start();
}
public void rotar_nivel(){
cron c1;
actualizar_icono(iconcarga);
actualizar_valor(DeviceInfo.getBatteryLevel());
c1 = new cron(1,10000);
c1.start();
}
public void iniciar_servicio() {
try {
ApplicationIndicatorRegistry reg =
ApplicationIndicatorRegistry.getInstance();
ApplicationIndicator Indicator =
reg.register(mIcon, false, true);
} catch (Exception e) {
}
}
public void parar_servicio() {
try {
ApplicationIndicatorRegistry reg =
ApplicationIndicatorRegistry.getInstance();
reg.unregister();
} catch (Exception e) {
}
}
void actualizar_valor(int value) {
try {
ApplicationIndicatorRegistry reg =
ApplicationIndicatorRegistry.getInstance();
ApplicationIndicator appIndicator =
reg.getApplicationIndicator();
appIndicator.setValue(value);
} catch (Exception e) {
}
}
void actualizar_icono(ApplicationIcon icon) {
try {
ApplicationIndicatorRegistry reg =
ApplicationIndicatorRegistry.getInstance();
ApplicationIndicator appIndicator =
reg.getApplicationIndicator();
appIndicator.setIcon(icon);
} catch (Exception e) {
}
}
}
class cron extends Thread {
//private ApplicationIcon icono;
public int valor;
private int tiempo;
iconnoti icon = new iconnoti();
public cron(int v, int t){
valor = v;
tiempo = t;
}
public void run() {
try {
sleep(tiempo);
} catch (InterruptedException e) {
}
if(valor == 1){
icon.rotar_temperatura();
}else if(valor == 2){
icon.rotar_memoria();
}else if(valor == 3){
icon.rotar_nivel();
}
}
}
Thanks for the help.
Background Application is a kind of process, so there is no GUI at least on the beginning.
You should extend Application instead of UIApplication class
You should not push screen there, just move everything from iconnoti class to cron class and run it in Application constructor:
public class BerryInfoApp extends Application {
public BerryInfoApp() {
UpdateThread updateThread = new UpdateThread(10*60*1000);
updateThread.run();
}
public static void main(String[] args) {
(new BerryInfoApp()).enterEventDispatcher();
}
}
class UpdateThread extends Thread {
EncodedImage imgtem = EncodedImage
.getEncodedImageResource("icon_bateria_t.png");
ApplicationIcon icontem = new ApplicationIcon(imgtem);
EncodedImage imgcarga = EncodedImage
.getEncodedImageResource("icon_bateria.png");
ApplicationIcon iconcarga = new ApplicationIcon(imgcarga);
EncodedImage imgmemo = EncodedImage
.getEncodedImageResource("icon_memoria.png");
ApplicationIcon iconmemo = new ApplicationIcon(imgmemo);
ApplicationIcon mIcon = icontem;
static final int ACTION_NONE = 0;
static final int ACTION_BATTERY_TEMP = 1;
static final int ACTION_MEMORY = 2;
static final int ACTION_BATTERY_LEVEL = 3;
int mAction = ACTION_BATTERY_LEVEL;
long mPeriod;
public UpdateThread(int period) {
mPeriod = period;
}
public void stop() {
mAction = ACTION_NONE;
}
public void run() {
iniciar_servicio();
while (mAction != ACTION_NONE) {
switch (mAction) {
case ACTION_BATTERY_TEMP:
rotar_temperatura();
mAction = ACTION_MEMORY;
break;
case ACTION_MEMORY:
rotar_memoria();
mAction = ACTION_BATTERY_LEVEL;
break;
case ACTION_BATTERY_LEVEL:
rotar_nivel();
mAction = ACTION_BATTERY_TEMP;
break;
default:
break;
}
try {
sleep(mPeriod);
} catch (InterruptedException e) {
}
}
parar_servicio();
}
public void rotar_temperatura() {
actualizar_icono(icontem);
actualizar_valor(DeviceInfo.getBatteryTemperature());
}
public void rotar_memoria() {
actualizar_icono(iconmemo);
actualizar_valor(34);
}
public void rotar_nivel() {
actualizar_icono(iconcarga);
actualizar_valor(DeviceInfo.getBatteryLevel());
}
public void iniciar_servicio() {
try {
ApplicationIndicatorRegistry reg = ApplicationIndicatorRegistry
.getInstance();
ApplicationIndicator Indicator = reg.register(mIcon, false, true);
} catch (Exception e) {
}
}
public void parar_servicio() {
try {
ApplicationIndicatorRegistry reg = ApplicationIndicatorRegistry
.getInstance();
reg.unregister();
} catch (Exception e) {
}
}
void actualizar_valor(int value) {
try {
ApplicationIndicatorRegistry reg = ApplicationIndicatorRegistry
.getInstance();
ApplicationIndicator appIndicator = reg.getApplicationIndicator();
appIndicator.setValue(value);
} catch (Exception e) {
}
}
void actualizar_icono(ApplicationIcon icon) {
try {
ApplicationIndicatorRegistry reg = ApplicationIndicatorRegistry
.getInstance();
ApplicationIndicator appIndicator = reg.getApplicationIndicator();
appIndicator.setIcon(icon);
} catch (Exception e) {
}
}
}

Resources