List of usage examples for android.widget EditText getText
@Override
public Editable getText()
From source file:com.dedipower.portal.android.CreateTicket.java
public void onCreate(Bundle savedInstanceState) { API.SessionID = getIntent().getStringExtra("sessionid"); dialog = new ProgressDialog(this); dialog.setMessage("Loading..."); super.onCreate(savedInstanceState); setContentView(R.layout.createticket); final Handler handler = new Handler() { public void handleMessage(Message msg) { dialog.dismiss();//from www.j ava2s. c o m if (TicketID == 0) { Toast.makeText(CreateTicket.this, "Ticket Creation Failed. Please try again later or email request@dedipower.com", Toast.LENGTH_LONG).show(); } else { Toast.makeText(CreateTicket.this, "Ticket Created! Returning to main screen...", Toast.LENGTH_SHORT).show(); finish(); } } }; final Thread submitTicket = new Thread() { public void run() { try { TicketID = API.CreateTicket(Subject, Message); } catch (JSONException e) { TicketID = 0; } handler.sendEmptyMessage(0); } }; Button CreateTicketButton = (Button) findViewById(R.id.CreateTicketButton); CreateTicketButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { dialog.show(); EditText SubjectET = (EditText) findViewById(R.id.Subject); EditText MessageET = (EditText) findViewById(R.id.Message); Subject = SubjectET.getText().toString(); Message = MessageET.getText().toString(); submitTicket.start(); /*EditText Subject = (EditText) findViewById(R.id.Subject); EditText Message = (EditText) findViewById(R.id.Message); try { TicketID = API.CreateTicket(Subject.getText().toString() , Message.getText().toString()); } catch (JSONException e) { Toast.makeText(CreateTicket.this, "Ticket Creation Failed. Please try again later or email request@dedipower.com", Toast.LENGTH_LONG).show(); } if(TicketID == 0) { Toast.makeText(CreateTicket.this, "Ticket Creation Failed. Please try again later or email request@dedipower.com", Toast.LENGTH_LONG).show(); } else { Toast.makeText(CreateTicket.this, "Ticket Created! Returning to main screen...", Toast.LENGTH_SHORT).show(); finish(); }*/ } }); }
From source file:net.networksaremadeofstring.pulsant.portal.CreateTicket.java
public void onCreate(Bundle savedInstanceState) { API.SessionID = getIntent().getStringExtra("sessionid"); dialog = new ProgressDialog(this); dialog.setMessage("Loading..."); super.onCreate(savedInstanceState); setContentView(R.layout.createticket); final Handler handler = new Handler() { public void handleMessage(Message msg) { dialog.dismiss();// w ww . j a va 2 s .c o m if (TicketID == 0) { Toast.makeText(CreateTicket.this, "Ticket Creation Failed. Please try again later or email request@Pulsant.com", Toast.LENGTH_LONG).show(); } else { Toast.makeText(CreateTicket.this, "Ticket Created! Returning to main screen...", Toast.LENGTH_SHORT).show(); finish(); } } }; final Thread submitTicket = new Thread() { public void run() { try { TicketID = API.CreateTicket(Subject, Message); } catch (JSONException e) { TicketID = 0; } handler.sendEmptyMessage(0); } }; Button CreateTicketButton = (Button) findViewById(R.id.CreateTicketButton); CreateTicketButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { dialog.show(); EditText SubjectET = (EditText) findViewById(R.id.Subject); EditText MessageET = (EditText) findViewById(R.id.Message); Subject = SubjectET.getText().toString(); Message = MessageET.getText().toString(); submitTicket.start(); /*EditText Subject = (EditText) findViewById(R.id.Subject); EditText Message = (EditText) findViewById(R.id.Message); try { TicketID = API.CreateTicket(Subject.getText().toString() , Message.getText().toString()); } catch (JSONException e) { Toast.makeText(CreateTicket.this, "Ticket Creation Failed. Please try again later or email request@Pulsant.com", Toast.LENGTH_LONG).show(); } if(TicketID == 0) { Toast.makeText(CreateTicket.this, "Ticket Creation Failed. Please try again later or email request@Pulsant.com", Toast.LENGTH_LONG).show(); } else { Toast.makeText(CreateTicket.this, "Ticket Created! Returning to main screen...", Toast.LENGTH_SHORT).show(); finish(); }*/ } }); }
From source file:com.chess.genesis.activity.LoginFrag.java
@Override public void onClick(final View v) { switch (v.getId()) { case R.id.login: progress.setText("Requesting Login"); EditText txt = (EditText) act.findViewById(R.id.username); final String username = txt.getText().toString().trim(); txt = (EditText) act.findViewById(R.id.password); final String password = txt.getText().toString(); net.login_user(username, password); new Thread(net).start(); break;// ww w .j av a 2s .c om case R.id.register: if (isTablet) { final FragmentIntent fintent = new FragmentIntent(act); fintent.setFrag(R.id.panel02, new RegisterFrag()); fintent.loadFrag(fragMan); } else { startActivityForResult(new Intent(act, Register.class), Enums.REGISTER); } break; case R.id.menu: openMenu(v); break; } }
From source file:at.bitfire.davdroid.ui.CreateCalendarActivity.java
public void onCreateCollection(MenuItem item) { boolean ok = true; CollectionInfo info = new CollectionInfo(); Spinner spinner = (Spinner) findViewById(R.id.home_sets); String homeSet = (String) spinner.getSelectedItem(); EditText edit = (EditText) findViewById(R.id.display_name); info.displayName = edit.getText().toString(); if (TextUtils.isEmpty(info.displayName)) { edit.setError(getString(R.string.create_collection_display_name_required)); ok = false;/*from w w w.j a v a 2 s.com*/ } edit = (EditText) findViewById(R.id.description); info.description = StringUtils.trimToNull(edit.getText().toString()); View view = findViewById(R.id.color); info.color = ((ColorDrawable) view.getBackground()).getColor(); spinner = (Spinner) findViewById(R.id.time_zone); net.fortuna.ical4j.model.TimeZone tz = DateUtils.tzRegistry.getTimeZone((String) spinner.getSelectedItem()); if (tz != null) { Calendar cal = new Calendar(); cal.getComponents().add(tz.getVTimeZone()); info.timeZone = cal.toString(); } RadioGroup typeGroup = (RadioGroup) findViewById(R.id.type); switch (typeGroup.getCheckedRadioButtonId()) { case R.id.type_events: info.supportsVEVENT = true; break; case R.id.type_tasks: info.supportsVTODO = true; break; case R.id.type_events_and_tasks: info.supportsVEVENT = true; info.supportsVTODO = true; break; } if (ok) { info.type = CollectionInfo.Type.CALENDAR; info.url = HttpUrl.parse(homeSet).resolve(UUID.randomUUID().toString() + "/").toString(); CreateCollectionFragment.newInstance(account, info).show(getSupportFragmentManager(), null); } }
From source file:asu.edu.msse.gpeddabu.moviedescriptions.AddMovie.java
public void onAddButtonClick(View view) throws JSONException { // Adding movie title EditText tempText = (EditText) findViewById(R.id.titleET); String title = tempText.getText().toString(); // Adding movie Year tempText = (EditText) findViewById(R.id.yearET); String year = tempText.getText().toString(); // Adding movie Rated tempText = (EditText) findViewById(R.id.ratedET); String rated = tempText.getText().toString(); // Adding movie Released On tempText = (EditText) findViewById(R.id.releasedOnET); String released = tempText.getText().toString(); // Adding movie Runtime tempText = (EditText) findViewById(R.id.runtimeET); String runtime = tempText.getText().toString(); // Adding movie Genre String genre = (String) spinner.getSelectedItem(); // Adding movie Actors tempText = (EditText) findViewById(R.id.actorsET); String actors = tempText.getText().toString(); // Adding movie plot tempText = (EditText) findViewById(R.id.plotET); String plot = tempText.getText().toString(); // Adding movie poster url tempText = (EditText) findViewById(R.id.posterET); String poster = tempText.getText().toString(); try {// ww w. j a v a2 s . co m MovieDB db = new MovieDB(con); SQLiteDatabase crsDB = db.openDB(); crsDB.execSQL("insert into movie values(?,?,?,?,?,?,?,?,?);", new String[] { title, year, rated, released, runtime, genre, actors, plot, poster }); crsDB.close(); db.close(); } catch (Exception ex) { android.util.Log.w(this.getClass().getSimpleName(), "Exception adding movie info: " + ex.getMessage()); } Intent ni = new Intent(this, MainActivity.class); startActivity(ni); }
From source file:com.emorym.android_pusher.DeprecatedPusherSampleActivity.java
/** Called when the activity is first created. */ @Override//from ww w . java 2 s.c om public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContext = this; setContentView(R.layout.main); // This Handler is going to deal with incoming messages mHandler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); Bundle bundleData = msg.getData(); if (bundleData.getString("type").contentEquals("pusher")) { try { JSONObject message = new JSONObject(bundleData.getString("message")); Log.d("Pusher Message", message.toString()); Toast.makeText(mContext, message.toString(), Toast.LENGTH_SHORT).show(); } catch (Exception e) { e.printStackTrace(); } } } }; mPusher = new Pusher(mHandler); mPusher.connect(PUSHER_APP_KEY); // Setup some toggles to subscribe/unsubscribe from our 2 test channels final ToggleButton test1 = (ToggleButton) findViewById(R.id.toggleButton1); final ToggleButton test2 = (ToggleButton) findViewById(R.id.toggleButton2); final Button send = (Button) findViewById(R.id.send_button); test1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (test1.isChecked()) mPusher.subscribe(PUSHER_CHANNEL_1); else mPusher.unsubscribe(PUSHER_CHANNEL_1); } }); test2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (test2.isChecked()) mPusher.subscribe(PUSHER_CHANNEL_2); else mPusher.unsubscribe(PUSHER_CHANNEL_2); } }); send.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { EditText channelName = (EditText) findViewById(R.id.channel_name); EditText eventName = (EditText) findViewById(R.id.event_name); EditText eventData = (EditText) findViewById(R.id.event_data); try { JSONObject data = new JSONObject(); data.put("data", eventData.getText().toString()); mPusher.send(eventName.getText().toString(), data, channelName.getText().toString()); } catch (Exception e) { e.printStackTrace(); } } }); }
From source file:eu.cyberkat.h2owirelessbalancecheck.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Button button = (Button) this.findViewById(R.id.button1); final ProgressBar pb = getMyProgBar(); pb.setMax(100);//from w ww .ja va 2 s.co m final AutoScaleTextView text1 = (AutoScaleTextView) this.findViewById(R.id.textView2); final TextView text2 = (TextView) this.findViewById(R.id.textView3); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { text1.setVisibility(View.VISIBLE); text2.setVisibility(View.GONE); Scaling = true; } else { text1.setVisibility(View.GONE); text2.setVisibility(View.VISIBLE); Scaling = false; } button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final EditText phonenum = getPhoneNum(); String number = phonenum.getText().toString(); new GrabTheBalance().execute(number); } }); }
From source file:com.nextgis.mobile.map.LocalGeoJsonLayer.java
protected static void showPropertiesDialog(final MapBase map, final boolean bCreate, String layerName, final Uri uri, final LocalGeoJsonLayer layer) { final LinearLayout linearLayout = new LinearLayout(map.getContext()); final EditText input = new EditText(map.getContext()); input.setText(layerName);/*from www . j a v a 2 s .c o m*/ final TextView stLayerName = new TextView(map.getContext()); stLayerName.setText(map.getContext().getString(R.string.layer_name) + ":"); linearLayout.setOrientation(LinearLayout.VERTICAL); linearLayout.addView(stLayerName); linearLayout.addView(input); if (!bCreate) { //TODO: style for drawing } new AlertDialog.Builder(map.getContext()) .setTitle(bCreate ? R.string.input_layer_properties : R.string.change_layer_properties) // .setMessage(message) .setView(linearLayout).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { if (bCreate) { create(map, input.getText().toString(), uri); } else { layer.setName(input.getText().toString()); map.onLayerChanged(layer); } } }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // Do nothing. Toast.makeText(map.getContext(), R.string.error_cancel_by_user, Toast.LENGTH_SHORT).show(); } }).show(); }
From source file:com.example.hbranciforte.trafficclient.DataTraffic.java
public void lunchResume(View view) throws JSONException, IOException { if (validate_form()) { JSONObject payment = getPaymentInfo(); JSONObject zone = getZoneInfo(); JSONObject device = getDeviceinfo(); JSONObject car = getCarInfo();// w w w . j a va 2 s . c om JSONObject parking = new JSONObject(); EditText parkingCoins = (EditText) findViewById(R.id.fichas); parking.put("parking_units", Integer.valueOf(parkingCoins.getText().toString())); parking.put("zone", zone); parking.put("device", device); parking.put("car", car); parking.put("payment", payment); DefaultHttpClient httpclient = new DefaultHttpClient(); //HttpPost httppostreq = new HttpPost("http://10.0.2.2:3000/parkings"); HttpPost httppostreq = new HttpPost("http://45.55.79.197/parkings"); StringEntity se = new StringEntity(parking.toString()); httppostreq.setHeader("Content-type", "application/json"); httppostreq.setEntity(se); HttpResponse httpresponse = httpclient.execute(httppostreq); if (httpresponse.getStatusLine().getStatusCode() == 200) { Intent intent = new Intent(this, Resume.class); String responseString = new BasicResponseHandler().handleResponse(httpresponse); intent.putExtra("response", responseString); intent.putExtra("data", parking.toString()); startActivity(intent); } } }
From source file:com.chess.genesis.activity.LoginFrag.java
private void handleNetwork(final Message msg) { final JSONObject json = (JSONObject) msg.obj; try {//from ww w . j a v a2s . c o m if (json.getString("result").equals("error")) { exitActivity = false; progress.remove(); Toast.makeText(act, "ERROR:\n" + json.getString("reason"), Toast.LENGTH_LONG).show(); return; } } catch (final JSONException e) { throw new RuntimeException(e.getMessage(), e); } switch (msg.what) { case NetworkClient.LOGIN: progress.setText("Syncing Data"); EditText txt = (EditText) act.findViewById(R.id.username); final String username = txt.getText().toString().trim(); txt = (EditText) act.findViewById(R.id.password); final String password = txt.getText().toString(); final PrefEdit pref = new PrefEdit(act); pref.putBool(R.array.pf_isLoggedIn, true); pref.putString(R.array.pf_username, username); pref.putString(R.array.pf_passhash, password); pref.commit(); SocketClient.getInstance().setIsLoggedIn(true); final SyncClient sync = new SyncClient(act, handle); sync.setSyncType(SyncClient.FULL_SYNC); new Thread(sync).start(); break; case SyncClient.MSG: // start background notifier act.startService(new Intent(act, GenesisNotifier.class)); final GameDataDB db = new GameDataDB(act); db.recalcYourTurn(); db.close(); sendResult(Activity.RESULT_OK); progress.dismiss(); break; } }