Java Code Examples for android.widget.EditText

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project 2Degrees-Toolbox, under directory /Toolbox/src/biz/shadowservices/DegreesToolbox/Preferences/.

Source file: BalancePreferencesActivity.java

  32 
vote

public boolean onPreferenceClick(Preference preference){
  if (preference.getKey().equals("password")) {
    EditTextPreference pref=(EditTextPreference)preference;
    EditText field=pref.getEditText();
    field.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
    field.setTransformationMethod(new PasswordTransformationMethod());
  }
  return false;
}
 

Example 2

From project Android, under directory /integration-tests/src/main/java/com/github/mobile/tests/commit/.

Source file: CreateCommentActivityTest.java

  32 
vote

/** 
 * Verify empty comment can't be created
 * @throws Throwable
 */
public void testEmptyCommentIsProhitibed() throws Throwable {
  View createMenu=view(id.m_apply);
  assertFalse(createMenu.isEnabled());
  final EditText comment=editText(id.et_comment);
  focus(comment);
  send("a");
  assertTrue(createMenu.isEnabled());
  sendKeys(KEYCODE_DEL);
  assertFalse(createMenu.isEnabled());
}
 

Example 3

From project Android-automation, under directory /Tmts_Java/src/com/taobao/tmts/framework/.

Source file: Tmts.java

  32 
vote

/** 
 * Return a  {@link TmtsEditText} by the given name.
 * @param name String name of view id, the string after @+id/ defined in layout files.
 * @return {@link TmtsEditText} with the given name.
 * @throws Exception Exception
 */
TmtsEditText getTmtsEditText(String name) throws Exception {
  Log.i(LOG_TAG,"getTmtsEditText: " + name);
  EditText editText=getView(name,EditText.class);
  printLog(editText,name,"getTmtsEditText");
  TmtsEditText tmtsEditText=new TmtsEditText(inst,editText);
  return tmtsEditText;
}
 

Example 4

From project android-client_1, under directory /src/com/googlecode/asmack/view/.

Source file: AuthenticatorActivity.java

  32 
vote

/** 
 * Create an AuthenticatorActivity based on a bundle.
 */
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  accountManager=AccountManager.get(this);
  final Intent intent=getIntent();
  String username=intent.getStringExtra(PARAM_USERNAME);
  requestWindowFeature(Window.FEATURE_LEFT_ICON);
  setContentView(R.layout.login);
  getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,android.R.drawable.ic_dialog_alert);
  EditText usernameEdit=(EditText)findViewById(R.id.e_mail_textbox);
  usernameEdit.setText(username);
}
 

Example 5

From project android-context, under directory /src/edu/fsu/cs/contextprovider/dialog/.

Source file: AddressDialog.java

  32 
vote

@Override public void onClick(View v){
  EditText nicknameEdit=(EditText)findViewById(R.id.nicknameEdit);
  EditText addressEdit=(EditText)findViewById(R.id.addressEdit);
  String nickname=nicknameEdit.getText().toString();
  String address=addressEdit.getText().toString();
  if (nickname == null || nickname.equals("")) {
    nickname=address;
  }
  SharedPreferences.Editor editor=pref.edit();
  editor.putString(nickname,address);
  editor.commit();
  dismiss();
}
 

Example 6

From project Android-File-Manager-Tablet, under directory /src/com/nexes/manager/tablet/.

Source file: EventHandler.java

  32 
vote

public void renameFile(final String path,boolean isFolder){
  LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View view=inflater.inflate(R.layout.input_dialog_layout,null);
  String name=path.substring(path.lastIndexOf("/") + 1,path.length());
  final EditText text=(EditText)view.findViewById(R.id.dialog_input);
  TextView msg=(TextView)view.findViewById(R.id.dialog_message);
  msg.setText("Please type the new name you want to call this file.");
  if (!isFolder) {
    TextView type=(TextView)view.findViewById(R.id.dialog_ext);
    type.setVisibility(View.VISIBLE);
    type.setText(path.substring(path.lastIndexOf("."),path.length()));
  }
  new AlertDialog.Builder(mContext).setPositiveButton("Rename",new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      String name=text.getText().toString();
      if (name.length() > 0) {
        mFileMang.renameTarget(path,name);
        mThreadListener.onWorkerThreadComplete(RENAME_TYPE,null);
      }
 else {
        dialog.dismiss();
      }
    }
  }
).setNegativeButton("Cancel",new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      dialog.dismiss();
    }
  }
).setView(view).setTitle("Rename " + name).setCancelable(false).setIcon(R.drawable.download_md).create().show();
}
 

Example 7

From project android-joedayz, under directory /Proyectos/client/src/org/springframework/android/showcase/rest/.

Source file: HttpGetSetRequestTimeoutActivity.java

  32 
vote

@Override protected void onPreExecute(){
  showLoadingProgressDialog();
  EditText editText=(EditText)findViewById(R.id.edit_text_server_delay);
  serverDelay=editText.getText().toString();
  editText=(EditText)findViewById(R.id.edit_text_request_timeout);
  try {
    requestTimeout=Integer.parseInt(editText.getText().toString()) * 1000;
  }
 catch (  NumberFormatException e) {
    requestTimeout=10000;
  }
}
 

Example 8

From project AndroidLab, under directory /samples/AndroidLdapClient/src/com/unboundid/android/ldap/client/.

Source file: SearchServer.java

  32 
vote

/** 
 * Saves the state of this activity to the provided bundle.
 * @param state  The bundle containing the state information.
 */
private void saveState(final Bundle state){
  logEnter(LOG_TAG,"saveState",state);
  state.putSerializable(BUNDLE_FIELD_INSTANCE,instance);
  final Spinner typeSpinner=(Spinner)findViewById(R.id.layout_search_server_spinner_search_type);
  searchTypePosition=typeSpinner.getSelectedItemPosition();
  state.putInt(BUNDLE_FIELD_TYPE,searchTypePosition);
  final EditText textField=(EditText)findViewById(R.id.layout_search_server_field_search_text);
  searchText=textField.getText().toString();
  state.putString(BUNDLE_FIELD_TEXT,searchText);
}
 

Example 9

From project androidZenWriter, under directory /src/com/javaposse/android/zenwriter/.

Source file: AndroidZenWriterActivity.java

  32 
vote

public void shareStuff(){
  Intent sharingIntent=new Intent(android.content.Intent.ACTION_SEND);
  sharingIntent.setType("text/plain");
  EditText editText=(EditText)findViewById(R.id.editText1);
  String content=editText.getText().toString();
  sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,currentNote.getName());
  sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT,content);
  startActivity(Intent.createChooser(sharingIntent,"Share via"));
}
 

Example 10

From project android_7, under directory /src/org/immopoly/android/app/.

Source file: UserLoginActivity.java

  32 
vote

