List of usage examples for android.widget EditText getText
@Override
public Editable getText()
From source file:com.lge.friendsCamera.MainActivity.java
private void setupViews() { setContentView(R.layout.main_layout); connectStatus = (TextView) findViewById(R.id.text_state); //1. Connect Button buttonConnect = (Button) findViewById(R.id.button_connect); buttonConnect.setOnClickListener(this); // Set IP address and port number EditText editText = (EditText) findViewById(R.id.editTextIPAddr); String ip = editText.getText().toString(); setIPPort(ip);// w w w . j a v a 2s . c o m //2. Get image list buttonCameraImage = (Button) findViewById(R.id.button_cameraimage); buttonCameraImage.setOnClickListener(this); //3. Get video list buttonCameraVideo = (Button) findViewById(R.id.button_cameravideo); buttonCameraVideo.setOnClickListener(this); //4. Image list for downloaded images(images in DCIM/LGC1Sample) // Connect with viewer buttonDownloadImage = (Button) findViewById(R.id.button_downloadimage); buttonDownloadImage.setOnClickListener(this); //5. Video list for downloaded videos(videos in DCIM/LGC1Sample) // Connect with viewer buttonDownloadVideo = (Button) findViewById(R.id.button_downloadvideo); buttonDownloadVideo.setOnClickListener(this); //6. Get camera info (info) buttonInfo = (Button) findViewById(R.id.button_info); buttonInfo.setOnClickListener(this); //7. Get camera state (state) buttonState = (Button) findViewById(R.id.button_state); buttonState.setOnClickListener(this); //8. Check for update buttonCheckForUpdate = (Button) findViewById(R.id.button_checkforupdate); buttonCheckForUpdate.setOnClickListener(this); //9. Set camera options (camera.setOption, camera.getOption) buttonOptions = (Button) findViewById(R.id.button_option); buttonOptions.setOnClickListener(this); //10. Take picture buttonTakePicture = (Button) findViewById(R.id.button_takePicture); buttonTakePicture.setOnClickListener(this); //11. Record video buttonRecordVideo = (Button) findViewById(R.id.button_recordVideo); buttonRecordVideo.setOnClickListener(this); //12. Capture Interval buttonCaptureInterval = (Button) findViewById(R.id.button_captureinterval); buttonCaptureInterval.setOnClickListener(this); //13. Camera Settings buttonSettings = (Button) findViewById(R.id.button_settings); buttonSettings.setOnClickListener(this); //14. Preview buttonPreview = (Button) findViewById(R.id.button_preview); buttonPreview.setOnClickListener(this); }
From source file:fi.mikuz.boarder.gui.internet.DownloadBoardComments.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.internet_download_comments_list); this.setVolumeControlStream(AudioManager.STREAM_MUSIC); registerForContextMenu(getListView()); Bundle extras = getIntent().getExtras(); XStream xstream = new XStream(); mBoard = (InternetFullBoard) xstream.fromXML(extras.getString(DownloadBoard.BOARD_KEY)); mLoggedIn = extras.getBoolean(DownloadBoardList.LOGGED_IN_KEY); if (mLoggedIn) { mUserId = extras.getString(InternetMenu.USER_ID_KEY); mSessionToken = extras.getString(InternetMenu.SESSION_TOKEN_KEY); }/*from w w w. ja va 2 s. c o m*/ this.setTitle(mBoard.getUploaderUsername() + " - " + mBoard.getBoardName()); mListView = (ListView) findViewById(android.R.id.list); mList = new ArrayList<Comment>(); mMaxResults = 40; refreshList(); Button sendComment = (Button) findViewById(R.id.sendComment); final EditText commentInput = (EditText) findViewById(R.id.commentInput); if (mLoggedIn) { sendComment.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (commentInput.getText().toString().length() > 0) { mWaitDialog = new TimeoutProgressDialog(DownloadBoardComments.this, "Waiting for response", TAG, false); HashMap<String, String> sendList = new HashMap<String, String>(); sendList.put(InternetMenu.BOARD_ID_KEY, Integer.toString(mBoard.getBoardId())); sendList.put(InternetMenu.SESSION_TOKEN_KEY, mSessionToken); sendList.put(InternetMenu.USER_ID_KEY, mUserId); sendList.put(InternetMenu.COMMENT_KEY, commentInput.getText().toString()); commentInput.setText(""); new ConnectionManager(DownloadBoardComments.this, InternetMenu.mCommentURL, sendList); } else { Toast.makeText(DownloadBoardComments.this, "Type your comment...", Toast.LENGTH_LONG) .show(); } } }); } else { commentInput.setHint("Login to comment"); commentInput.setFocusable(false); } getListView().setOnScrollListener(this); }
From source file:com.zbrown.droidsteal.activities.HijackActivity.java
private void selectURL() { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(getString(R.string.changeurl)); alert.setMessage(getString(R.string.customurl)); // Set an EditText view to get user input final EditText inputName = new EditText(this); inputName.setText(HijackActivity.this.webview.getUrl()); alert.setView(inputName);//from ww w . j a v a 2s . c om alert.setPositiveButton("Go", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { HijackActivity.this.webview.loadUrl(inputName.getText().toString()); } }); alert.show(); }
From source file:com.pax.pay.trans.action.activity.InputTransData2Activity.java
/** * //from www. j a va2 s. c o m */ private String process(EditText editText, EInputType inputType, int maxLen, int minLen) { String content = editText.getText().toString().trim(); if (content.length() == 0) { return null; } switch (inputType) { case DATE: if (content.length() != 4) { return ""; } SimpleDateFormat dateFormat = new SimpleDateFormat("MMdd"); try { dateFormat.setLenient(false); dateFormat.parse(content); } catch (Exception e) { return ""; } return content; case NUM: if (content.length() >= minLen && content.length() <= maxLen) { return content; } else { return ""; } case ALPHNUM: if (content.length() >= minLen && content.length() <= maxLen) { if (content.length() < maxLen) { int flag = maxLen1 - content.length(); for (int i = 0; i < flag; i++) { content = "0" + content; } } } else { return ""; } default: break; } return content; }
From source file:de.trier.infsec.koch.droidsheep.activities.HijackActivity.java
private void selectURL() { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(getString(R.string.changeurl)); alert.setMessage(getString(R.string.customurl)); // Set an EditText view to get user input final EditText inputName = new EditText(this); inputName.setText(HijackActivity.this.webview.getUrl()); alert.setView(inputName);/* ww w . j a va2 s. c o m*/ alert.setPositiveButton("Go", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { HijackActivity.this.webview.loadUrl(inputName.getText().toString()); } }); alert.show(); }
From source file:com.dnielfe.manager.dialogs.UnpackDialog.java
@Override public Dialog onCreateDialog(Bundle state) { final Activity a = getActivity(); // Set an EditText view to get user input final EditText inputf = new EditText(a); inputf.setHint(R.string.enter_name); inputf.setText(Browser.mCurrentPath); final AlertDialog.Builder b = new AlertDialog.Builder(a); b.setTitle(R.string.extractto);//from w ww . ja v a 2s .c om b.setView(inputf); b.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { String newpath = inputf.getText().toString(); dialog.dismiss(); if (ext.equals("zip")) { final UnZipTask task = new UnZipTask(a); task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, file.getPath(), newpath); } else if (ext.equals("rar")) { final UnRarTask task = new UnRarTask(a); task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, file.getPath(), newpath); } } }); b.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); return b.create(); }
From source file:com.brodev.socialapp.view.BlogPostNew.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: finish();/*w w w . j av a 2s.c om*/ return true; case R.id.action_post: BlogAddTask addBlogTask = new BlogAddTask(); // get title EditText title = (EditText) this.findViewById(R.id.textTitle); String titleValue = title.getText().toString().trim(); // get content EditText content = (EditText) this.findViewById(R.id.textCotent); String contentValue = content.getText().toString().trim(); // get privacy String privacyValue = privacy.getValue(); // get category getCategoryValue(); if (titleValue.length() <= 0) { Toast.makeText(getApplicationContext(), phraseManage.getPhrase(getApplicationContext(), "blog.fill_title_for_blog"), Toast.LENGTH_LONG).show(); } else if (contentValue.length() <= 0) { Toast.makeText(getApplicationContext(), phraseManage.getPhrase(getApplicationContext(), "blog.add_content_to_blog"), Toast.LENGTH_LONG).show(); } else if (titleValue.length() > 0 && contentValue.length() > 0) { addBlogTask.execute(titleValue, contentValue, categoryValues, privacyValue); } } return super.onOptionsItemSelected(item); }
From source file:com.example.hbranciforte.trafficclient.DataTraffic.java
private JSONObject getPaymentInfo() { JSONObject payment = new JSONObject(); EditText paymentField1 = (EditText) findViewById(R.id.payment_field1); EditText licenseSec = (EditText) findViewById(R.id.payment_security); TextView valor = (TextView) findViewById(R.id.valor); try {/*from w w w .j a va2s . c om*/ payment.put("type", "test_method"); payment.put("data", "{\"data\",\"".concat(paymentField1.getText().toString()).concat("\",\"security\":\"") .concat(licenseSec.getText().toString().concat("\",\"price\":") .concat(Float.toString(price)).concat("}"))); payment.put("price", price); return payment; } catch (JSONException e) { Log.e("json error", e.getMessage()); } return payment; }
From source file:org.silena.main.RegistrationOld.java
public void Registration() { //get phone or validation EditText Regphone = (EditText) findViewById(R.id.regphone); EditText Regcapcha = (EditText) findViewById(R.id.regcapcha); if (Regphone.getText().toString().equals("")) { RenderError(getString(R.string.error_phone)); Log.d(LOG_TAG, "phone: error phone null"); return;// ww w .j a v a2 s . c om } if (Regcapcha.getText().toString().equals("")) { RenderError(getString(R.string.error_capcha)); Log.d(LOG_TAG, "phone: error phone null"); return; } String Phone = Regphone.getText().toString(); String Capcha = Regcapcha.getText().toString(); if (PhoneValid(Phone) != true) { RenderError(getString(R.string.error_phone)); Log.d(LOG_TAG, "phone: error phone regxp"); return; } if (isOnline() == false) { Log.d(LOG_TAG, "phone: no Connect Check Internet"); RenderError(getString(R.string.error_internet)); return; } // Phone ok step 2 Log.d(LOG_TAG, "phone: Filters ok " + Phone); mainvars.setCookies(loadCookie()); mainvars.setUser(Phone); mainvars.setCapcha(Capcha); mainvars.setCode(101); Log.d(LOG_TAG, "mainvars" + mainvars.getCookies()); try { String Result = new DownloadImageTask().execute(SERV_URL).get(); if (Result == "401") { Intent intent = new Intent(this, MainActivity.class); startActivity(intent); this.finish(); } else if (Result == "104") { RenderError(getString(R.string.error_capcha)); capcha(); } } catch (InterruptedException ex) { Logger.getLogger(RegistrationOld.class.getName()).log(Level.SEVERE, null, ex); } catch (ExecutionException ex) { Logger.getLogger(RegistrationOld.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:no.ntnu.idi.socialhitchhiking.map.MapActivityJourney.java
/** * method for sending a message//from www . java 2 s .c o m * @param mid * @param input */ private void sendMessage(User mid, EditText input) { Notification not = new Notification(getApp().getUser().getID(), mid.getID(), getApp().getUser().getFullName(), input.getText().toString(), getApp().getSelectedJourney().getSerial(), NotificationType.MESSAGE, getApp().getSelectedMapRoute().getStartLocation(), getApp().getSelectedMapRoute().getEndLocation(), Calendar.getInstance()); NotificationRequest req = new NotificationRequest(getApp().getUser(), not); try { Response res = RequestTask.sendRequest(req, getApp()); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } }