Well, I'm learning android, I do not know much. In this application, so far I just want to display the value of "name" in the .setMessage of AlertDialog, and I'm not sure how I do it, grateful now!
NOTE: When I run the app on my device, "Your name is: android.support.v7.widget.AppCompatEditText {...}"
package usuario.app.myapplication;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.*;
import android.app.*;
import android.view.*;
public class ComprasActivity extends AppCompatActivity {
EditText nome, idade,cidade;
Button enviar;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_compras);
nome = (EditText) findViewById(R.id.nome);
idade = (EditText) findViewById(R.id.idade);
cidade = (EditText) findViewById(R.id.cidade);
enviar = (Button)findViewById(R.id.enviar);
enviar.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View arg0)
{
AlertDialog.Builder dialogo = new AlertDialog.Builder(ComprasActivity.this);
dialogo.setTitle("Seu perfil");
dialogo.setMessage("Seu nome é:" + nome);
dialogo.setNeutralButton("OK",null);
dialogo.show();
}
});
}
}