public void recoverPassword(View v){
  EditText username=(EditText)findViewById(R.id.user_name);
  EditText userEmail=(EditText)findViewById(R.id.user_email);
  if (username.length() == 0 || userEmail.length() == 0) {
    Toast.makeText(this,"Bitte gib Name und Email-Adresse ein.",Toast.LENGTH_LONG).show();
    return;
  }
  new RecoverPasswordTask().execute(username.getText().toString(),userEmail.getText().toString());
}
 

Example 11

From project android_aosp_packages_apps_Settings, under directory /src/com/android/settings/bluetooth/.

Source file: BluetoothNamePreference.java

  32 
vote

public void pause(){
  EditText et=getEditText();
  if (et != null) {
    et.removeTextChangedListener(this);
  }
  getContext().unregisterReceiver(mReceiver);
}
 

Example 12

From project android_packages_apps_phone, under directory /src/com/android/phone/.

Source file: EditPhoneNumberPreference.java

  32 
vote

public void onPickActivityResult(String pickedValue){
  EditText editText=getEditText();
  if (editText != null) {
    editText.setText(pickedValue);
  }
}
 

Example 13

From project 4308Cirrus, under directory /tendril-cirrus/src/main/java/edu/colorado/cs/cirrus/cirrus/.

Source file: CirrusPreferenceActivity.java

  31 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.preferences);
  myPreferenceClickListener=new simplePreferenceClickListener();
  setHomeLocPref=(Preference)findPreference("setHomeLocPref");
  gpsFreqPref=(Preference)findPreference("gpsFrequency");
  smartHeatPref=(Preference)findPreference("smartHeat");
  homeTempPref=(EditTextPreference)findPreference("homeTemp");
  awayTempPref=(EditTextPreference)findPreference("awayTemp");
  radiusPref=(EditTextPreference)findPreference("gpsRadius");
  logoutPref=(Preference)findPreference("logout");
  setHomeLocPref.setOnPreferenceClickListener(myPreferenceClickListener);
  gpsFreqPref.setOnPreferenceClickListener(myPreferenceClickListener);
  smartHeatPref.setOnPreferenceClickListener(myPreferenceClickListener);
  homeTempPref.setOnPreferenceClickListener(myPreferenceClickListener);
  awayTempPref.setOnPreferenceClickListener(myPreferenceClickListener);
  logoutPref.setOnPreferenceClickListener(myPreferenceClickListener);
  radiusPref.setOnPreferenceClickListener(myPreferenceClickListener);
  EditText homeTempEditText=(EditText)homeTempPref.getEditText();
  homeTempEditText.setKeyListener(DigitsKeyListener.getInstance(false,true));
  EditText awayTempEditText=(EditText)awayTempPref.getEditText();
  awayTempEditText.setKeyListener(DigitsKeyListener.getInstance(false,true));
  EditText radiusEditText=(EditText)radiusPref.getEditText();
  radiusEditText.setKeyListener(DigitsKeyListener.getInstance(false,true));
  cirrusPrefs=new PreferenceUtils(this);
  startLocationStuff();
}
 

Example 14

From project ActionBarCompat, under directory /ActionBarCompatSample/src/sk/m217/actionbarcompatsample/.

Source file: ActionBarCompatSampleActivity.java

  31 
vote

@Override public boolean onCreateOptionsMenu(Menu menu){
  MenuInflater menuInflater=getMenuInflater();
  menuInflater.inflate(R.menu.options,menu);
  if (mMenu != null) {
    return super.onCreateOptionsMenu(menu);
  }
  mMenu=menu;
  MenuItem item=mMenu.findItem(R.id.menu_search);
  if (item != null) {
    MenuItemCompat.setOnActionExpandListener(item,new MenuItemCompat.OnActionExpandListenerCompat(){
      @Override public boolean onMenuItemActionExpand(      MenuItem item){
        Toast.makeText(ActionBarCompatSampleActivity.this,"onMenuItemActionExpand()",Toast.LENGTH_SHORT).show();
        return true;
      }
      @Override public boolean onMenuItemActionCollapse(      MenuItem item){
        Toast.makeText(ActionBarCompatSampleActivity.this,"onMenuItemActionCollapse()",Toast.LENGTH_SHORT).show();
        return true;
      }
    }
);
  }
  EditText editText=(EditText)MenuItemCompat.getActionView(item);
  if (editText != null) {
    editText.setText(R.string.menu_search);
  }
  item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener(){
    @Override public boolean onMenuItemClick(    MenuItem item){
      Toast.makeText(ActionBarCompatSampleActivity.this,"onMenuItemClick()",Toast.LENGTH_LONG).show();
      return false;
    }
  }
);
  item.setIcon(R.drawable.ic_action_search).setTitle(R.string.menu_search).setIntent(null).setVisible(true).setEnabled(true);
  return super.onCreateOptionsMenu(menu);
}
 

Example 15

From project Alerte-voirie-android, under directory /src/com/fabernovel/alertevoirie/.

Source file: AddCommentActivity.java

  31 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_LEFT_ICON);
  setContentView(R.layout.layout_add_comment);
  getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,R.drawable.icon_nouveau_rapport);
  final EditText commentField=(EditText)findViewById(R.id.EditText_comment);
  commentField.setText(getIntent().getStringExtra(IntentData.EXTRA_COMMENT));
  ((TextView)findViewById(R.id.TextView_remaining_chars)).setText((140 - commentField.getText().length()) + " car. restant");
  commentField.addTextChangedListener(new TextWatcher(){
    public void afterTextChanged(    Editable s){
      ((TextView)findViewById(R.id.TextView_remaining_chars)).setText((140 - commentField.getText().length()) + " car. restant");
    }
    public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
    }
  }
);
  findViewById(R.id.Button_validate).setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      if (commentField.getText().toString().trim().length() > 0) {
        Intent result=new Intent();
        result.putExtra(IntentData.EXTRA_COMMENT,commentField.getText().toString());
        setResult(RESULT_OK,result);
        finish();
      }
 else {
        Toast.makeText(getApplicationContext(),"Veuillez entrer un commentaire",Toast.LENGTH_SHORT).show();
      }
    }
  }
);
}
 

Example 16

From project alljoyn_java, under directory /samples/android/chat/src/org/alljoyn/bus/sample/chat/.

Source file: DialogBuilder.java

  31 
vote

