安卓:问题一带而过的形象和它的两个活动之间的URI [英] Android:Problem in passing image and its URI between two activities

查看:116
本文介绍了安卓:问题一带而过的形象和它的两个活动之间的URI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以通过图像和使用捆绑的图像URI到其他活动中同一个应用程序?建议我一些方法来做到这一点?

Can we pass image and an image URI to other activity in same application using bundle?suggest me some way to do that?

用法:其实我已经做了裁剪从相机或从存储在SD卡上的图像拍摄的图像取决于用户的活动。 而另一个应用程序,使用一个背景图像和边缘图像都是叠加,从而看到的数码相框

USAGE :actually i have made an activity that crop an image taken from camera or from image stored in SD card depends upon the user. and another app that uses a background image and a border image both are overlay so as to see PHOTOFRAME.

所以,现在我想这两个应用程序结合起来,使来自第一个应用程序裁剪的图像应该成为背景图像第二app.ie进来photoframe.How我能做到这一点?

So now I want to combine both app so that the cropped image come from first app should become the background image for the second app.ie comes in photoframe.How can i do that?

推荐答案

一旦你保存你的图像中的SD卡

Once you save your image in SD card

使用此CAL的其他活动。

use this to cal the other activity.

final Intent intent = new Intent(MyClass.this, TargetClass.class);
final String root = Environment.getExternalStorageDirectory().getAbsolutePath();
intent.setData(Uri.parse(root + "/my/image/path/image.png"));
startActivity(intent);

如果你是reciever,那么你可以通过调用获取路径

if you are the reciever then you can get the path by calling

Uri path = getIntent().getData();

的onCreate 的recieving活动。这是检查由其他活动路径的标准的方式。

in the onCreate of the recieving activity. this is the standard way of checking for path by other activities.

这篇关于安卓:问题一带而过的形象和它的两个活动之间的URI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