5

Is it possible to know which package or process sent the Intent result?

Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);

I found a way to know which apps are capable of handling this intent, but I also want to know which one was selected, or rather, which one returned the result. Is this possible?

4

2 回答 2

1

这取决于应用程序的开发方式。一些应用程序返回一个充满东西的 Intent 对象,其他的为空或 null。

        @Override
        protected void onActivityResult(int requestCode, int resultCode, Intent i) {
         if (i!=null){        
            i.getPackage();
            i.getExtras();
            i.getData();
            i.getScheme();
            i.getType();
           }
        }

尝试记录/读取Intent中的所有可能值。

于 2013-02-05T18:14:10.790 回答
0

您也可以尝试查看。Logcat它包含有关意图何时开始以及如何开始的信息。我尝试使用它来了解意图是否开始。

于 2013-02-05T18:20:42.977 回答