Android CalendarView show selected Date after coming back to activity - android

I'm using a CalendarView on my activity, that shows some events on selected date. If an event is clicked, a new activity is started and showing some details of the event. Everything works fine. But if I go back to previous activity, 'today' is selected (it's my default). Is it possible to go back to the date of the event I selected?
Thanks a lot for your help!

Do the one thing when you select date at that time store that date into static variable or anywhere and when you came back to that activity set that day,month and year to that date picker dialog that way you can achieve what you want.

Related

Scrolling between dates in android

I am working on a project where i have to horizontally scroll between dates.I don't want to use a date picker.I would like to have two arrows for previous and next buttons.When i click on the next button the next date should be shown.Also each time a new date is selected i want to call a web service by passing the particular date.How do i go about doing this?
I have considered using a horizontal date picker library but i am not satisfied with the solutions which i am finding on the internet.
You can use ViewPager for the same.

What is the right UI pattern for an optional date?

I am using a DialogFragment to show a DatePicker to choose a date. The point is that such date could be optional, so somewhere i should display a checkbox asking to use the date or not. So how would you do such an UI ?.
So far i tried adding a checkbox on the same DialogFragment but i believe the interaction wont be very intuitive because if you choose the checkbox "no date" i would have to block or disable the datepicker but i wasn't able to do that and even if i do i am not sure if it is the best approach.
Have you seen any application solving a problem like this and how does it solve it ?
Here's how I solved it in my app: make it clear on the button that launches the DialogFragment that a date is optional.
After a date is chosen, add the option to remove it. Clicking on the "x" restores the button to look like above.

Make a Datepicker button look similar to the one in Google calendar app

My app is supposed to have a Datepicker. To invoke the date picker fragment a button is pressed and then the floating date picker appears.
My problem is that the button does not look similar to the rest of the UI components being used to accept data. Is there any way I can make the button look and function like the one in Google calendar app?? The date picker button dynamically displays the date chosen too and would like to have that functionality too.
Picks for reference:
My current button:
The type of button I want to achieve:
I looked around a bit and was able to change the look by putting the following code in the xml code:
style="#android:style/Widget.DeviceDefault.Light.Spinner"
Here is how to add text to the button.

Android DatePicker like Android Calendar app

I am trying to implement an activity where I want the user to put a date information.
I would like it to look like the Android Calendar App. Their button looks like a spinner, but with the selected date (picture 1). When the button is clicked, it opens the Date Picker dialog (picture 2).
http://pineapple.cc/datepicker1.png
http://pineapple.cc/datepicker2.png
Should I use a redesigned button, spinner, textview ?
Thank you a lot for you help
Does the supplied widget not do it for you? Ooops misunderstood question. Disregard.
Edit:
I'm looking at the EditEventView activity in the Calendar app, and they're using a button that launches the DatePicker widget. The setDate() method there does the formatting.

Android: Date Picker using xml layout

i have some problems in using the date picker from xml layout.
in my app when the user clicks a text view a custom dialog box opens. In the layout of the custom dialog box i am showing a date picker which i have place in my xml file. When it appears in the app i want a particular date to be viewed, for example as 01 Jan 1950. Every time it opens it is showing the present date only.
In my dialog box i have a set and cancel buttons. The Cancel button cancels the dialog box where as when i click the Set button i want the current date to be stored to a String.
In another activity of my app in a custom dialog box i want to show a date picker only with the year columns, i dont need the date and month columns. How to get it, please help me friends
Without seeing any code, I just can propose you to use the method init from the DatePicker class. Check this link but basically, in your activity do something like:
myDatePicker = (DatePicker)findViewByID(...);
myDatePicker.init(myYear,myMonth,myDay, myOnDateChangedListener);

Categories

Resources