2

Hello I know this has been answerd but I'm still having problems understanting what to do becasue I'm new to android. I just want to gather some info like a name, phone number, email, address and a date. The problems is that a have to put a ScrollView in order to show all the View, but the DatePicker is really big and I can't scroll down if it's inside a ScrollView

I found this link that solves the problem https://gist.github.com/izmajlowiczl/6633221

The problem is that I don't know how to call that class from my MainActivity. this is my Activity.

package com.example.intel.form;

import android.support.design.widget.TextInputLayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.DatePicker;

public class Main_Activity extends AppCompatActivity {   

    private TextInputLayout name;
    private TextInputLayout number;
    private TextInputLayout email;
    private TextInputLayout address;
    private DatePicker date;   

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_);

        name = (TextInputLayout) findViewById(R.id.name);
        date = (DatePicker) findViewById(R.id.date);
        number = (TextInputLayout) findViewById(R.id.number);
        email = (TextInputLayout) findViewById(R.id.email);
        address = (TextInputLayout) findViewById(R.id.address);

    }
}

I have tried for hours and in many different ways trying to call that method I found on internet.

Any guidance would be appreciated

2 Answers2

2

ty for the help, but i did it modifying the .xml

instead of using

<DatePicker
        android:id="@+id/date"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
</DatePicker>

I changed it to

<YourPakagename.CustomDatePicker
       android:id="@+id/date"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"></YourPakagename.CustomDatePicker>

And thats it

1

Add the CustomDatePicker.java to your project.

Replace occurrences of DatePicker with CustomDatePicker in Main_Activity as follows:

  • private CustomDatePicker date;
  • date = (CustomDatePicker ) findViewById(R.id.date);
Clive Seebregts
  • 2,004
  • 14
  • 18