如何获取category的属性?

clipboard.png
这是需要实现的效果,在第二个Activity读取category的属性,但是我得到的结果是category为null,请问如何能正确得到category的属性?
AndroidManifest.xml:
<activity android:name=".Second">

        <intent-filter>
            <action android:name="com.PiscesYE.ACTION"/>
            
            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>
    </activity>

secondActivity.java:

    show1=findViewById(R.id.show1);
    show2=findViewById(R.id.show2);
    String activityShow=getIntent().getAction();
    show1.setText("Action为:"+activityShow);
    show2.setText("Category的属性为:"+getIntent().getCategories());

结果为:

clipboard.png

阅读 3.4k
1 个回答
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题