Advertisement
kusha45

Function

Sep 15th, 2011
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.23 KB | None | 0 0
  1.  public void SearchDialog(){
  2.        final Dialog dialog = new Dialog(Home.this);
  3.        dialog.setContentView(R.layout.dialogsearch);
  4.        dialog.setTitle("       Enter The Text to Search");
  5.        dialog.setCancelable(true);
  6.  
  7.        final EditText Text = (EditText) dialog.findViewById(R.id.EdText);
  8.        
  9.        Button buttonOK = (Button) dialog.findViewById(R.id.btnOK);
  10.        buttonOK.setOnClickListener(new OnClickListener() {
  11.  
  12.            public void onClick(View v) {
  13.                String SearchText = Text.getText().toString();
  14.                
  15.                prefsPrivate =getSharedPreferences(Login.PREFS_PRIVATE,Context.MODE_PRIVATE);
  16.                Editor prefsPrivateEdit=prefsPrivate.edit();            
  17.                prefsPrivateEdit.putString("Text",SearchText);
  18.                prefsPrivateEdit.commit();
  19.                Intent i = new Intent(Home.this,SearchTask.class);
  20.                startActivity(i);
  21.                dialog.cancel();
  22.            }
  23.        });
  24.  
  25.        Button buttonCancel = (Button) dialog.findViewById(R.id.btnCancel);
  26.        buttonCancel.setOnClickListener(new OnClickListener() {
  27.      
  28.            public void onClick(View v) {
  29.             dialog.cancel();
  30.            
  31.            }
  32.        });
  33.        dialog.show();
  34.    }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement