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 8371691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:13:29+00:00 2026-06-09T14:13:29+00:00

I have this code here on the options menu Dialog dialog = new Dialog(ScheduleActivity.this);

  • 0

I have this code here on the options menu

Dialog dialog = new Dialog(ScheduleActivity.this);
dialog.setTitle("Add Event");
dialog.setContentView(R.layout.add_even_on);
Button datePicker = (Button) dialog.findViewById(R.id.datePicker);
final DialogFragment dateFrag = new MyDatePicker();
    datePicker.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                dateFrag.show(getSupportFragmentManager(), "datePicker");               
            }
        });
dialog.show();

when, say “Add Event” on the option menu is clicked, a Dialog appears, with a button that shows a DatePickerDialog and beside it is a TextView that reflects the date chosen in the DatePickerDialog, here is the class I got from Androids Developer on how to use the DatePickerDialog.

class MyDatePicker extends DialogFragment implements DatePickerDialog.OnDateSetListener {
 int pYear;
 int pDay;
 int pMonth;

@Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    // Use the current date as the default date in the picker
    final Calendar c = Calendar.getInstance();
    int year = c.get(Calendar.YEAR);
    int month = c.get(Calendar.MONTH);
    int day = c.get(Calendar.DAY_OF_MONTH);

    // Create a new instance of DatePickerDialog and return it
    return new DatePickerDialog(getActivity(), this, year, month, day);
  }

  public void onDateSet(DatePicker view, int year, int month, int day) {
    pYear = year;
    pDay = day;
    pMonth = month;
  }
}

So my problem is that how do i get the Value in milleseconds when i click “Set” on the DatePickerDialog which in turn automatically closes it, and returns to my Dialog which contains the button which open the DatePickerDialog and a Textview which reflects watever date is chosen the DatePickerDialog… i wont show the one i chose inside the DatePickerDialog…

Here is a picture of what i mean,

So when i click on the Pick Date Button a DatePickerDialog box appears as seen on the next picture
enter image description here

enter image description here

and when i click set, i wanted to take into account the value in millseconds from that DatePickerDialog

  • 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-09T14:13:30+00:00Added an answer on June 9, 2026 at 2:13 pm

    Here I Provide Some Code Hope It Helps You..

    public class NewReminder extends Activity {
    private static final int DATE_DIALOG_ID = 1;
    private int year;
    private int month;
    private int day;
    EditText editTextDate;
    private String currentDate;
    private Context context;
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.addnewreminder);
        initialize();
        context = getApplicationContext();
        OnClickListener listenerDate = new OnClickListener() {
    
            @Override
            public void onClick(View arg0) {
    
                final Calendar c = Calendar.getInstance();
                year = c.get(Calendar.YEAR);
                month = c.get(Calendar.MONTH);
                day = c.get(Calendar.DAY_OF_MONTH);
                showDialog(DATE_DIALOG_ID);
            }
        };
        editTextDate.setOnClickListener(listenerDate);
    
    }
    
    private void initialize() {
        // TODO Auto-generated method stub
    
        editTextDate = (EditText) findViewById(R.id.editTextDate);
    
    }
    
    
    private void updateDisplay() {
        currentDate = new StringBuilder().append(day).append(".")
                .append(month + 1).append(".").append(year).toString();
    
        Log.i("DATE", currentDate);
    }
    
    OnDateSetListener myDateSetListener = new OnDateSetListener() {
    
        @Override
        public void onDateSet(DatePicker datePicker, int i, int j, int k) {
    
            year = i;
            month = j;
            day = k;
            updateDisplay();
            editTextDate.setText(currentDate);
        }
    };
    
    
    
    @Override
    protected Dialog onCreateDialog(int id) {
        switch (id) {
        case DATE_DIALOG_ID:
            return new DatePickerDialog(this, myDateSetListener, year, month,
                    day);
        }
        return null;
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this code right here: <select name=group> <option value=>Choose a group....</option> <?php foreach($groups
I have this code here printf '$request1 = select * from whatever where this
I have this code here, which is intended to allow any type of arguments:
I have this code here, {foreach from=$cart.cartItems item=item name=cart} <div id=cart2Produkt> <p>{if $item.Product.ID} <a
I have this code here: var Person = (function() { var name; var PersonConstructor
So I have this code here: <table> <tr> <td width=200px valign=top> <div class=left_menu> <div
i have this quick issue please. I have this code here which permits me
I have this code down here. When format.js fires I want to serve to
I have this code right here, where the $friends variable is an array with
I have this SQL code here.. SELECT cl.clientid, cl.clientname, cl.billingdate, cp.startdate, cp.expiration, (SELECT COUNT(*)

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.