I tried to make an app about user inputs the last name, first name and address. What i was trying to do was to let the user input in an EditText
and display it on a TextView
but i cannnot display the following text because there is an error on runtime. What it does is if i click the submit button it will display the user input but what it says on the TextView
is "android.support.v7.widget.TextView....etc".
I just started Android programming now and everything is confusing. Please tell me the most basic stuff to solve this problem.
public class MainActivity extends AppCompatActivity {
EditText fname, lname;
TextView display;
Button result;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
fname = (EditText) findViewById(R.id.etFirstname);
lname = (EditText) findViewById(R.id.etLastname);
display = (TextView) findViewById(R.id.tvResult);
result = (Button) findViewById(R.id.btnSubmit);
result.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
display.setText("Name: " + lname + ", " + fname);
}
});
}
}