
Untitled
By: a guest on
May 14th, 2012 | syntax:
None | size: 1.42 KB | hits: 15 | expires: Never
Context mContext = getApplicationContext();
dialog = new Dialog(mContext);
dialog.setContentView(R.layout.first_lunch);
dialog.setTitle("Podatki ob prvem zagonu");
Button save = (Button) dialog.findViewById(R.id.save);
Button quit = (Button) dialog.findViewById(R.id.quit);
save.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
SharedPreferences shusername = getSharedPreferences("username", Activity.MODE_PRIVATE);
SharedPreferences shpassword = getSharedPreferences("password", Activity.MODE_PRIVATE);
SharedPreferences.Editor ue = shusername.edit();
SharedPreferences.Editor pe = shpassword.edit();
ue.putString("username", ((EditText) dialog.findViewById(R.id.entry_username)).getText().toString());
pe.putString("password", ((EditText) dialog.findViewById(R.id.entry_password)).getText().toString());
ue.commit();
pe.commit();
buildList(pref.getString("username",""), pref.getString("password",""));
}
});
quit.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
mporaba.this.finish();
}
});
dialog.show();