2

I am trying to set date to edittext.

I am encountering following problems

  1. When ever I open application and first time I click on edit Text, it should directly show the calender but first time I have to click twice.

  2. Secondly, when I have set a date. It makes it editable and you can write anything in it.

  3. I can't make my screen scroll down to the end. How can I make my screen scroll down. I am using Linear Layout xml

How can I solve these issues?

My code:

date.setClickable(true);

         date.setOnClickListener(new View.OnClickListener()
         {
            @Override
            public void onClick(View v) 
            {
               date.setEnabled(true);
                showDialog(DATE_DIALOG_ID);
            }

              });
vaultah
  • 44,105
  • 12
  • 114
  • 143
Muhammad Umar
  • 11,391
  • 21
  • 91
  • 193
  • are you comfortable with javascript? – harry Feb 13 '12 at 07:35
  • have a look at this, i need an urgent answer: http://stackoverflow.com/questions/9248383/retrieve-more-than-one-value-by-json-array-objects – harry Feb 13 '12 at 07:38
  • I am not an expert but i am trying to understand your code :) – Muhammad Umar Feb 13 '12 at 07:47
  • ya thanks umar, i appreciate your help. by onchange event in first combo box control goes to combo1.jsp taking the value a then i am fetching 5 values from db relating to "a". Now how to store it in an array and to get these 5 values in second combo box by javascript written in auto.jsp – harry Feb 13 '12 at 07:52

2 Answers2

0

I am doing the same kind of stuff to set the date of birth. But i am setting a button on Edittext Box and open date picker on click and set it on EditText.if you want To do this
Please try:

<LinearLayout 
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_marginTop="10sp"
    android:layout_height="wrap_content"
     android:weightSum="3"
     >
        <TextView android:layout_width="100sp"  android:layout_weight="1" android:textStyle="bold" android:layout_gravity="center" android:id="@+id/textView2" android:paddingLeft="10sp" android:layout_height="wrap_content" android:text="Date of Birth"></TextView>

         <RelativeLayout
            android:layout_width="match_parent" android:layout_height="wrap_content" >
              <EditText android:layout_height="wrap_content" android:inputType="date" android:focusable="false" android:clickable="false" android:id="@+id/Date_EditText" android:layout_width="180sp" android:layout_marginLeft="20dp" android:layout_marginRight="10dp"/>
              <Button android:layout_width="30sp" android:background="@drawable/arrow" android:layout_height="35sp" android:id="@+id/down_date" android:layout_centerVertical="true" android:layout_alignRight="@+id/Date_EditText"></Button>
        </RelativeLayout>
        </LinearLayout>  

enter image description here

1) you need to double click because on first click it focus to edittext and then onClick method called.
2) By doing the above your EditText is not be editable.
3) Please show your Code.

deepak Sharma
  • 1,641
  • 10
  • 23
0

1- No Idea, 2- use editText.setKeyListener(null); 3- Use scrollView

Muhammad Umar
  • 11,391
  • 21
  • 91
  • 193