我有一个库,比如LIB,它公开了很多API和类供应用程序开发人员使用.
如果有多个应用程序在手机上使用LIB,我只想创建并运行一个LIB实例.它有点类似于Android平台服务,如LocationManager,SensorManager,PackageManager等.
具体而言,有两个问题需要解决: -
我想通过AIDL与客户端应用程序共享一个接口.我一直在编译时错误.代码片段是: -
interface ChildListener extends ParentListener {
public void onUpdate(Class1 c1);
}
Run Code Online (Sandbox Code Playgroud)
AIDL Set(全部在同一个包中) - >
ChildListener.aidl - 包含上面的代码.
Class1.aidl - 将Class1声明为parcelable.Class1的定义实现了parcelable.
ParentListener.aidl - 声明ParentListener.
错误 - >
我收到编译时错误(编译服务时)
1. syntax error don't know what to do with "extends"
2. syntax error don't know what to do with "ParentListener "
Run Code Online (Sandbox Code Playgroud)
看来我们不能在AIDL接口中使用继承?或者是我在这里遗漏了一些东西.任何指针将不胜感激.
最好的祝福
我一直在尝试使用java.util.logging.logger将内容记录到SD卡上的文件中.现在,我希望记录器使用我将在SD卡上提供的日志记录配置/属性文件.
我一直在努力的方法是: -
我一直在尝试使用日志管理和java.util.prefs.Preferences中,但我得到了BackingStoreException - > AccessPermission异常 perculating下来到的.java/.userprefs /路径表示为一个错误消息STR /的prefs.xml未找到.
private void setLoggingProperties(File logProperties) throws Exception {
try {
if(logProperties!=null && logProperties.isFile() && logProperties.exists()) {
String str = logProperties.getAbsolutePath();
MyLogger.v(TAG,"Log Properties file path: " + str);
if(str!=null && str.length()>=0) {
Preferences logPropPref = Preferences.userNodeForPackage(SSCService.class);
if(logPropPref!=null) {
String path = logPropPref.get(LOG_CONFIG_FILE_KEY,"");
if(path.equals(str)) {
SirfLogger.v(TAG,"No need to set config for log");
return;
}
MyLogger.v(TAG,"Setting log properties: " + str);
logPropPref.put(LOG_CONFIG_FILE_KEY, str);
logPropPref.flush();
}
LogManager lManager = LogManager.getLogManager();
if(lManager!=null) { …Run Code Online (Sandbox Code Playgroud) android ×3
aidl ×1
deployment ×1
inheritance ×1
interface ×1
logging ×1
preferences ×1
properties ×1
service ×1
shared ×1