public Dialog createHostNameDialog(Activity activity,final ChatApplication application){
  Log.i(TAG,"createHostNameDialog()");
  final Dialog dialog=new Dialog(activity);
  dialog.requestWindowFeature(dialog.getWindow().FEATURE_NO_TITLE);
  dialog.setContentView(R.layout.hostnamedialog);
  final EditText channel=(EditText)dialog.findViewById(R.id.hostNameChannel);
  channel.setOnEditorActionListener(new TextView.OnEditorActionListener(){
    public boolean onEditorAction(    TextView view,    int actionId,    KeyEvent event){
      if (actionId == EditorInfo.IME_NULL && event.getAction() == KeyEvent.ACTION_UP) {
        String name=view.getText().toString();
        application.hostSetChannelName(name);
        application.hostInitChannel();
        dialog.cancel();
      }
      return true;
    }
  }
);
  Button okay=(Button)dialog.findViewById(R.id.hostNameOk);
  okay.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View view){
      String name=channel.getText().toString();
      application.hostSetChannelName(name);
      application.hostInitChannel();
      dialog.cancel();
    }
  }
);
  Button cancel=(Button)dialog.findViewById(R.id.hostNameCancel);
  cancel.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View view){
      dialog.cancel();
    }
  }
);
  return dialog;
}
 

Example 17

From project and-bible, under directory /AndBible/src/net/bible/android/view/activity/bookmark/.

Source file: BookmarkLabels.java

  31 
vote

/** 
 * Finished selecting labels
 * @param v
 */
public void onNewLabel(View v){
  Log.i(TAG,"New label clicked");
  final EditText labelInput=new EditText(this);
  AlertDialog.Builder alert=new AlertDialog.Builder(this).setTitle(R.string.new_label).setMessage(R.string.new_label_prompt).setView(labelInput);
  alert.setPositiveButton(R.string.okay,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int whichButton){
      String name=labelInput.getText().toString();
      LabelDto label=new LabelDto();
      label.setName(name);
      bookmarkControl.addLabel(label);
      List<LabelDto> selectedLabels=getCheckedLabels();
      Log.d(TAG,"Num labels checked pre reload:" + selectedLabels.size());
      loadLabelList();
      setCheckedLabels(selectedLabels);
      Log.d(TAG,"Num labels checked finally:" + selectedLabels.size());
    }
  }
);
  alert.setNegativeButton(R.string.cancel,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int whichButton){
    }
  }
);
  alert.show();
}
 

Example 18

From project android-client, under directory /xwiki-android-components/src/org/xwiki/android/components/commenteditor/.

Source file: CommentEditorActivity.java

  31 
vote

private void addComment(){
  final AlertDialog.Builder alert=new AlertDialog.Builder(this);
  final EditText input=new EditText(this);
  alert.setView(input);
  alert.setTitle("Enter new comment");
  alert.setPositiveButton("Ok",new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int whichButton){
      dialog.dismiss();
      String value=input.getText().toString().trim();
      Comment comment=new Comment();
      comment.setText(value);
      Requests requests=new Requests(url);
      if (isSecured) {
        requests.setAuthentication(username,password);
      }
      String s=requests.addPageComment(wikiName,spaceName,pageName,comment);
      Log.d("Comment Status",s);
      setupListView();
    }
  }
);
  alert.setNegativeButton("Cancel",new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int whichButton){
      dialog.cancel();
    }
  }
);
  alert.show();
}
 

Example 19

From project android-client_2, under directory /src/org/mifos/androidclient/util/ui/.

Source file: UIUtils.java

  31 
vote

/** 
 * Displays a simple dialog which prompts user for text input. The user can either commit the input or cancel the dialog.
 * @param labelText the label to be used for the dialog
 * @param callbacks the callbacks to be invoked when user interacts with the input
 * @return input provided by the user, or null value if the dialog was canceled
 */
public void promptForTextInput(String labelText,String defaultValue,final DialogCallbacks callbacks){
  final AlertDialog.Builder builder=new AlertDialog.Builder(mContext);
  final View dialogView=mLayoutInflater.inflate(R.layout.text_input_dialog,null);
  final TextView dialogLabel=(TextView)dialogView.findViewById(R.id.dialogLabel);
  dialogLabel.setText(labelText);
  final EditText textInput=(EditText)dialogView.findViewById(R.id.dialogInput);
  textInput.setText(defaultValue);
  builder.setView(dialogView).setPositiveButton(mContext.getText(R.string.dialog_ok),new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialogInterface,    int i){
      callbacks.onCommit(textInput.getText().toString().trim());
    }
  }
).setNegativeButton(mContext.getText(R.string.dialog_cancel),new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialogInterface,    int i){
      callbacks.onCancel();
      dialogInterface.cancel();
    }
  }
).setOnCancelListener(new DialogInterface.OnCancelListener(){
    @Override public void onCancel(    DialogInterface dialogInterface){
      callbacks.onCancel();
    }
  }
).show();
}
 

Example 20

From project Android-FFXIEQ, under directory /ffxieq/src/com/github/kanata3249/ffxieq/android/.

Source file: AugmentEditActivity.java

  31 
vote

long saveAugment(){
  EditText et;
  long result;
  result=-1;
  et=(EditText)findViewById(R.id.AugmentDescription);
  if (et != null) {
    String augment;
    augment=et.getText().toString();
    if (augment.length() == 0) {
      return mAugID;
    }
    result=((FFXIDatabase)getDAO()).saveAugment(mAugID,augment,mBaseID);
    if (result >= 0)     mAugID=result;
  }
  return result;
}
 

Example 21

From project android-rackspacecloud, under directory /src/com/rackspacecloud/android/.

Source file: CloudActivity.java

  31 
vote

private void createCustomDialog(int id){
  final Dialog dialog=new Dialog(CloudActivity.this);
switch (id) {
case PASSWORD_PROMPT:
    dialog.setContentView(R.layout.passworddialog);
  dialog.setTitle("Enter your password:");
dialog.setCancelable(false);
Button button=(Button)dialog.findViewById(R.id.submit_password);
button.setOnClickListener(new OnClickListener(){
public void onClick(View v){
EditText passwordText=((EditText)dialog.findViewById(R.id.submit_password_text));
if (!rightPassword(passwordText.getText().toString())) {
  passwordText.setText("");
  showToast("Password was incorrect.");
  loggedIn=false;
}
 else {
  dialog.dismiss();
  loggedIn=true;
}
}
}
);
dialog.show();
}
}
 

Example 22

From project Android-Terminal-Emulator, under directory /examples/intents/src/jackpal/androidterm/sample/intents/.

Source file: IntentSampleActivity.java

  31 
vote

/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  addClickListener(R.id.openNewWindow,new OnClickListener(){
    public void onClick(    View v){
      Intent intent=new Intent("jackpal.androidterm.OPEN_NEW_WINDOW");
      intent.addCategory(Intent.CATEGORY_DEFAULT);
      startActivity(intent);
    }
  }
);
  final EditText script=(EditText)findViewById(R.id.script);
  script.setText(getString(R.string.default_script));
  addClickListener(R.id.runScript,new OnClickListener(){
    public void onClick(    View v){
      Intent intent=new Intent("jackpal.androidterm.RUN_SCRIPT");
      intent.addCategory(Intent.CATEGORY_DEFAULT);
      String command=script.getText().toString();
      intent.putExtra("jackpal.androidterm.iInitialCommand",command);
      startActivity(intent);
    }
  }
);
  addClickListener(R.id.runScriptSaveWindow,new OnClickListener(){
    public void onClick(    View v){
      Intent intent=new Intent("jackpal.androidterm.RUN_SCRIPT");
      intent.addCategory(Intent.CATEGORY_DEFAULT);
      String command=script.getText().toString();
      intent.putExtra("jackpal.androidterm.iInitialCommand",command);
      if (mHandle != null) {
        intent.putExtra("jackpal.androidterm.window_handle",mHandle);
      }
      startActivityForResult(intent,REQUEST_WINDOW_HANDLE);
    }
  }
);
}
 

