I´m new to android development and I´m trying to write a small, simple Application. This application should do nothing more than reading the text from 2 EditTexts and when
That's the problem
sendButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String headline = ((EditText) v.findViewById(R.id.enterHeadlineText)).getText().toString();
((TextView) v.findViewById(R.layout.headline_view)).setText(headline);
}
});
the View v is the view clicked, so of coure v.findViewById() doesn't work..
to achieve your target you can declare youre EditText and TextView global, in onCreate() use the inflater to instantiate them and onClick method you can use them!