Android编程遇到的小问题20150819

问题一:Notificationbuild()方法是在API level 16才有的

代码:

notification = new Notification.Builder(ctx)
                .setContentTitle("Title").setContentText("Text")
                .setSmallIcon(R.drawable.ic_launcher).build();

提示错误:

Call requires API level 16 (current min is 14): android.app.Notification.Builder#build

原因见文档:

public Notification build ()
Combine all of the options that have been set and return a new Notification object.Added in API level 16

也就是说,Notificationbuild ()方法是在API level 16才有的;而我的适配版本是API level 14,需要使用getNotification ()才行。

问题二:

adb服务出现异常,如果想手工关闭adb服务,可以使用下面的命令:

关闭adb服务命令:adb kill-server
启动adb服务命令:adb start-server

问题三:

eclipse下按alt+/快捷键无代码提示故障:
也不知道为啥会出现这个问题,我的情况解决方法如下:
Window -> Preferences -> General -> Keys
1. Restore Defaults恢复默认设置;
2. 把word completion的快捷键设置alt+C
3. 把Content Assist的快捷键由ctrl+space改成alt+/
4. window -> Preferences -> Java -> Editor -> Content Assist -> Enable auto activation 选项要打上勾;

Android编程遇到的小问题20150819

原文链接:https://beltxman.com/1297.html,若无特殊说明本站内容为 行星带 原创,未经同意禁止转载。

Android编程遇到的小问题20150819”上有 2 条评论;

评论已关闭。

Scroll to top