List of usage examples for android.widget EditText getText
@Override
public Editable getText()
From source file:at.florian_lentsch.expirysync.RegistrationActivity.java
/** * Tries to register the user on the server using the form data. Currently * only called by tapping {@code R.id.submit} * //from w w w .ja va 2 s .co m * @param submitButton * the tapped button */ public void register(View submitButton) { // Retrieve form contents: final EditText accountNameField = ((EditText) findViewById(R.id.account_name)); final EditText emailField = ((EditText) findViewById(R.id.email_address)); final EditText passwordField = ((EditText) findViewById(R.id.password)); final String username = accountNameField.getText().toString(); final String email = emailField.getText().toString(); final String password = passwordField.getText().toString(); final ServerProxy serverProxy = ServerProxy.getInstanceFromConfig(this); final DatabaseManager dbManager = DatabaseManager.getInstance(); ProductListActivity.currentLocation = dbManager.getDefaultLocation(); final ServerProxy.UserCallback registerCallback = serverProxy.new UserCallback() { @Override public void onReceive(User receivedUser) { RegistrationActivity.this.onRegistrationSucceeded(receivedUser, password); } @Override public void onError(Map<String, List<String>> errors) { Util.hideProgress(); Util.showMessage(RegistrationActivity.this, getResources().getString(R.string.registration_failed)); List<String> usernameErrors = errors.get("username"); if (usernameErrors != null && usernameErrors.size() > 0) { accountNameField.setError(StringUtils.join(usernameErrors.toArray(), ", ")); } List<String> emailErrors = errors.get("email"); if (emailErrors != null && emailErrors.size() > 0) { emailField.setError(StringUtils.join(emailErrors.toArray(), ", ")); } List<String> passwordErrors = errors.get("password"); if (passwordErrors != null && passwordErrors.size() > 0) { passwordField.setError(StringUtils.join(passwordErrors.toArray(), ", ")); } } }; Util.showProgress(this); serverProxy.register(email.length() == 0 ? null : email, username.length() == 0 ? null : username, password, registerCallback); }
From source file:com.securekey.sdk.sample.VerifyQuickCodeActivity.java
/** * Assert user//ww w. j a v a2s. co m * <p> * Gets Briidge object and calls briidge.assertUser * * @param passcode user supplied quickcode */ private void asserUser(final String passcode) { mProgressDialog = new ProgressDialog(this); updateProgressDialog("Verifying"); this.jwsExpected = false; EditText audiencesText = (EditText) findViewById(R.id.assert_audiences); String[] list = (audiencesText.length() == 0 ? (new String[] {}) : audiencesText.getText().toString().split("\n")); SKAudience[] audiences = new SKAudience[list.length]; for (int i = 0; i < audiences.length; i++) { audiences[i] = new SKAudience(list[i]); } BriidgePlatformFactory.getBriidgePlatform(VerifyQuickCodeActivity.this).assertUser( SDKSampleApp.getInstance().retrieveUserId(), passcode, audiences, VerifyQuickCodeActivity.this); }
From source file:com.feedhenry.helloworld.HelloFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = View.inflate(getActivity(), R.layout.hello_fragment, null); final TextView mResponse = (TextView) view.findViewById(R.id.cloud_response); final EditText mName = (EditText) view.findViewById(R.id.name); Button mCloudButton = (Button) view.findViewById(R.id.button); mCloudButton.setOnClickListener(new View.OnClickListener() { @Override// w w w . j a v a2 s . co m public void onClick(final View v) { mResponse.setText(""); mCloudButton.setEnabled(false); cloudCall(v, mName.getText().toString(), mResponse); mName.setText(""); } }); return view; }
From source file:com.pixplicity.castdemo.MainActivity.java
private void sendTextMessage(final EditText textField) { if (CastProxy.getChannel().sendMessage(textField.getText().toString())) { textField.setText(null);/* ww w . j av a 2 s . c om*/ } }
From source file:de.wikilab.android.friendica01.Max.java
/** * displays the login form (layout/loginscreen.xml) as a modal dialog and calls tryLogin * when user confirms the form/* w w w . java 2 s. com*/ * @param ctx MUST IMPLEMENT LoginListener !!! * @param errmes message which is displayed above the Login form (e.g. "wrong password entered") */ public static void showLoginForm(final Activity ctx, String errmes) { Log.v(TAG, "... showLoginForm"); View myView = ctx.getLayoutInflater().inflate(R.layout.loginscreen, null, false); final AlertDialog alert = new AlertDialog.Builder(ctx).setTitle("Login to Friendica").setView(myView) .setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { ctx.finish(); } }).show(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx); String protocol = prefs.getString("login_protocol", "https"); String server = prefs.getString("login_server", null); String userName = prefs.getString("login_user", null); if (errmes != null) { ((TextView) myView.findViewById(R.id.lblInfo)).setText(errmes); } final Spinner selProtocol = (Spinner) myView.findViewById(R.id.selProtocol); selProtocol.setSelection(protocol.equals("https") ? 1 : 0); //HACK !!! final EditText edtServer = (EditText) myView.findViewById(R.id.edtServer); edtServer.setText(server); final EditText edtUser = (EditText) myView.findViewById(R.id.edtUser); edtUser.setText(userName); final EditText edtPassword = (EditText) myView.findViewById(R.id.edtPassword); ((TextView) myView.findViewById(R.id.proxy_settings)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ctx.startActivity(new Intent(ctx, PreferencesActivity.class)); } }); ((Button) myView.findViewById(R.id.button1)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { SharedPreferences.Editor prefs = PreferenceManager.getDefaultSharedPreferences(ctx).edit(); prefs.putString("login_protocol", selProtocol.getSelectedItem().toString()); String server = edtServer.getText().toString(); server = server.replaceAll("^https?://", ""); prefs.putString("login_server", server); prefs.putString("login_user", edtUser.getText().toString()); prefs.putString("login_password", edtPassword.getText().toString()); prefs.commit(); alert.dismiss(); tryLogin(ctx); } }); }
From source file:com.download.android.UploadActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_upload); final EditText edtTxt1 = (EditText) findViewById(R.id.editTextUpl1); final EditText edtTxt2 = (EditText) findViewById(R.id.editTextUpl2); Button btnUpl = (Button) findViewById(R.id.upload); btnUpl.setOnClickListener(new View.OnClickListener() { @Override//from ww w. ja v a 2 s. c o m public void onClick(View v) { String param1 = edtTxt1.getText().toString(); String param2 = edtTxt2.getText().toString(); item.setActionView(R.layout.progress); SendHttpRequestTask t = new SendHttpRequestTask(); String[] params = new String[] { url, param1, param2 }; t.execute(params); } }); }
From source file:app.dropbox.encryption.encryptionsetup.java
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.encryption_setup); initilizingVariables();/*w w w .j a v a 2 s . c o m*/ if (encryptKey != null) { if (fileToEncrypt != null) launchEncryption(); else launchnext(); } else { // acctok=getSharedPreferences("accesstoken",0); // accessToken =acctok.getString("accesstoken", null); // if(accessToken==null){ // goback(); // } // final EditText key = (EditText) findViewById(R.id.editText1); ImageButton encrypt = (ImageButton) findViewById(R.id.imageButton1); encrypt.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { encryptKey = key.getText().toString(); if (keyValidator(encryptKey)) { key.setText(""); setKeyToPreferences(); if (fileToEncrypt != null) launchEncryption(); else launchnext(); } else { Toast toast = Toast.makeText(encryptionsetup.this, "Enter key between 5 to 16 Characters", 2000); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); } } }); } }
From source file:fr.univsavoie.ltp.client.map.Popup.java
/** * Afficher sur la map un popup qui propose a l'utilisateur * de mettre a jours son status//from w w w.j a v a 2s. c om */ public final void popupPublishStatus() { DisplayMetrics dm = new DisplayMetrics(); this.activity.getWindowManager().getDefaultDisplay().getMetrics(dm); //final int height = dm.heightPixels; final int width = dm.widthPixels; int popupWidth = (int) (width * 0.75); //int popupHeight = height / 2; // Inflate the popup_layout.xml ScrollView viewGroup = (ScrollView) this.activity.findViewById(R.id.popupStatus); LayoutInflater layoutInflater = (LayoutInflater) this.activity .getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View layout = layoutInflater.inflate(R.layout.popup_set_status, viewGroup); layout.setBackgroundResource(R.drawable.popup_gradient); // Crer le PopupWindow final PopupWindow popupPublishStatus = new PopupWindow(layout, popupWidth, LayoutParams.WRAP_CONTENT, true); popupPublishStatus.setBackgroundDrawable(new BitmapDrawable()); popupPublishStatus.setOutsideTouchable(true); // Some offset to align the popup a bit to the right, and a bit down, relative to button's position. final int OFFSET_X = 0; final int OFFSET_Y = 0; // Displaying the popup at the specified location, + offsets. this.activity.findViewById(R.id.layoutMain).post(new Runnable() { public void run() { popupPublishStatus.showAtLocation(layout, Gravity.CENTER, OFFSET_X, OFFSET_Y); } }); /* * Evenements composants du PopupWindow */ // Ecouteur d'vnement sur le bouton pour se dconnecter Button publish = (Button) layout.findViewById(R.id.btStatusPublish); publish.setOnClickListener(new OnClickListener() { public void onClick(View v) { EditText userStatus = (EditText) layout.findViewById(R.id.fieldUserStatus); if (userStatus.getText().toString().length() == 0) { Toast.makeText(activity, "Impossible de publi ton status !", Toast.LENGTH_LONG).show(); popupPublishStatus.dismiss(); } else if (userStatus.getText().toString().length() < 3) { Toast.makeText(activity, "Impossible de publi ton status !", Toast.LENGTH_LONG).show(); popupPublishStatus.dismiss(); } else { String json = "{\"ltp\":{\"application\":\"Client LTP\",\"status\":{\"lon\" : \"" + String.valueOf(activity.getLongitude()) + "\",\"lat\" : \"" + String.valueOf(activity.getLatitude()) + "\",\"content\" : \"" + userStatus.getText().toString() + "\"}}}"; activity.getSession().postJSON("https://jibiki.univ-savoie.fr/ltpdev/rest.php/api/1/statuses", "STATUSES", json); Toast.makeText(activity, "Status mise a jours !", Toast.LENGTH_LONG).show(); popupPublishStatus.dismiss(); // Actualise les marqueurs activity.displayFriends(); } } }); }
From source file:ca.cmput301w14t09.PopUpEdit.java
/** * Creates a popup edit window with the given input parameters. * @param comment - edited comment.// w ww.java 2 s.c om */ public void popUpEdit(final Comment comment) { //Creates a dialog box final Dialog dialog = new Dialog(caller); dialog.setContentView(R.layout.pop_up_edit); dialog.setTitle("Comment Text"); Button Submit = (Button) dialog.findViewById(R.id.Submit); final EditText commentText = (EditText) dialog.findViewById(R.id.editComment); commentText.setHint(comment.getCommentText()); dialog.show(); Submit.setOnClickListener(new View.OnClickListener() { //when submit is pressed everything is pused to the server @Override public void onClick(View v) { String str = "commentText = \\\"" + commentText.getText() + "\\\"\""; if (Server.getInstance().isServerReachable(caller)) { try { ElasticSearchOperations.updateComment(comment, str); } catch (InterruptedException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } dialog.dismiss(); } }); }
From source file:com.bringcommunications.etherpay.SendActivity.java
@Override public void onItemSelected(AdapterView<?> parent, View v, int position, long id) { EditText size_view = (EditText) findViewById(R.id.size); String cur_size_str = size_view.getText().toString(); float cur_size = Float.valueOf(cur_size_str); eth_size = (denomination == Denomination.ETH) ? cur_size : cur_size / 1000; denomination = (position == 0) ? Denomination.ETH : Denomination.FINNEY; if (denomination == Denomination.FINNEY) { eth_size = (float) ((int) (eth_size * 1000 + 0.5)) / 1000; }//from w w w . j a va 2s. co m boolean denomination_eth = (denomination == Denomination.ETH) ? true : false; SharedPreferences.Editor preferences_editor = preferences.edit(); preferences_editor.putBoolean("denomination_eth", denomination_eth); System.out.println("set denomination_eth to " + denomination_eth + ", id = " + id); preferences_editor.apply(); String size_str = (denomination == Denomination.ETH) ? String.format("%1.03f", eth_size) : String.format("%03d", (int) (eth_size * 1000 + 0.5)); size_view.setText(size_str); }