Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 14th, 2012  |  syntax: None  |  size: 1.42 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Context mContext = getApplicationContext();
  2.                 dialog = new Dialog(mContext);
  3.  
  4.                 dialog.setContentView(R.layout.first_lunch);
  5.                 dialog.setTitle("Podatki ob prvem zagonu");
  6.                 Button save = (Button) dialog.findViewById(R.id.save);
  7.                 Button quit = (Button) dialog.findViewById(R.id.quit);
  8.                 save.setOnClickListener(new View.OnClickListener() {
  9.                 public void onClick(View v) {
  10.                     SharedPreferences shusername = getSharedPreferences("username", Activity.MODE_PRIVATE);
  11.                     SharedPreferences shpassword = getSharedPreferences("password", Activity.MODE_PRIVATE);
  12.                     SharedPreferences.Editor ue = shusername.edit();
  13.                     SharedPreferences.Editor pe = shpassword.edit();
  14.                     ue.putString("username", ((EditText) dialog.findViewById(R.id.entry_username)).getText().toString());
  15.                     pe.putString("password", ((EditText) dialog.findViewById(R.id.entry_password)).getText().toString());
  16.                     ue.commit();
  17.                     pe.commit();
  18.                     buildList(pref.getString("username",""), pref.getString("password",""));
  19.                 }
  20.             });
  21.                 quit.setOnClickListener(new View.OnClickListener() {
  22.                 public void onClick(View v) {
  23.                      mporaba.this.finish();
  24.                  }
  25.             });
  26.                 dialog.show();