Example 23

From project android-xbmcremote, under directory /src/org/xbmc/android/remote/presentation/controller/.

Source file: RemoteController.java

  31 
vote

public Dialog onCreateDialog(int id,final Context context){
  Dialog dialog;
switch (id) {
case DIALOG_SENDTEXT:
    dialog=new Dialog(context);
  dialog.setContentView(R.layout.sendtext);
dialog.setTitle("Text Entry");
Button sendbutton=(Button)dialog.findViewById(R.id.sendtext_button_send);
sendbutton.setOnClickListener(new OnClickListener(){
public void onClick(View v){
EditText text=(EditText)v.getRootView().findViewById(R.id.sendtext_text);
mControl.sendText(new DataResponse<Boolean>(),text.getText().toString(),context);
text.setText("");
}
}
);
Button donebutton=(Button)dialog.findViewById(R.id.sendtext_button_done);
donebutton.setOnClickListener(new OnClickListener(){
public void onClick(View v){
EditText text=(EditText)v.getRootView().findViewById(R.id.sendtext_text);
mControl.sendText(new DataResponse<Boolean>(),text.getText().toString() + "\n",context);
dismissDialog(DIALOG_SENDTEXT);
}
}
);
Button cancelbutton=(Button)dialog.findViewById(R.id.sendtext_button_cancel);
cancelbutton.setOnClickListener(new OnClickListener(){
public void onClick(View v){
dismissDialog(DIALOG_SENDTEXT);
}
}
);
break;
default :
dialog=null;
}
return dialog;
}
 

Example 24

From project androidTileMapEditor_1, under directory /src/it/sineo/android/tileMapEditor/.

Source file: TiledMapActivity.java

  31 
vote

@Override public void onClick(DialogInterface dialog,int which){
  if (dialog == renameDialog) {
    final EditText input=(EditText)renameDialog.findViewById(R.id.tiledMap_dlg_rename_name);
    String mapName=input.getText().toString().trim();
    if (mapName.length() == 0) {
      mapName=getString(R.string.tiledMap_dlg_renameMap_noName);
    }
    if (which == DialogInterface.BUTTON_POSITIVE) {
      view.renameMap(mapName);
      getSupportActionBar().setTitle(mapName);
    }
 else     if (which == DialogInterface.BUTTON_NEGATIVE && (view.getMapName() == null || view.getMapName().trim().length() == 0)) {
      mapName=getString(R.string.tiledMap_dlg_renameMap_noName);
      view.renameMap(mapName);
      getSupportActionBar().setTitle(mapName);
    }
  }
 else   if (dialog == confirmMapSaveDialog) {
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
{
        Intent data=new Intent();
        data.putExtra(C.EXTRA_MAP_ID,mapId);
        data.putExtra(C.EXTRA_MAP_JSON,view.toJSON());
        data.putExtra(C.EXTRA_MAP_THUMB,view.exportThumb(CompressFormat.PNG,9));
        TiledMapActivity.this.setResult(RESULT_OK,data);
        TiledMapActivity.this.finish();
        break;
      }
case DialogInterface.BUTTON_NEGATIVE:
{
      TiledMapActivity.this.setResult(RESULT_CANCELED);
      TiledMapActivity.this.finish();
      break;
    }
}
}
}
 

Example 25

From project androidtracks, under directory /src/org/sfcta/cycletracks/.

Source file: SaveTrip.java

  31 
vote

void activateSubmitButton(){
  final Button btnSubmit=(Button)findViewById(R.id.ButtonSubmit);
  final Intent xi=new Intent(this,ShowMap.class);
  btnSubmit.setEnabled(true);
  btnSubmit.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      TripData trip=TripData.fetchTrip(SaveTrip.this,tripid);
      trip.populateDetails();
      if (purpose.equals("")) {
        Toast.makeText(getBaseContext(),"You must select a trip purpose before submitting! Choose from the purposes above.",Toast.LENGTH_SHORT).show();
        return;
      }
      EditText notes=(EditText)findViewById(R.id.NotesField);
      String fancyStartTime=DateFormat.getInstance().format(trip.startTime);
      SimpleDateFormat sdf=new SimpleDateFormat("m");
      sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
      String minutes=sdf.format(trip.endTime - trip.startTime);
      String fancyEndInfo=String.format("%1.1f miles, %s minutes.  %s",(0.0006212f * trip.distance),minutes,notes.getEditableText().toString());
      trip.updateTrip(purpose,fancyStartTime,fancyEndInfo,notes.getEditableText().toString());
      trip.updateTripStatus(TripData.STATUS_COMPLETE);
      resetService();
      InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
      imm.hideSoftInputFromWindow(v.getWindowToken(),0);
      Intent i=new Intent(getApplicationContext(),MainInput.class);
      startActivity(i);
      xi.putExtra("showtrip",trip.tripid);
      xi.putExtra("uploadTrip",true);
      startActivity(xi);
      SaveTrip.this.finish();
    }
  }
);
}
 

Example 26

From project android_packages_apps_cmparts, under directory /src/com/cyanogenmod/cmparts/activities/led/.

Source file: CategoryActivity.java

  31 
vote

@Override public boolean onPreferenceTreeClick(PreferenceScreen screen,Preference pref){
  if (pref == mCategoryAddPref) {
    AlertDialog dialog=new AlertDialog.Builder(this).create();
    LayoutInflater factory=LayoutInflater.from(this);
    final View textEntryView=factory.inflate(R.layout.add_cat,null);
    dialog.setTitle(R.string.trackball_category_add_title);
    dialog.setView(textEntryView);
    dialog.setButton(DialogInterface.BUTTON_POSITIVE,getString(android.R.string.ok),new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int which){
        EditText textBox=(EditText)textEntryView.findViewById(R.id.cat_text);
        String name=textBox.getText().toString();
        if (name.contains("=")) {
          showDisallowedNameError();
          return;
        }
        mCategories.add(name);
        saveCategories();
        updateRemoveEntries();
      }
    }
);
    dialog.setButton(DialogInterface.BUTTON_NEGATIVE,getString(android.R.string.cancel),(DialogInterface.OnClickListener)null);
    dialog.show();
    return false;
  }
  return super.onPreferenceTreeClick(screen,pref);
}
 

