public boolean onOptionsItemSelected(MenuItem item)
{
//check selected menu item
switch (item.getItemId()) {
case R.id.exit:
this.finish();
return true;
case R.id.basic:
Difficulty = DIFFICULTY_BASIC;
Toast.makeText(YogaPosesActivity.this, "Difficulty is Basic", Toast.LENGTH_SHORT).show();
SetImageView(myDbHelper);
return true;
case R.id.advanced:
Toast.makeText(YogaPosesActivity.this, "Difficulty is Advanced", Toast.LENGTH_SHORT).show();
Difficulty = DIFFICULTY_ADVANCED;
SetImageView(myDbHelper);
return true;
case R.id.allPoses:
Toast.makeText(YogaPosesActivity.this, "All Poses Will Be Displayed", Toast.LENGTH_SHORT).show();
Difficulty = DIFFICULTY_ADVANCED_AND_BASIC;
SetImageView(myDbHelper);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
OnCreate アクティビティから定義された SetImageView 関数を呼び出すと、エラーが発生します。OnCreate内で定義されていない限り、関数を呼び出すことはできませんか?
関数を呼び出すと、nullPointer 例外が発生します。