阅读454 返回首页    go 阿里云 go 技术社区[云栖]


apk之间资源共享

apk之间可以相互读取数据。

注意以下条件:

1.有同样的签名(app.keystoe)

2.在AndroidManifest.xml文件中配置的android:sharedUserId属性值相同

3.两个apk运行在同一个进程中.

主程序及读取的apk中AndroidManifest.xml中配置

        android:sharedUserId="com.why.android"

访问资源的方法

        Context mContext = this.createPackageContext("com.demo.android",Context.CONTEXT_IGNORE_SECURITY); 

        Drawable image = mContext.getResources().getDrawable(R.drawable.icon);

    Button mButton = (Button)findViewById(R.id.btn);

    mButton.setBackgroundDrawable(image);

最后更新:2017-04-02 15:32:47

  上一篇:go 【转载——两个很基础的选举算法】分布式系统进程的选举
  下一篇:go ICADL2012- A Scalable, Adaptive, Self-management and Fault-tolerant Architecture for Digital Library