我已经在我的应用程序中实现了插件系统。插件作为独立应用程序存在。
从主应用程序中的插件访问可绘制对象的最佳方式是什么?
最佳答案
你有几个选择:
ContentProvider - 不一定需要基于
SQLite
数据库。list 属性
android:sharedUserId
来自文档:
The name of a Linux user ID that will be shared with other applications. By default, Android assigns each application its own unique user ID. However, if this attribute is set to the same value for two or more applications, they will all share the same ID — provided that they are also signed by the same certificate. Application with the same user ID can access each other's data and, if desired, run in the same process.
参见 http://developer.android.com/guide/topics/manifest/manifest-element.html#uid
PackageManager.getResourcesForApplication()检索与应用程序关联的资源。
用法:
PackageManager pm = getPackageManager(); try { Resources resources = pm.getResourcesForApplication("com.example.app"); int id = resources.getIdentifier("ic_launcher", "drawable", "com.example.app"); Drawable d = resources.getDrawable(id) } catch (NameNotFoundException e) { e.printStackTrace(); }
关于android - 在应用程序之间共享可绘制对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11626359/