How to create events in calender Android - android

Iam trying to create a calender by following the given tutorial http://w2davids.wordpress.com/android-simple-calendar/?blogsub=confirming#subscribe-blog
but i want to add some modification to this code.
my exact need is ,
I have a string array , it contain some dates. i want to mark these dates into my calender
and when i click a particular date ,it will become marked, and when i click again it is unmarked, also i want to get the marked dates.
how this is possible. I am very new in android development... this is my first question in stack overflow .. please encourage me... please give me a solution..

Related

Adding events to caldroid

am new to android. am creating a calendar using cal-droid library. I have set of data`s from the server, and I need to highlight those event dates in the calendar and also upon taping on a particular date, display the list of events for that date in list view below calendar view. Could any one please tell me any references or some sample codes for the same using Cal-droid.
use predefine method in caldroid Lib make sure you are supplying correct Format
dialogCaldroidFragment.setSelectedDates(formatter.parse("yourfromdate"),
formatter.parse("yourtodate"));
or use dialogCaldroidFragment.setBackgroundResourceForDates(formatter.parse("yourfromdate"));
link : https://github.com/roomorama/Caldroid/issues/34

Android: Converting a decimal number to time

Android
Im working on and android application that works out the time it takes to reach a destination.
what I am try to figure out is how to set up the result so the answer can be displayed as hours.minutes.seconds or days.hours.minutes.seconds.
Would I have to set up an array to get a result like this ?
or
Would the above Q be able to slip up the answer?
ie lets say I have an answer of 4.50 (been 4hrs, 30min) would I be able to take the .50 and time it by 0.6 to change the output to 4.30.
or
Can the answer be displayed in a time picker.
ps I have searched this on the forums and google etc. And I have not found and relevent, easy to comprehend answers.
pps Any codes or links would be greatly apprecated thank you.
I think you can use SimpleDateFormat class to do that.
example code:
String datastring="15.32.08"
SimpleDateFormat sf = new SimpleDateFormat("HH.mm.ss");
Date converttoData = sf.parse(datastring);
You can easily do that: First to convert a decimal to string(datastring),second,use upper code.
hope the answer can help u.:)

solution for SQLite function for time difference without java code

Hey please pay attention to solve this problem I know this could be possible but I am not getting the way ..
I am using sqlite in android to store and manipulate the field as shown below in the figure
Figure http://s16.postimage.org/idc13pxdh/image.png
first_start_time,last_start_time,last_end_time are datetime field in SQLite database
I need to get the difference of last_start_time and last_end_time as mean of function so that I don't need to do it programatically
last_end_time = strftime('%Y-%m-%d %H:%M:%S','now','localtime')
last_start_time= strftime('%Y-%m-%d %H:%M:%S','2012-01-27 02:34:56')
,i,e if my firsttime is =2012-06-15 14:54:33
and Endtime is =2012-06-15 14:54:40
then time diff would be like this =00:00:14;
i want to have such difference time like last_end_time -last_start_time
i also want to use trigger to do use in sqlite data base in android
at the last I need that all my total_expended_time should get summed up like ...
select sum(total_expended_time) from study_result
.. one thing keep in mind the result should be in datetime stamp so that i can reflect it to my UI
Any suggestion will be appreciated

Can we added changing image/text on android app

Is there a way in android app that we can add some text or image and we can change that dynamically without adding new version. Like we have this text: Today's deal is: 1
then in a week if i want that text to show as: Today's deal is: 2.
Is there a way to do this, for an app which does not have a server and is stand alone app.
A text or image can be altered during run time; so how you choose to change that is up to you. You would have a simply switch statement depending on the day of the week for your specific example.
TextView tv = (TextView) findViewById(R.yourxml.name);
tv.setText("Monday!");
...
One way I can think of to achieve this is by writing a long value in the shared preferences for a Date object. Each time you start the application we will check if it's been 1 day since the value was saved. Also maintain the different string you want to display as string array in the resources.
I hope it helps...

Android application structure issue

I'm working on application and I need some suggestions which is the best way to code it for Android. Basically it's something like event guide for a few cities. Imagine this :
I have an activity with 7 different buttons (7 different cities) and clicking on one of these buttons I'm opening a new activity where I have all months (January-December) as buttons again. If there is some event in February for example in the chosen city the button will be active and I will go to another activity where I have a list with the events. So my idea is to do it in this way :
Create one Activity with all Cities
Create one Calendar activity with all months.
When user select for example Paris, I'll send an extra via intent with an ID of the chosen city :
intent.putExtra("chosenCity", 2); //something like this
In the Calendar activity I will make active/inactive months buttons depending on that extra sent from Cities activity.
And when user chose a month I will send that chosenCity extra again to the ListViewEvents activity and populate the list view from Database (for example) depending on that extra.
So my question is : is it a good way to build an application like that? Or if it's not, which is the best way to achieve this?
Thanks in advance!
Sounds like you already know pretty much what you need to do. The only thing left is to implement it. The only thing I'll add is that your should probably store all your database and use a CursorAdapter to display them in the ListView. You can store all the events in the database and just create your select statement in such a way that it only selects the events you want to display at any given time. When using this CursorAdapter, I highly recommend you use the CursorLoader.

Categories

Resources