I have a problem with Android, with a button. I programmed as on the developer pages to display text in a textview when clicked, but when I launch my application, I have to click my button twice for this to happen. I thought this might be something to do with focus, but I'm not sure.
In addition, when I apply a theme (see styles and themes), I even have to press any button twice, not just the button indicated above, but for example, the yes or no button in the question about leaving the application ( through the dialog box)
I searched for forums for this, but did not find the answer I was looking for. Hope someone can provide me an idea.
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
root = (LinearLayout) findViewById(R.id.root);
((Button) findViewById(R.id.btnZoeken)).setOnClickListener(
new Button.OnClickListener(){
@Override
public void onClick(View arg0) {
zoekOpPostcodes(txtZoeken.getText().toString());
}
private void zoekOpPostcodes(String zoekterm){
txtResultaat.setText(txtRes);
}
private void quit() {
AlertDialog.Builder abQuit = new AlertDialog.Builder(this);
abQuit.setMessage("Weet je zeker dat je wil afsluiten?");
abQuit.setPositiveButton("Ja", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
Toast.makeText(getApplicationContext(), "Tot ziens!", Toast.LENGTH_LONG).show();
iRegionForAndroid.this.finish();
}
});
abQuit.setNegativeButton("Nee", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
Toast.makeText(getApplicationContext(), "Afsluiten geannuleerd!", Toast.LENGTH_SHORT).show();
}
});
abQuit.show();
}
, ", ":)
, - "code", , "code"