import java.util.Date;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class FluteActivity extends Activity {
Button btn;
TextView tv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
btn=(Button)findViewById(R.id.button1);
tv=(Button)findViewById(R.id.textView1);
btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
tv.setText(new Date().toString());
}
});
}
}
i am not able to find error and can some one tell me where to look for when run time error occurs as i have no idea about debugging.
Just replace this line:
tv=(Button)findViewById(R.id.textView1);,by this line:
tv=(Textview)findViewById(R.id.textView1);