0

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
asked May 30, 2011 at 11:28

2 Answers 2

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
Sign up to request clarification or add additional context in comments.

1 Comment

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..
1

check that the id is created in R.java file,under gen folder

answered May 30, 2011 at 11:31

1 Comment

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..

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.