开发者

How pass an image resource from my app to another?

I have 2 apps running, and I need to pass an image resource from the first app to the second.

The Im开发者_开发知识库ageView have a setImageURI(Uri) method, that I could use in the second app, but does not have a getUri() for me to use in the first.

Any idea how to do this?

-- update

looks like Content Providers can solve the problem. (studying)


The only way is to pass the data to the second Activity when you start it. If you check out the Intent API you can pass the Uri using one of the putExtra() methods, and in the onCreate for the new Activity you can retrieve the Uri using getStringExtra().


You can pass a (Bitmap)Drawable this way:

// sending side
BitmapDrawable bd = (BitmapDrawable)imageView.getDrawable();
intent.putExtra("img", bd);

// receiving side
Bitmap b = (Bitmap) intent.getParcelable("img");
imageView.setImageBitmap(b);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