【发布时间】:2015-03-19 14:45:53
【问题描述】:
我正在关注这个answer 来完成我的任务。除了最后一部分,一切都很好,
if(result!=null)
{
Toast.makeText(getApplicationContext(), "Image saved in Gallery !", Toast.LENGTH_LONG).show();
if(isinint) //check if any app cares for the result
{
Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND, Uri.fromFile(new File(result.toString()))); //Create a new intent. First parameter means that you want to send the file. The second parameter is the URI pointing to a file on the sd card. (openprev has the datatype File)
((Activity) ImageListActivity.this).setResult(Activity.RESULT_OK, shareIntent); //set the file/intent as result
((Activity) ImageListActivity.this).finish(); //close your application and get back to the requesting application like GMail and WhatsApp
return; //do not execute code below, not important
}
}
最后没有崩溃,但壁纸也没有在 whatsapp 中设置。
谁能告诉我为什么它不起作用?
如有任何帮助,我们将不胜感激。
谢谢
【问题讨论】:
-
你在哪里设置isinint?您是否调试了代码并检查了它在什么时候停止工作?请编辑您的问题并提供更多信息。
-
@JamesCameron 是的,我已经调试过了,它执行了所有的行,没有错误然后我去whatsapp聊天,那里没有设置壁纸
-
找到答案了吗?我想 ACTION_SEND Intent 可能是错误的,因为它可能被另一个意图调用。请调试应用调用时得到的 Intent。
-
@JamesCameron 不,如果你解决了请在这里回答,谢谢