Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7889029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:59:27+00:00 2026-06-03T05:59:27+00:00

In my application , I have to get date from the user. First I

  • 0

In my application , I have to get date from the user.
First I use one button, when the user clicks the button a dialog box will appear which holds datepicker and get the result in one TextView.
Now I want to replace the button by EditView. On Clicking the EditView the dialog box will have to appear and no keyboards should appear.

@Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.report);
        EmployeeGlobal eg=(EmployeeGlobal)getApplicationContext();
        String uid=eg.getMainUserId();
        ArrayList<String>list=eg.getAllProjects(uid);
          Spinner spinner = (Spinner)findViewById(R.id.all_projs);
          ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list);
          spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
          spinner.setAdapter(spinnerArrayAdapter);
          Toast.makeText(getApplicationContext(), "Report"+uid, Toast.LENGTH_LONG).show();
          mStartDateDisplay=(TextView)findViewById(R.id.strdate);
          mEndDateDisplay = (TextView) findViewById(R.id.enddate);
            mEndDate = (Button) findViewById(R.id.end_dateb);
            mStartDate=(Button)findViewById(R.id.start_dateb);
            mYear=c1.get(Calendar.YEAR);
            mMonth = c1.get(Calendar.MONTH);
            mDay = c1.get(Calendar.DAY_OF_MONTH);
            mStartDate.setOnClickListener(new View.OnClickListener() {

                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    showDialog(DATE_DIALOG_START);

                    //updateDisplay(mStartDateDisplay);
                }
            });
            mEndDate.setOnClickListener(new View.OnClickListener() {

                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    showDialog(DATE_DIALOG_END);
                     //updateDisplay(mEndDateDisplay);
                }
            });


    }
    private void updateDisplay(TextView T) {
        T.setText(
            new StringBuilder()
                    // Month is 0 based so add 1
                    .append(mMonth + 1).append("-")
                    .append(mDay).append("-")
                    .append(mYear).append(" "));
    }
    private DatePickerDialog.OnDateSetListener mFromDateSetListener =
        new DatePickerDialog.OnDateSetListener() {

            public void onDateSet(DatePicker view, int year, 
                                  int monthOfYear, int dayOfMonth) {
                mYear = year;
                mMonth = monthOfYear;
                mDay = dayOfMonth;
                updateDisplay(mStartDateDisplay);

            }
        };
        private DatePickerDialog.OnDateSetListener mToDateSetListener =
            new DatePickerDialog.OnDateSetListener() {

                public void onDateSet(DatePicker view, int year, 
                                      int monthOfYear, int dayOfMonth) {
                    mYear = year;
                    mMonth = monthOfYear;
                    mDay = dayOfMonth;
                    updateDisplay(mEndDateDisplay);

                }
            };
        @Override
        protected Dialog onCreateDialog(int id) {
            switch (id) {
            case DATE_DIALOG_END:
                return new DatePickerDialog(this,mToDateSetListener, mYear, mMonth, mDay);
            case DATE_DIALOG_START:
                return new DatePickerDialog(this,mFromDateSetListener,mYear, mMonth, mDay);
            }
            return null;
        }

So please anyone help me?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T05:59:29+00:00Added an answer on June 3, 2026 at 5:59 am

    I have done exactly same i am posting some code try it. It should work..

    EditText time_text_1;
    time_text_1.setOnTouchListener(new View.OnTouchListener() {
    
         @Override
         public boolean onTouch(View v, MotionEvent event) {
           if (event.getAction() == MotionEvent.ACTION_UP) {
              //CREATE YOUR DATE PICKER DIALOG HERE.
              }
         return false;
         }
        });
    

    declare these properties in your xml file for edittext.

    android:clickable="true"
    android:cursorVisible="false"
    android:editable="false"
    android:inputType="none"
    android:singleLine="true"
    

    hope it will work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For my application, I have to get a date from the user. I have
I have a variable in my Sinatra application: get '/' do @agenda_date = Date.today
I am developing an application in which i have to get data from .xls
I have an application that attempts to get locations settings from the browser, this
I have an application that needs to hit the ActiveDirectory to get user permission/roles
I have a Timestamp value that comes from my application. The user can be
Its about a small android application that will take hours as input from user
In my application I have to get the record form the AddressBook and after
Now that I know C++ I want to get into desktop application that have
I was wondering how to get this to run. In my application I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.