[java][android]隐式意图和createchooser组合

wwtsj6pe  于 2021-06-30  发布在  Java
关注(0)|答案(0)|浏览(210)

我想我的问题很容易就解决了。我有两个可能的意图,都使用他们的默认类别,让选择器看到,但如果我想把额外的选择器甚至不会开始!
两者在manifest.xml中都有

1  <activity
  2   android:name=".OneActivity"
  3   android:label="OA">
  4              <intent-filter>
  5                  <action android:name="specialpackage.package.LOCALIZE"/>
  6                  <category android:name="android.intent.category.DEFAULT"/>
  7              </intent-filter>
  8  </activity>

在活动中:

1     Intent intent = Intent.createChooser(new Intent("specialpackage.package.LOCALIZE"), "App auswählen:");
      2     intent.putExtra("someNotes", currentNote); //Is defined and not important
      3     intent.putParcelableArrayListExtra("notes", notes);
      4      startActivity(intent);
                          (ArrayList<DBH.Note> notes = helper.getNotes(currentProject);)

如果我评论出2和3它的作品,让我选择我的应用程序。如果我不在simpel intent上使用chooser和putextra以及parcelablearraylistra,那么它可以工作。
我只允许更改清单和这个类。也许会有什么结果?已经试过了但没用。
编辑1:

1      Intent testintent = new Intent("specialpackage.package.LOCALIZE");
 2      testintent.putExtra("current note", currentNote);
 3      testintent.putParcelableArrayListExtra("notes", notes);
 4      Intent intent = Intent.createChooser(testintent, "App auswählen:");  
 5      startActivity(intent);

也不起作用:d正如我所说,没有putextra它可以工作,但是如果我在调试器中使用putextra,它会将额外的放在intent上,但在startactivity上,它会说android正在反复关闭(sry bad english im german xd)

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题