Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void fetchCalenderEvents() {
- Cursor cur = null;
- ContentResolver cr = getContentResolver();
- cur = cr.query(CalendarContract.Events.CONTENT_URI, EVENT_PROJECTION,
- null, null,null);
- outputText.setText("");
- long currenttime = new Date().getTime();
- //setContentView(R.layout.main);
- while (cur.moveToNext()) {
- StringBuilder strbuldr = new StringBuilder();
- long calID = 0;
- String displayName = null;
- String accountName = null;
- String ownerName = null;
- String name = null;
- long startDate,endDate;
- String eventlocation = null;
- String eventOrganizer = null;
- String strDuration = null;
- // Get the field values
- calID = cur.getLong(PROJECTION_ID_INDEX);
- displayName = cur.getString(PROJECTION_DISPLAY_NAME_INDEX);
- accountName = cur.getString(PROJECTION_ACCOUNT_NAME_INDEX);
- ownerName = cur.getString(PROJECTION_OWNER_ACCOUNT_INDEX);
- name = cur.getString(PROJECTION_EVENT_TITILE);
- startDate = cur.getLong(PROJECTION_EVENT_DTSTART);
- endDate = cur.getLong(PROJECTION_EVENT_DATEEND);
- Format df = DateFormat.getDateFormat(this);
- Format tf = DateFormat.getTimeFormat(this);
- eventlocation = cur.getString(PROJECTION_EVENT_LOC);
- eventOrganizer = cur.getString(PROJECTION_EVENTT_ORGANIZER);
- strDuration = cur.getString(PROJECTION_EVENT_DURATION);
- if(startDate>=currenttime){
- strbuldr.append("Meeting "+name
- +" "
- +"has been Scheduled on date"+df.format(startDate)
- +" time "
- +tf.format(startDate)
- +" for duration "+strDuration);
- outputText.append(strbuldr.toString());
- outputText.append("n");
- if (outputText.getText().toString().trim().length() == 0) {
- Toast.makeText(getApplicationContext(),
- "Please enter your message.", Toast.LENGTH_LONG).show();
- return;
- }
- else{
- speakUSLocale();
- confirmTTSData();
- break;
- }
- }else{
- Log.d(DEBUG_TAG, "Old events");
- }
- }
- cur.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement