行2または4をクリックすると、残りのリスト項目とは異なるメソッドが実行されるようにしようとしています。残りはWebサイトに移動しますが、4行目で電子メールを開き、2行目でナビゲーターを開きます。しかし、4行目をクリックすると、ブラウザが開き(つまり、インテントを通過し)、バックアウトした後にメールが開きます。なぜ?--また、ナビゲーターフォースは閉じますが、エミュレーターにナビゲーターがインストールされていないことが原因だと思います:/何か提案はありますか?ありがとう!
getListView()。setOnItemClickListener(new OnItemClickListener(){final String []links = getResources()。getStringArray(com.BandCustomListView.R.array.ItemLinks); @Override public void onItemClick(AdapterView parent、View view、int position、long id){
String positions = links[position];
if (position == 4){
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("plain/text");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"Mtarpey@worcester.edu"});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject");
;
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
}
if (position == 2){
Intent i = new Intent(Intent.ACTION_VIEW,
Uri.parse("google.navigation:q=127+Southbridge+Street+Auburn+Massachusetts"));
startActivity(i);
}
if (position != (2 | 4)) {
Intent SendToWebPageView = new Intent(getApplicationContext(), WebPageView.class);
SendToWebPageView.setData(Uri.parse(positions));
startActivity(SendToWebPageView);
}
}
});