Errors in Layout Cant figure it out!!
Posted
by
Wahid
on Stack Overflow
See other posts from Stack Overflow
or by Wahid
Published on 2010-12-22T14:47:43Z
Indexed on
2010/12/22
14:53 UTC
Read the original article
Hit count: 223
Please Help.
I'm trying to create a menu that pops up if an android user clicks "menu" on his phone. and i want on the screen a button so when the user clicks it a sound starts playing for a second or two. && this error keeps popping up in my java class in the part where it says " public boolean onCreateTutorial(Menu menu) {"
heres my code.
package com.Tutorial;
import com.Tutorial.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
public class Tutorial extends Activity {
private SoundManager mSoundManager;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mSoundManager = new SoundManager();
mSoundManager.initSounds(getBaseContext());
mSoundManager.addSound(1, R.raw.sound);
Button SoundButton = (Button)findViewById(R.id.Button);
SoundButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
mSoundManager.playSound(1);
@Override
public boolean onCreateTutorial(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu, menu);
return true;
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.icon: Toast.makeText(this, "Rate this app on Android Market!", Toast.LENGTH_LONG).show();
break;
case R.id.text: Toast.makeText(this, "Name: Wahid", Toast.LENGTH_LONG).show();
break;
case R.id.icontext: Toast.makeText(this, "MeSoundFx Pro on the Android Market! (Coming Soon)", Toast.LENGTH_LONG).show();
break;
}
return true;
}
});
}
}
© Stack Overflow or respective owner