oh ja hab ich garnich gesehen sorry
[fieldset]import android.os.Bundle;
import android.app.Activity;
import android.app.AlertDialog;
import android.text.InputType;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.ToggleButton;
public class MainActivity extends Activity implements View.OnClickListener {
boolean mainisopen = true;
EditText editText;
ToggleButton toggleButton;
String string;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initStuff();
}
private void initStuff() {
// TODO Auto-generated method stub
editText = (EditText) findViewById(R.id.editText1);
toggleButton = (ToggleButton) findViewById(R.id.tbPassword);
toggleButton.setOnClickListener(this);
}
public void onClick(View v) {
switch (v.getId()){
case R.id.tbPassword:
if (toggleButton.isChecked()){
editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
} else{
editText.setInputType(InputType.TYPE_CLASS_TEXT);
}
break;
}
}
List<String> NotizenList = new ArrayList<String>();
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
public void onKlick(View view) {
setContentView(R.layout.notizen);
mainisopen = false;
ArrayAdapter<String> adapterNotizen = new ArrayAdapter<String>(MainActivity.this, android.R.layout.simple_list_item_1, NotizenList);
ListView lNotizen = (ListView) findViewById(R.id.listView1);
lNotizen.setAdapter(adapterNotizen);
}
public void ButtonKlick (View view){
new AlertDialog.Builder(this)
.setTitle("Gespeichert!")
.setNeutralButton("OK", null)
.show();
String eingabe="";
EditText Feld1=(EditText)findViewById(R.id.editText1);
EditText FeldErgebnis=(EditText)findViewById(R.id.etErgebnis);
eingabe = Feld1.getText().toString();
FeldErgebnis.setText(eingabe);
NotizenList.add(Feld1.getText().toString());
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_BACK && mainisopen == false){
mainisopen = true;
setContentView(R.layout.activity_main);
return true;
}
return super.onKeyDown(keyCode, event);
}
}
[/fieldset]