リストを作成しました。リスト項目をクリックすると、別の名前のリストであるJavaクラスを実行したいと思います。
これが私のコードです:
public class SecondAct extends ListActivity {
private String[] items = { "Pending Retailers", "Ordered Retailers",
"No Order Retailers", "Today's Plan", "Messages", "Daily Sales",
"Pending Invoices", "Day Close", "Tools and Updates", "Exit" };
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_multiple_choice, items);
// Get the activity's ListView and set its choice mode as multiple choice
getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
setListAdapter(adapter);
}
protected void onListItemClick(ListView l, View v, int position, long id) {
// TODO Auto-generated method stub
super.onListItemClick(l, v, position, id);
String selectionValue = "";
selectionValue = (String) getListView().getItemAtPosition(position);
Log.i("List Selection Value: ",
(String) getListView().getItemAtPosition(position));
if (selectionValue.equalsIgnoreCase("Pending Retailers")) {
Intent intent = new Intent("my.com.npi.List");
startActivity(intent);
AlertDialog alertDialog = new AlertDialog.Builder(SecondAct.this)
.create();
alertDialog.setTitle("Pending Retailers Selected");
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// here we i add functions
}
});
// alertDialog.setIcon(R.drawable.icon);
alertDialog.show();
}
else if (selectionValue.equalsIgnoreCase("Exit")) {
finish();
}
}
}
最初の項目をクリックすると、アプリケーションが強制的に閉じられます。インテントを使用して新しいアクティビティを開始しましたが、機能していません。どうしようもなく立ち往生!助けてください。
ありがとう。