小编Sur*_*rai的帖子

关闭android通知

我在服务开始时创建了通知,但我不知道如何在服务停止或销毁时关闭该通知.有任何想法.

以下代码在服务启动时启动通知.

String ns = Context.NOTIFICATION_SERVICE;
    final int KEEPUS_NOTIFICATION_ID = 1;
    NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(ns);
    Notification notification = new Notification(R.drawable.notification_icon1, ticker_text, System.currentTimeMillis());
    Intent notificationIntent = new Intent(context, KeepusActivity.class);
    PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
    notification.setLatestEventInfo(context, ticker_content_title, ticker_content_text,contentIntent);
    mNotificationManager.notify(KEEPUS_NOTIFICATION_ID, notification);
Run Code Online (Sandbox Code Playgroud)

notifications android

6
推荐指数
1
解决办法
2万
查看次数

在blackberry应用程序的create directory上抛出"FileIOException:Not a directory"

我想创建我的Application目录来保存我的配置文件.但黑莓模拟器在创建目录时抛出异常.我试过以下代码.

try {
FileConnection myAppDir = (FileConnection) Connector.open("file:///store/home/user/myAppDir", Connector.READ_WRITE);
    if (!myAppDir.exists()){
        myAppDir.mkdir(); // Exception throw here
    }
} catch (Exception e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)

抛出异常

net.rim.device.api.io.file.FileIOException: Not a directory
Run Code Online (Sandbox Code Playgroud)

file-io blackberry create-directory

3
推荐指数
1
解决办法
620
查看次数