Example 27

From project android_packages_apps_Gallery3D, under directory /src/com/cooliris/media/.

Source file: MovieView.java

  31 
vote

private void showSetUrlDialog(){
  final EditText editText=new EditText(this);
  editText.setHint(R.string.video_set_url_hint);
  new AlertDialog.Builder(this).setView(editText).setTitle(R.string.video_set_url_title).setMessage(R.string.video_set_url_msg).setPositiveButton(R.string.video_set_url_pos,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      String uri=editText.getText().toString();
      finish();
      restart(uri);
    }
  }
).setNegativeButton(R.string.video_set_url_neg,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
    }
  }
).create().show();
}
 

Example 28

From project android_8, under directory /src/com/defuzeme/gui/.

Source file: Gui.java

  30 
vote

public void showInputManualConnectDialog(int title,int content){
  this._inputText=new EditText(this._activity);
  this._inputText.setRawInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
  Gui._builder=new AlertDialog.Builder(this._activity);
  Gui._builder.setView(this._inputText);
  Gui._builder.setTitle(title);
  Gui._builder.setMessage(content);
  Gui._builder.setPositiveButton(android.R.string.ok,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      if (isValidIPAddress(_inputText.getText().toString()) == true) {
        DefuzeMe.Network.connectIP(_inputText.getText().toString());
      }
 else {
        DefuzeMe.Gui.toast("\"" + _inputText.getText().toString() + "\" "+ DefuzeMe._mainActivity.getString(string.NotValidIPAddress));
      }
    }
  }
);
  Gui._builder.setNegativeButton(android.R.string.cancel,null);
  Gui._builder.setCancelable(true);
  Gui._builder.create().show();
}
 

Example 29

From project android_packages_apps_CMSettings, under directory /src/com/cyanogenmod/settings/activities/.

Source file: ColorPickerDialog.java

  30 
vote

protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  LinearLayout layout=new LinearLayout(mContext);
  layout.setOrientation(LinearLayout.VERTICAL);
  layout.setGravity(android.view.Gravity.CENTER);
  LinearLayout.LayoutParams layoutParams=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT);
  layoutParams.setMargins(10,0,10,5);
  TextView tv=new TextView(mContext);
  tv.setText("Color Picker");
  layout.addView(tv,layoutParams);
  mColorPickerView=new ColorPickerView(getContext(),onColorChangedListener,mInitialColor);
  layout.addView(mColorPickerView,layoutParams);
  mTransparencyBar=new SeekBar(mContext);
  mTransparencyBar.setMax(255);
  mTransparencyBar.setProgressDrawable(new TextSeekBarDrawable(mContext.getResources(),"alpha",true));
  mTransparencyBar.setProgress(Color.alpha(mInitialColor));
  mTransparencyBar.setOnSeekBarChangeListener(onTransparencyChangedListener);
  layout.addView(mTransparencyBar,layoutParams);
  mEditText=new EditText(mContext);
  mEditText.addTextChangedListener(mEditTextListener);
  mEditText.setText(convertToARGB(mInitialColor));
  layout.addView(mEditText,layoutParams);
  setContentView(layout);
  setTitle("Color Picker");
}
 

Example 30

From project android_packages_apps_SalvageParts, under directory /src/com/salvagemod/salvageparts/activities/.

Source file: ColorPickerDialog.java

  30 
vote

protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  LinearLayout layout=new LinearLayout(mContext);
  layout.setOrientation(LinearLayout.VERTICAL);
  layout.setGravity(android.view.Gravity.CENTER);
  LinearLayout.LayoutParams layoutParams=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT);
  layoutParams.setMargins(10,0,10,5);
  TextView tv=new TextView(mContext);
  tv.setText(com.salvagemod.salvageparts.R.string.msg_color_picker);
  layout.addView(tv,layoutParams);
  mColorPickerView=new ColorPickerView(getContext(),onColorChangedListener,mInitialColor);
  layout.addView(mColorPickerView,layoutParams);
  mTransparencyBar=new SeekBar(mContext);
  mTransparencyBar.setMax(255);
  mTransparencyBar.setProgressDrawable(new TextSeekBarDrawable(mContext.getResources(),"alpha",true));
  mTransparencyBar.setProgress(Color.alpha(mInitialColor));
  mTransparencyBar.setOnSeekBarChangeListener(onTransparencyChangedListener);
  layout.addView(mTransparencyBar,layoutParams);
  mEditText=new EditText(mContext);
  mEditText.addTextChangedListener(mEditTextListener);
  mEditText.setText(convertToARGB(mInitialColor));
  layout.addView(mEditText,layoutParams);
  setContentView(layout);
  setTitle(com.salvagemod.salvageparts.R.string.title_color_picker);
}
 

Example 31

From project andstatus, under directory /src/org/andstatus/app/appwidget/.

Source file: MyAppWidgetConfigure.java

  30 
vote

@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setResult(RESULT_CANCELED);
  setContentView(R.layout.appwidget_configure);
  mAppWidgetTitle=(EditText)findViewById(R.id.appwidget_title);
  findViewById(R.id.save_button).setOnClickListener(mOnClickListener);
  Intent intent=getIntent();
  Bundle extras=intent.getExtras();
  if (extras != null) {
    mAppWidgetId=extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID,AppWidgetManager.INVALID_APPWIDGET_ID);
  }
  if (MyLog.isLoggable(TAG,Log.VERBOSE)) {
    Log.v(TAG,"mAppWidgetId=" + mAppWidgetId);
  }
  if (mAppWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
    finish();
  }
  appWidgetData=new MyAppWidgetData(this,mAppWidgetId);
  appWidgetData.load();
  mAppWidgetTitle.setText(appWidgetData.nothingPref);
}
 

Example 32

From project andtweet, under directory /src/com/xorcode/andtweet/appwidget/.

Source file: AndTweetAppWidgetConfigure.java

  30 
vote

@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setResult(RESULT_CANCELED);
  setContentView(R.layout.appwidget_configure);
  mAppWidgetTitle=(EditText)findViewById(R.id.appwidget_title);
  findViewById(R.id.save_button).setOnClickListener(mOnClickListener);
  Intent intent=getIntent();
  Bundle extras=intent.getExtras();
  if (extras != null) {
    mAppWidgetId=extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID,AppWidgetManager.INVALID_APPWIDGET_ID);
  }
  if (Log.isLoggable(AndTweetService.APPTAG,Log.VERBOSE)) {
    Log.v(TAG,"mAppWidgetId=" + mAppWidgetId);
  }
  if (mAppWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
    finish();
  }
  appWidgetData=new AndTweetAppWidgetData(this,mAppWidgetId);
  appWidgetData.load();
  mAppWidgetTitle.setText(appWidgetData.nothingPref);
}
 

Example 33

From project Anki-Android, under directory /src/com/ichi2/anki/.

Source file: MyAccount.java

  30 
vote

private void initAllContentViews(){
  mLoginToMyAccountView=getLayoutInflater().inflate(R.layout.my_account,null);
  mUsername=(EditText)mLoginToMyAccountView.findViewById(R.id.username);
  mPassword=(EditText)mLoginToMyAccountView.findViewById(R.id.password);
  Button loginButton=(Button)mLoginToMyAccountView.findViewById(R.id.login_button);
  loginButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      login();
    }
  }
);
  Button signUpButton=(Button)mLoginToMyAccountView.findViewById(R.id.sign_up_button);
  signUpButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(getResources().getString(R.string.ankionline_sign_up_url))));
    }
  }
);
  mLoggedIntoMyAccountView=getLayoutInflater().inflate(R.layout.my_account_logged_in,null);
  mUsernameLoggedIn=(TextView)mLoggedIntoMyAccountView.findViewById(R.id.username_logged_in);
  Button logoutButton=(Button)mLoggedIntoMyAccountView.findViewById(R.id.logout_button);
  logoutButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      logout();
    }
  }
);
}
 

Example 34

From project agit, under directory /agit/src/main/java/com/madgag/agit/prompts/.

Source file: DialogPromptUIBehaviour.java

  29 
vote

public Dialog onCreateDialog(int id){
  AlertDialog.Builder builder=new AlertDialog.Builder(activity);
switch (id) {
case YES_NO_DIALOG:
    builder.setMessage("...").setPositiveButton("Yes",sendDialogResponseOf(true)).setNegativeButton("No",sendDialogResponseOf(false));
  break;
case STRING_ENTRY_DIALOG:
View textEntry=LayoutInflater.from(wrapWithDialogContext(activity)).inflate(R.layout.text_entry,null);
input=(EditText)textEntry.findViewById(R.id.text_entry_field);
builder.setTitle("...");
builder.setView(textEntry);
builder.setPositiveButton("OK",new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog,int which){
responseInterface.setResponse(input.getText().toString());
}
}
);
break;
}
return builder.create();
}
 

Example 35

From project aksunai, under directory /src/org/androidnerds/app/aksunai/ui/.

Source file: ChatActivity.java

  29 
vote

@Override public void onCreate(Bundle appState){
  super.onCreate(appState);
  setContentView(R.layout.chat);
  slideLeftIn=AnimationUtils.loadAnimation(this,R.anim.slide_left_in);
  slideLeftOut=AnimationUtils.loadAnimation(this,R.anim.slide_left_out);
  slideRightIn=AnimationUtils.loadAnimation(this,R.anim.slide_right_in);
  slideRightOut=AnimationUtils.loadAnimation(this,R.anim.slide_right_out);
  mFlipper=(ViewFlipper)findViewById(R.id.chat_flipper);
  entry=(EditText)findViewById(R.id.ircedit);
  entry.setSingleLine();
  entry.setOnKeyListener(mKeyListener);
  Button btnSend=(Button)findViewById(R.id.btnSend);
  btnSend.setOnClickListener(mClickListener);
  gestureDetector=new GestureDetector(new MyGestureDetector());
  gestureListener=new View.OnTouchListener(){
    public boolean onTouch(    View v,    MotionEvent event){
      return gestureDetector.onTouchEvent(event);
    }
  }
;
  mFlipper.setOnTouchListener(gestureListener);
  mNotificationManager=(NotificationManager)getSystemService(NOTIFICATION_SERVICE);
}
 

Example 36

From project AlarmApp-Android, under directory /src/org/alarmapp/activities/.

Source file: AlarmCreateActivity.java

  29 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.alarm_create);
  LogEx.verbose("AlarmCreateActivity");
  this.etAdress=(EditText)findViewById(R.id.etAdress);
  this.tvAdress=(TextView)findViewById(R.id.lAdresse);
  this.etAlarmText=(EditText)findViewById(R.id.etAlarmText);
  this.etAlarmTitle=(EditText)findViewById(R.id.etAlarmTitel);
  this.btCreateAlarm=(Button)findViewById(R.id.bAlarmCreate);
  this.spAlarmGroup=(Spinner)findViewById(R.id.sAlarmGroup);
  etAdress.setVisibility(etAdress.GONE);
  tvAdress.setVisibility(tvAdress.GONE);
  btCreateAlarm.setOnClickListener(alarmCreateListener);
  try {
    alarmGroups=AlarmApp.getAuthWebClient().getAlarmGroups();
    AlarmGroupsSpinnerAdapter adapter=new AlarmGroupsSpinnerAdapter(this,alarmGroups);
    spAlarmGroup.setAdapter(adapter);
    spAlarmGroup.setSelection(0);
  }
 catch (  WebException e) {
    LogEx.exception(e);
  }
}
 

Example 37

From project AmDroid, under directory /AmDroid/src/main/java/com/jaeckel/amenoid/.

Source file: SettingsActivity.java

  29 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.settings);
  passwordReset=(TextView)findViewById(R.id.forgot_password);
  passwordReset.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      resetPassword(null);
    }
  }
);
  setTitle("Signing in");
  ActionBar actionBar=getSupportActionBar();
  actionBar.setDisplayHomeAsUpEnabled(true);
  prefs=PreferenceManager.getDefaultSharedPreferences(SettingsActivity.this);
  emailField=(EditText)findViewById(R.id.email_field);
  String email=prefs.getString(Constants.PREFS_EMAIL,"");
  if (TextUtils.isEmpty(email)) {
    email=prefs.getString(Constants.PREFS_USER_NAME,"");
    if (!TextUtils.isEmpty(email) && email.contains("@")) {
      SharedPreferences.Editor editor=prefs.edit();
      editor.putString(Constants.PREFS_EMAIL,email);
      editor.commit();
    }
  }
  emailField.setText(email);
  passwordField=(EditText)findViewById(R.id.password_field);
  String password=prefs.getString(Constants.PREFS_PASSWORD,"");
  passwordField.setText(password);
}
 

Example 38

From project andlytics, under directory /src/com/github/andlyticsproject/.

Source file: AdmobAuthenticatorActivity.java

  29 
vote

private void initLayout(){
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.admob_login);
  mMessageView=(TextView)findViewById(R.id.admob_login_message);
  mUsernameEdit=(EditText)findViewById(R.id.admob_login_username_edit);
  mPasswordEdit=(EditText)findViewById(R.id.admob_login_password_edit);
  if (mUsername == null) {
    mUsername=Preferences.getAccountName(AdmobAuthenticatorActivity.this);
  }
  mUsernameEdit.setText(mUsername);
  if (mUsername != null) {
    mPasswordEdit.requestFocusFromTouch();
  }
  if (getMessage() != null) {
    mMessageView.setText(getMessage());
  }
  mOkButton=findViewById(R.id.admob_login_ok_button);
  mOkButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      handleLogin(v);
    }
  }
);
}
 

