-1
私のプロジェクト全体を通して、ボタンやクリック可能な画像ボタンを追加しました。しかし、なぜ私は.id.exampleの前に 'R'を使用しているのか分かりません。私はオンラインで質問しましたが、何も私に明確な答えを与えることはできません。誰でも説明できますか?「R」の目的は何ですか?
private Button DisplayRoutineButton;
private Button ClearRoutineButton;
private static int ImageID = 0;
ImageView activityslotlocationa, activityslotlocationb, activityslotlocationc, activityslotlocationd, activityslotlocatione, activityslotlocationf;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.routineeditscreen);
myDb = new Database(this);
DisplayRoutineButton = (Button) findViewById(R.id.displayroutinebutton);
ClearRoutineButton = (Button) findViewById(R.id.clearroutinebutton);
// Display Routine Button
DisplayRoutineButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.d("BUTTON CLICKED", "Display Schedule");
Intent i = new Intent(MondayRoutineEdit.this, MondayRoutineDisplay.class);
Log.d("SUCCESSFUL", "Loading Monday Routine Display");
startActivity(i);
}
});
// Delete Routine Button
ClearRoutineButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.d("BUTTON CLICKED", "Delete Routine");
deleteRoutine();
Log.d("SUCCESSFUL", "Routine Deleted");
}
});
// Audio Feedback
ImageView artactivity = (ImageView) this.findViewById(R.id.artactivityimage);
final MediaPlayer artsoundeffect = MediaPlayer.create(this, R.raw.art);
artactivity.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
artsoundeffect.start();
}
});
ImageView bedtimestoryactivity = (ImageView) this.findViewById(R.id.bedtimestoryactivityimage);
final MediaPlayer bedtimestorysoundeffect = MediaPlayer.create(this, R.raw.bedtimestory);
bedtimestoryactivity.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
bedtimestorysoundeffect.start();
}
});
"R"は "リソース"を表します。あなたはそれをgoogledする必要があります。 –