0

Possible Duplicate:
getDate with Jquery Datepicker

I have a registration page inside that I have birthdate box. I am entering birthdate inside edittext using datepicker. How to catch this and put into web server. Do I need to parse to get integer ?

Community
  • 1
  • 1
user701735
  • 145
  • 1
  • 5
  • 13

2 Answers2

0

Get reference to your EditText and use getText() method to get the text and on How to put into web server,

This can be one of the way. Check this,
Android (Java) Simple Send and receive with Server - Fast Setup Challenge

Community
  • 1
  • 1
sat
  • 40,138
  • 28
  • 93
  • 102
  • i did in that way i used m1PickDate=Integer.parseInt(mPickDate.getText().toString()); but after doing this am getting error unable to parse '1-2-2006 ' as integer – user701735 Apr 12 '11 at 06:13
  • Ya, Why do you want integer of the date !Let it be string , or use simpleDateFormat to store string in Date object. – sat Apr 12 '11 at 06:23
  • how to use simpleDateFormat can you explain it or any code ??? – user701735 Apr 12 '11 at 06:25
  • simple example http://stackoverflow.com/questions/3941357/string-to-date-time-object-in-android , detailed description http://developer.android.com/reference/java/text/SimpleDateFormat.html – sat Apr 12 '11 at 06:35
0

you can try the following, whereby you can get the various components (day, month and year) as integers

final DatePicker datePick = (DatePicker) findViewById(R.id.proposeDate);

int day = datePick.getDayOfMonth();
int month = datePick.getMonth();
int year = datePick.getYear();
thkala
  • 84,049
  • 23
  • 157
  • 201
SagarU
  • 426
  • 4
  • 15
  • but i have not build any xml for this date i have used datepicker its working fine but when i enter the birthdate in edittext and run in logcat i get the response java.text.ParseException: Unparseable date: "2/1/2006 " my questin is how to parse it – user701735 Apr 12 '11 at 09:41
  • You can easily use a DatePicker instead of the editbox. The values will be more manageable (For the EditBox, you will surely have to write a parser excluding the /) – SagarU Apr 12 '11 at 10:36