Example 39

From project android-api-demos, under directory /src/com/mobeelizer/demos/activities/.

Source file: LoginActivity.java

  29 
vote

/** 
 * {@inheritDoc}
 */
@Override protected void onCreate(final Bundle savedInstanceState){
  try {
    Class.forName("android.os.AsyncTask");
  }
 catch (  ClassNotFoundException e) {
    e.printStackTrace();
  }
  super.onCreate(savedInstanceState);
  setContentView(R.layout.a_login);
  mShakeAnimation=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.shake);
  mCreateSessionButton=(Button)findViewById(R.id.loginCreateSession);
  mConnectButton=(Button)findViewById(R.id.loginSessionConnect);
  mSessionCodeEditText=(EditText)findViewById(R.id.loginSessionCode);
  mCreateSessionButton.setOnClickListener(getOnCreateSessionClickListenter());
  mConnectButton.setOnClickListener(getOnConnectClickListenter());
  UIUtils.prepareClip(mCreateSessionButton);
  UIUtils.prepareClip(mConnectButton);
  mSharedPrefs=PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
  String code=mSharedPrefs.getString(BaseActivity.SESSION_CODE,null);
  if (code != null) {
    mLoginDialog=new Dialog(this,R.style.MobeelizerDialogTheme);
    mLoginDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    mLoginDialog.setContentView(R.layout.progress_dialog);
    ((TextView)mLoginDialog.findViewById(R.id.dialogText)).setText(R.string.loggingIn);
    mLoginDialog.setCancelable(false);
    mLoginDialog.show();
    UserType user=UserType.valueOf(mSharedPrefs.getString(BaseActivity.USER_TYPE,"A"));
    if (user == UserType.A) {
      Mobeelizer.login(code,getString(R.string.c_userALogin),getString(R.string.c_userAPassword),this);
    }
 else     if (user == UserType.B) {
      Mobeelizer.login(code,getString(R.string.c_userBLogin),getString(R.string.c_userBPassword),this);
    }
  }
}
 

Example 40

From project android-bankdroid, under directory /src/com/liato/bankdroid/.

Source file: BankEditActivity.java

  29 
vote

@Override public void onClick(View v){
  if (v.getId() == R.id.btnSettingsCancel) {
    this.finish();
  }
 else   if (v.getId() == R.id.btnSettingsOk) {
    SELECTED_BANK.setUsername(((EditText)findViewById(R.id.edtBankeditUsername)).getText().toString().trim());
    SELECTED_BANK.setPassword(((EditText)findViewById(R.id.edtBankeditPassword)).getText().toString().trim());
    SELECTED_BANK.setCustomName(((EditText)findViewById(R.id.edtBankeditCustomName)).getText().toString().trim());
    SELECTED_BANK.setExtras(((EditText)findViewById(R.id.edtBankeditExtras)).getText().toString().trim());
    SELECTED_BANK.setDbid(BANKID);
    new DataRetrieverTask(this,SELECTED_BANK).execute();
  }
}
 

Example 41

From project android-service-arch, under directory /ServiceFramework/src/ru/evilduck/framework/ui/.

Source file: DemoActivity.java

  29 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  text1=(EditText)findViewById(R.id.editText1);
  text2=(EditText)findViewById(R.id.editText2);
  text2.setOnEditorActionListener(new OnEditorActionListener(){
    @Override public boolean onEditorAction(    TextView textView,    int id,    KeyEvent event){
      if (id == EditorInfo.IME_ACTION_DONE) {
        doIt();
      }
      return false;
    }
  }
);
  findViewById(R.id.button_button).setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      doIt();
    }
  }
);
}
 

Example 42

From project Android-SyncAdapter-JSON-Server-Example, under directory /src/com/example/android/samplesync/authenticator/.

Source file: AuthenticatorActivity.java

  29 
vote

/** 
 * {@inheritDoc}
 */
@Override public void onCreate(Bundle icicle){
  Log.i(TAG,"onCreate(" + icicle + ")");
  super.onCreate(icicle);
  mAccountManager=AccountManager.get(this);
  Log.i(TAG,"loading data from Intent");
  final Intent intent=getIntent();
  mUsername=intent.getStringExtra(PARAM_USERNAME);
  mAuthtokenType=intent.getStringExtra(PARAM_AUTHTOKEN_TYPE);
  mRequestNewAccount=mUsername == null;
  mConfirmCredentials=intent.getBooleanExtra(PARAM_CONFIRMCREDENTIALS,false);
  Log.i(TAG,"    request new: " + mRequestNewAccount);
  requestWindowFeature(Window.FEATURE_LEFT_ICON);
  setContentView(R.layout.login_activity);
  getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,android.R.drawable.ic_dialog_alert);
  mMessage=(TextView)findViewById(R.id.message);
  mUsernameEdit=(EditText)findViewById(R.id.username_edit);
  mPasswordEdit=(EditText)findViewById(R.id.password_edit);
  mUsernameEdit.setText(mUsername);
  mMessage.setText(getMessage());
}
 

Example 43

From project android-voip-service, under directory /src/main/java/org/linphone/.

Source file: AbstractContactPickerActivity.java

  29 
vote

protected void createCustomPicker(){
  mContactList=(ListView)findViewById(R.id.contactList);
  mcontactFilter=(EditText)findViewById(R.id.contactFilter);
  mcontactFilter.addTextChangedListener(new TextWatcher(){
    public void onTextChanged(    CharSequence s,    int start,    int b,    int c){
    }
    public void beforeTextChanged(    CharSequence s,    int st,    int c,    int a){
    }
    public void afterTextChanged(    Editable s){
      adapter.runQueryOnBackgroundThread(s);
      adapter.getFilter().filter(s.toString());
    }
  }
);
  String[] from=new String[]{col_display_name};
  int[] to=new int[]{android.R.id.text1};
  int layout=android.R.layout.simple_list_item_1;
  adapter=new SimpleCursorAdapter(this,layout,runQuery(null),from,to);
  adapter.setFilterQueryProvider(this);
  mContactList.setAdapter(adapter);
  mContactList.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      final CharSequence contactName=((TextView)view.findViewById(android.R.id.text1)).getText();
      choosePhoneNumberAndDial(contactName,String.valueOf(id));
    }
  }
);
}
 

Example 44

From project android-xbmcremote-sandbox, under directory /src/org/xbmc/android/account/authenticator/.

Source file: AuthenticatorActivity.java

  29 
vote

/** 
 * {@inheritDoc}
 */
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  requestWindowFeature(Window.FEATURE_LEFT_ICON);
  setContentView(R.layout.activity_addaccount);
  getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,android.R.drawable.ic_dialog_info);
  mFlipper=(ViewFlipper)findViewById(R.id.addaccount_flipper);
  mButtonNext=(Button)findViewById(R.id.addaccount_next_button);
  mButtonPrev=(Button)findViewById(R.id.addaccount_prev_button);
  mZeroconfDiscoverButton=(ImageButton)findViewById(R.id.addaccount_zeroconf_scan_button);
  mZeroconfProgressBar=(ProgressBar)findViewById(R.id.addaccount_zeroconf_progressbar);
  mZeroconfSpinner=(Spinner)findViewById(R.id.addaccount_zeroconf_spinner);
  mZeroconfSpinnerText=(TextView)findViewById(R.id.addaccount_zeroconf_spinnertext);
  mMessage=(TextView)findViewById(R.id.addaccount_credentials_text);
  mUsernameEdit=(EditText)findViewById(R.id.username_edit);
  mPasswordEdit=(EditText)findViewById(R.id.password_edit);
  mUsernameEdit.setText(mUsername);
  mFinishedText=(TextView)findViewById(R.id.addaccount_finished_text);
  mAccountManager=AccountManager.get(this);
  mReceiver=new DetachableResultReceiver(new Handler());
  mReceiver.setReceiver(this);
  discoverHosts(null);
}
 

Example 45

From project AndroidDevWeekendDub-BookLibrary, under directory /src/org/curiouscreature/android/shelves/activity/.

Source file: AddBookActivity.java

  29 
vote

private void setupViews(){
  mSearchButton=findViewById(R.id.button_go);
  mSearchButton.setOnClickListener(this);
  mSearchButton.setEnabled(false);
  mSearchQuery=(EditText)findViewById(R.id.input_search_query);
  mSearchQuery.addTextChangedListener(new SearchFieldWatcher());
  final FastBitmapDrawable cover=new FastBitmapDrawable(ImageUtilities.createShadow(BitmapFactory.decodeResource(getResources(),R.drawable.unknown_cover_no_shadow),BOOK_COVER_WIDTH,BOOK_COVER_HEIGHT));
  mBooksAdapter=new SearchResultsAdapter(this,cover);
  final SearchResultsAdapter resultsAdapter=mBooksAdapter;
  final SearchResultsAdapter oldAdapter=(SearchResultsAdapter)getLastNonConfigurationInstance();
  if (oldAdapter != null) {
    final int count=oldAdapter.getCount();
    for (int i=0; i < count; i++) {
      resultsAdapter.add(oldAdapter.getItem(i));
    }
  }
  final ListView searchResults=(ListView)findViewById(R.id.list_search_results);
  searchResults.setAdapter(resultsAdapter);
  searchResults.setOnItemClickListener(this);
}
 

Example 46

From project androidquery, under directory /src/com/androidquery/.

Source file: AbstractAQuery.java

  29 
vote

/** 
 * Gets the editable.
 * @return the editable
 */
public Editable getEditable(){
  Editable result=null;
  if (view instanceof EditText) {
    result=((EditText)view).getEditableText();
  }
  return result;
}
 

Example 47

From project AndroidValidators, under directory /com/ruswizards/android/validators/.

Source file: EditTextValidator.java

  29 
vote

@Override public void setViewToValidate(View view,ValidationMode mode){
  if (!(view instanceof EditText))   throw new IllegalArgumentException("Given view is not a EditText");
  if (viewToValidate_ != null) {
    viewToValidate_.removeTextChangedListener(this);
    viewToValidate_.setOnFocusChangeListener(null);
  }
  viewToValidate_=(EditText)view;
switch (mode) {
case Auto:
    viewToValidate_.addTextChangedListener(this);
  viewToValidate_.setOnFocusChangeListener(this);
break;
case Manual:
break;
}
}
 

Example 48

From project Android_1, under directory /DynamicListItems/src/com/novoda/.

Source file: DynamicListItems.java

  29 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.dynamic_list);
  newValue=(EditText)findViewById(R.id.new_value_field);
  setListAdapter(new SimpleAdapter(this,list,R.layout.row,new String[]{ITEM_KEY},new int[]{R.id.list_value}));
  ((ImageButton)findViewById(R.id.button)).setOnClickListener(getBtnClickListener());
}
 

Example 49

From project android_packages_apps_FileManager, under directory /src/org/openintents/filemanager/.

Source file: FileManagerActivity.java

  29 
vote

private void onCreateDirectoryInput(){
  mDirectoryInput=(LinearLayout)findViewById(R.id.directory_input);
  mEditDirectory=(EditText)findViewById(R.id.directory_text);
  mEditDirectory.setOnKeyListener(new OnKeyListener(){
    public boolean onKey(    View v,    int keyCode,    KeyEvent event){
      if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
        goToDirectoryInEditText();
        return true;
      }
      return false;
    }
  }
);
  mButtonDirectoryPick=(ImageButton)findViewById(R.id.button_directory_pick);
  mButtonDirectoryPick.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View arg0){
      goToDirectoryInEditText();
    }
  }
);
}
 

Example 50

From project android_packages_apps_Tag, under directory /src/com/android/apps/tag/record/.

Source file: AbstractTextRecordEditInfo.java

  29 
vote

@Override public View getEditView(Activity activity,LayoutInflater inflater,ViewGroup parent,EditCallbacks callbacks){
  View view=buildEditView(activity,inflater,getLayoutId(),parent,callbacks);
  mEditText=(EditText)view.findViewById(R.id.value);
  mEditText.setText(mCurrentValue);
  mEditText.addTextChangedListener(this);
  return view;
}
 

Example 51

From project androvoip, under directory /src/org/androvoip/ui/.

Source file: AndroVoIP.java

  29 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  final Intent intent=getIntent();
  setContentView(R.layout.main);
  final TabHost tab_host=getTabHost();
  tab_host.addTab(tab_host.newTabSpec(DIALER_TAB).setIndicator("Dialer",this.getResources().getDrawable(R.drawable.ic_tab_call)).setContent(R.id.dialer));
  tab_host.addTab(tab_host.newTabSpec(STATUS_TAB).setIndicator("Status",this.getResources().getDrawable(R.drawable.ic_tab_info_details)).setContent(R.id.status));
  tab_host.setCurrentTab(0);
  tab_host.setOnTabChangedListener(this);
  bindService(new Intent().setClassName("org.androvoip","org.androvoip.iax2.IAX2Service"),this,BIND_AUTO_CREATE);
  ((Button)findViewById(R.id.status_refresh)).setOnClickListener(this);
  ((Button)findViewById(R.id.send_button)).setOnClickListener(this);
  ((Button)findViewById(R.id.hangup_button)).setOnClickListener(this);
  ((EditText)findViewById(R.id.dialer_number)).selectAll();
  if (Intent.ACTION_VIEW.equals(intent.getAction())) {
    final Uri data=intent.getData();
    final String scheme=data.getScheme();
    final String path=data.getSchemeSpecificPart();
    Log.d("org.androvoip","Got a URI: " + scheme + " - "+ path);
  }
}