In the following program , when i try to run its getting error
textOut = (TextView) findViewById(R.id.tvGetInput);
in this line. Its showing error in tvGetInput. How can i fix it ?
package was.thebasics;
import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class mymenu extends Activity {
TextView textOut;
EditText GetInput;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
textOut = (TextView) findViewById(R.id.tvGetInput);
GetInput = (EditText) findViewById(R.id.etInput);
Button ok = (Button) findViewById(R.id.bOK);
ok.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
textOut.setText(GetInput.getText());
}
});
// set up the button sound
final MediaPlayer mpButtonClick = MediaPlayer.create(this, R.raw.button);
Button bTutorial1 = (Button) findViewById(R.id.tutorial1);
bTutorial1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
startActivity(new Intent("was.thebasics.tutorialOne"));
mpButtonClick.start();
}
});
}
}
Heiko Rupp
31.2k13 gold badges86 silver badges120 bronze badges
2 Answers 2
Please check in main.xml file Textview id is given like that that.
android:id="@+id/tvGetInput"
answered May 30, 2011 at 11:31
Nikhil
16.2k20 gold badges66 silver badges81 bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
Waseem
thank you brother.. i fixed.. if possible plz give some suggestion to understand easily the android basic concepts.. I know the different blocks used .. but i dont know why they are used..
check that the id is created in R.java file,under gen folder
answered May 30, 2011 at 11:31
Kakey
4,0445 gold badges33 silver badges46 bronze badges
1 Comment
Waseem
thank you brother.. i fixed.. if possible plz give some suggestion to understand easily the android basic concepts.. I know the different blocks used .. but i dont know why they are used..
default