问题描述
插件应用程序如何通过主应用程序的活动(或单例类)调用服务(通过AIDL)以运行过程并获取数据并将其传输回插件应用程序的活动?
在我的带有rentp.coffee包的主应用程序中,我的类带有主活动:
public class BeanActivity extends AppCompatActivity .... {
public boolean onoptionsItemSelected (MenuItem item) {
if (id == R.id.mi_create) {
Intent intent = new Intent();
intent.setComponent (new ComponentName("rentp.coffee.roastery","rentp.coffee.roastery.EditBeanActivity"));
intent.putExtra ( .... );
....
startActivity (intent);
return true;
}
....
}
}
List<ExRow> list = dbService.get_exrows (cname,si);
BerkeleyDB.get_instance().get_exrows (cname,si);
来自主应用程序。但是dbService的直接调用会导致错误,因为它是其他线程。
如何调用主应用程序方法而不是仅做一些事情,而是使用参数取回数据?
架构类似于:
mainActivity -> pluginActivity -> dbService -> .... -> dbSingletonClass
pluginActivity <- dbService <- .... <-
mainActivity在主应用程序中,pluginActivity在其他插件应用程序中,带有dbSingletonClass的dbService在主应用程序的软件包中。
也许不用AIDL也可以通过其他方式解决?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)