SMS not deleted - android

I have a code to delete the SMS messages in the outbox with android, but why SMS messages are not deleted ..
delete.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
Dialogs.showConfirmation(LookSms.this,"Are you sure?",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int which) {
Intent i = getIntent();
String id_delete_sms = i.getStringExtra("protocol");
String id_delete_thread = i.getStringExtra("address");
// hapus pesan
Uri deleteUri = Uri.parse("content://sms");
getContentResolver().delete(deleteUri,"thread_id=? and protocol=?",
new String[] {String.valueOf(id_delete_thread),String.valueOf(id_delete_sms) });
finish();
Toast.makeText(LookSms.this,"SMS deleted", Toast.LENGTH_SHORT).show();
}
});

hey use this code to delete customize sms 1. By date 2. By number 3. By body
try {
Uri uriSms = Uri.parse("content://sms/inbox");
Cursor c = context.getContentResolver().query(
uriSms,
new String[] { "_id", "thread_id", "address", "person",
"date", "body" }, "read=0", null, null);
if (c != null && c.moveToFirst()) {
do {
long id = c.getLong(0);
long threadId = c.getLong(1);
String address = c.getString(2);
String body = c.getString(5);
String date = c.getString(3);
Log.e("log>>>",
"0--->" + c.getString(0) + "1---->" + c.getString(1)
+ "2---->" + c.getString(2) + "3--->"
+ c.getString(3) + "4----->" + c.getString(4)
+ "5---->" + c.getString(5));
Log.e("log>>>", "date" + c.getString(0));
ContentValues values = new ContentValues();
values.put("read", true);
getContentResolver().update(Uri.parse("content://sms/"),
values, "_id=" + id, null);
if (message.equals(body) && address.equals(number)) {
// mLogger.logInfo("Deleting SMS with id: " + threadId);
context.getContentResolver().delete(
Uri.parse("content://sms/" + id), "date=?",
new String[] { c.getString(4) });
Log.e("log>>>", "Delete success.........");
}
} while (c.moveToNext());
}
} catch (Exception e) {
Log.e("log>>>", e.toString());
}

Related

Delete sms from another activity Android

I access all sms using ("content://sms/inbox") in my custom list view currently i am getting address body and _id now i want to delete selected sms from another activity please guide me i am beginner in andorid
this is my Mainactivity but i want to delete seleted sms from another activity
Uri uri = Uri.parse("content://sms/");
ContentResolver contentResolver = getContentResolver();
Cursor cursor = contentResolver.query(uri, null, null, null, null, null);
if(cursor !=null && cursor.moveToFirst()){
do{
// name = getContactName(address);
tid= cursor.getString(cursor.getColumnIndexOrThrow("_id"));
address = cursor.getString(cursor.getColumnIndexOrThrow("address"));
body = cursor.getString(cursor.getColumnIndexOrThrow("body"));
if(name==null) {
list.add(new mybean("" + address, "" + body,""+tid));
}
else{
list.add(new mybean("" + name, "" + body,""+tid));
}
my =new myadapter(this,list);
lv.setAdapter(my);
}while(cursor.moveToNext());
}
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> adapterView, View view, int pos, long l) {
Intent intent =new Intent(MainActivity.this,Main2Activity.class);
intent.putExtra("delete",list.get(pos).getDel());
intent.putExtra("sms",list.get(pos).getNumber());
intent.putExtra("smsmsg",list.get(pos).getMsg());
startActivity(intent);
}
});
Here is the quide to how to delete sms
Deleting Android SMS programmatically
For kitkat
https://android-developers.googleblog.com/2013/10/getting-your-sms-apps-ready-for-kitkat.html
First you should choose your app as default sms app then you can delete or remove sms from there..
You can also refer to this post
How to delete an SMS from the inbox in Android programmatically?
here is the tutorial for deleting sms programmatically
http://wisdomitsol.com/blog/android/sms/programmatically-delete-sms-in-android
i hope you find these post helpful if any problem you can comment here.
1.First Add permission in manifest
2. write the method
public boolean deleteSms(String smsId) {
boolean isSmsDeleted = false;
try {
mActivity.getContentResolver().delete(
Uri.parse("content://sms/" + smsId), null, null);
isSmsDeleted = true;
} catch (Exception ex) {
isSmsDeleted = false;
}
return isSmsDeleted;
}
you can now delete sms byIds
You can also try this code
try {
Uri uriSms = Uri.parse("content://sms/inbox");
Cursor c = context.getContentResolver().query(
uriSms,
new String[] { "_id", "thread_id", "address", "person",
"date", "body" }, "read=0", null, null);
if (c != null && c.moveToFirst()) {
do {
long id = c.getLong(0);
long threadId = c.getLong(1);
String address = c.getString(2);
String body = c.getString(5);
String date = c.getString(3);
Log.e("log>>>",
"0--->" + c.getString(0) + "1---->" + c.getString(1)
+ "2---->" + c.getString(2) + "3--->"
+ c.getString(3) + "4----->" + c.getString(4)
+ "5---->" + c.getString(5));
Log.e("log>>>", "date" + c.getString(0));
ContentValues values = new ContentValues();
values.put("read", true);
getContentResolver().update(Uri.parse("content://sms/"),
values, "_id=" + id, null);
if (message.equals(body) && address.equals(number)) {
// mLogger.logInfo("Deleting SMS with id: " + threadId);
context.getContentResolver().delete(
Uri.parse("content://sms/" + id), "date=?",
new String[] { c.getString(4) });
Log.e("log>>>", "Delete success.........");
}
} while (c.moveToNext());
}
} catch (Exception e) {
Log.e("log>>>", e.toString());
}

android: push sms As recieved in inbox using getContentResolver

on sms received , i have saved that sms in my database
now i want to move that sms into inbox
i used this code but it move it as sent by me
please help me to move it as a received sms
ListViewLogItem lm = listArray.get(position);
long datein = Long.parseLong(lm.getInboxTime());
Uri uri = Uri.parse("content://sms/");
ContentValues cv2 = new ContentValues();
cv2.put("address","+"+lm.getNumber());
cv2.put("date", datein);
cv2.put("read", 1);
cv2.put("type", 2);
cv2.put("body", lm.getSms());
getContentResolver().insert(Uri.parse("content://sms/inbox"), cv2);
Change:
cv2.put("type", 2);
To:
cv2.put("type", 1);
Because:
public static final int MESSAGE_TYPE_INBOX = 1;
public static final int MESSAGE_TYPE_SENT = 2;
You can use following method for deleting SMS from Inbox,
private void deleteMessage()
{
Cursor c = getContentResolver().query(SMS_INBOX, null, null, null, null);
//c.moveToFirst();
while (c.moveToNext())
{
System.out.println("Inside if loop");
try
{
String address = c.getString(2);
String MobileNumber = mainmenu.getParameterData().getMobileNumber().trim();
//Log.i( LOGTAG, MobileNumber + "," + address );
Log.i( LOGTAG, c.getString(2) );
if ( address.trim().equals( MobileNumber ) )
{
String pid = c.getString(1);
String uri = "content://sms/conversations/" + pid;
getContentResolver().delete(Uri.parse(uri), null, null);
stopSelf();
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
Use thisvalues.put("status", SmsManager.STATUS_ON_ICC_UNREAD); . Status can be anything like read/unread/seen. I have keep it as unread.
Look at Message status
values.put("read", true); // As Read
and
values.put("read", false); // As Un Read
public class Message {
final Uri SMS_INBOX = Uri.parse("content://sms/inbox");
#SuppressWarnings("unused")
private ContentResolver resolver;
public Message(ContentResolver ConResolver){
resolver = ConResolver;
}
public String getMessage(int batas) {
Cursor cur = resolver.query(SMS_INBOX, null, null, null,null);
String sms = "Message >> \n";
int hitung = 0;
while (cur.moveToNext()) {
sms += "From :" + cur.getString(2) + " : " + cur.getString(11)+"\n";
if(hitung == batas)
break;
hitung++;
}
return sms;
}
public int getMessageCountUnread(){
Cursor c = resolver.query(SMS_INBOX, null, "read = 0", null, null);
int unreadMessagesCount = c.getCount();
c.deactivate();
return unreadMessagesCount;
}
public String getMessageAll(){
Cursor cur = resolver.query(SMS_INBOX, null, null, null,null);
String sms = "Message >> \n";
while (cur.moveToNext()) {
sms += "From :" + cur.getString(2) + " : " + cur.getString(11)+"\n";
}
return sms;
}
public String getMessageUnread() {
Cursor cur = resolver.query(SMS_INBOX, null, null, null,null);
String sms = "Message >> \n";
int hitung = 0;
while (cur.moveToNext()) {
sms += "From :" + cur.getString(2) + " : " + cur.getString(11)+"\n";
if(hitung == getMessageCountUnread())
break;
hitung++;
}
return sms;
}
public void setMessageStatusRead() {
ContentValues values = new ContentValues();
values.put("read",true);
resolver.update(SMS_INBOX,values, "_id="+SmsMessageId, null);
}
}

Delete all messages from number

I want delete all messages (in, out, draft, ....) from a number.
My code is:
public void deleteAllMessages(String number) {
Cursor cursor = context.getContentResolver().query(SMS_URI_ALL,
new String[] { "_id", "address" }, null, null, null);
int x = 0;
while (cursor.moveToNext()) {
int id = cursor.getInt(0);
String address = cursor.getString(1);
if (address.equals(number)) {
int delete = context.getContentResolver().delete(SMS_URI_ALL,
"_id=" + id, null);
x++;
}
}
Log.i(getClass().getName(), "For:" + number + " delete MSG: " + x);
}
EDIT:
I try with
I try with `context.getContentResolver().delete(Uri.parse("content://sms/" + id), null, null);`
But the same result...
The count of x is right but nothing it is deleted! Why?
How can I do for delete all messages of a number?
The version of Android what I use is 4.4.2 powered by Nexus 4.
I am working on same project i used abortBroadcast() it did not delete the sms but it stops to broadcast to another receiver
Uri uriSms = Uri.parse("content://sms/inbox");
Cursor c = context.getContentResolver().query(
uriSms,
new String[] { "_id", "thread_id", "address", "person",
"date", "body" }, "read=0", null, null);
if (c != null && c.moveToFirst()) {
do {
long id = c.getLong(0);
long threadId = c.getLong(1);
String address = c.getString(2);
String body = c.getString(5);
String date = c.getString(3);
Log.e("log>>>",
"0>" + c.getString(0) + " 1>" + c.getString(1)
+ " 2>" + c.getString(2) + " 3>"
+ c.getString(3) + " 4>" + c.getString(4)
+ " 5>" + c.getString(5));
if (message.equals(body) && address.equals(number)) {
this.abortBroadcast();
}
} while (c.moveToNext());
}

How to Delete last received SMS from inbox in Android

I am developing an Android app in which I want to replace message body of last received SMS with some new text.
I am using BroadcastReceiver in which I want to store the message body of last received SMS in a variable and delete the SMS from inbox and Now after deletion I want to put a new encoded message in the inbox.
Now the issue that I am facing is how to delete last received SMS from inbox. I have developed some code in this respect but It delete second last(previous) SMS from inbox. Please check my code below and help that I could continue my app, I would be very thankful to you for this act of kindness.
public void deleteLastSMS()
{
// abortBroadcast();
String body = null;
String num = null;
try
{
Uri uri = Uri.parse("content://sms/inbox");
Cursor c =contex.getContentResolver().query(uri, null, null ,null,null);
if(c.moveToFirst())
{
body = c.getString(c.getColumnIndexOrThrow("body")).toString();
num = c.getString(c.getColumnIndexOrThrow("address")).toString();
}
int id = c.getInt(0);
int thread_id = c.getInt(1);
Uri thread = Uri.parse( "content://sms");
contex.getContentResolver().delete( thread, "thread_id=? and _id=?", new String[]{String.valueOf(thread_id), String.valueOf(id)} );
}
catch(CursorIndexOutOfBoundsException ee)
{
}
}
I've been looking at this since past hour, this is the stuff i found by far, hop i help :)
void deleteMessage(Context context){
Uri uriSms = Uri.parse("content://sms/inbox");
Cursor c = context.getContentResolver().query(uriSms, null,null,null,null);
int id = c.getInt(0);
int thread_id = c.getInt(1); //get the thread_id
context.getContentResolver().delete(Uri.parse("content://sms/conversations/" + thread_id),null,null);
}
void deleteSMS(Context context){
Uri deleteUri = Uri.parse("content://sms");
context.getContentResolver().delete(deleteUri, "address=? and date=?", new String[] {strMessageFrom,strTimeStamp});
}
public void deleteSMS1(Context context, String message, String number) {
try {
Uri uriSms = Uri.parse("content://sms/inbox");
Cursor c = context.getContentResolver().query(
uriSms,
new String[] { "_id", "thread_id", "address", "person",
"date", "body" }, "read=0", null, null);
if (c != null && c.moveToFirst()) {
do {
long id = c.getLong(0);
long threadId = c.getLong(1);
String address = c.getString(2);
String body = c.getString(5);
String date = c.getString(3);
Log.e("log>>>",
"0>" + c.getString(0) + "1>" + c.getString(1)
+ "2>" + c.getString(2) + "<-1>"
+ c.getString(3) + "4>" + c.getString(4)
+ "5>" + c.getString(5));
Log.e("log>>>", "date" + c.getString(0));
if (message.equals(body) && address.equals(number)) {
// mLogger.logInfo("Deleting SMS with id: " + threadId);
context.getContentResolver().delete(
Uri.parse("content://sms/" + id), "date=?",
new String[] { c.getString(4) });
Log.e("log>>>", "Delete success.........");
}
} while (c.moveToNext());
}
} catch (Exception e) {
Log.e("log>>>", e.toString());
}
}

Retrieving Data of last added event from android calendar

I want to retrive the data of last added event from android calendar. I am using this code to get last id.
public static long getNewEventId(ContentResolver cr, Uri cal_uri)
{
Uri local_uri = cal_uri;
if (cal_uri == null)
{
local_uri = Uri.parse("content://com.android.calendar/events");
}
Cursor cursor = cr.query(local_uri,
new String[] { "MAX(_id) as max_id" }, null, null, "_id");
cursor.moveToFirst();
long max_val = cursor.getLong(cursor.getColumnIndex("max_id"));
return max_val + 1;
}
And then I simply add an event using this code:
Intent intent = new Intent(Intent.ACTION_EDIT);
intent.setType("vnd.android.cursor.item/event");
intent.putExtra("beginTime", SelectedDate);
intent.putExtra("allDay", false);
intent.putExtra("rrule", "FsREQ=DAILY");
intent.putExtra("endTime", SelectedDate + 60 * 60 * 1000);
intent.putExtra("title", "Advance Scheduler Event");
startActivity(intent);
After this I simply retrieve the data of this event using this code:
public CalendarData EventDetails(int ID)
{
CalendarData temp = null;
// -------------------------------------------------------------------------------
ContentResolver cr = getContentResolver();
Cursor cursor_calendar;
if (Integer.parseInt(Build.VERSION.SDK) >= 8)
{
cursor_calendar = cr.query(
Uri.parse("content://com.android.calendar/calendars"),
new String[] { "_id", "displayname" }, null, null, null);
}
else
{
cursor_calendar = cr.query(
Uri.parse("content://calendar/calendars"), new String[] {
"_id", "displayname" }, null, null, null);
}
cursor_calendar.moveToFirst();
String[] CalNamess = new String[cursor_calendar.getCount()];
int[] CalIdss = new int[cursor_calendar.getCount()];
for (int i = 0; i < CalNamess.length; i++)
{
CalIdss[i] = cursor_calendar.getInt(0);
CalNamess[i] = cursor_calendar.getString(1);
cursor_calendar.moveToNext();
}
cursor_calendar.close();
// -------------------------------------------------------------------------------
Cursor cursor_event;
if (Integer.parseInt(Build.VERSION.SDK) >= 8)
{
cursor_event = cr.query(
Uri.parse("content://com.android.calendar/events"),
new String[] { "calendar_id", "title", "description",
"dtstart", "dtend", "eventLocation" }, null, null,
null);
}
else
{
cursor_event = cr.query(Uri.parse("content://calendar/events"),
new String[] { "calendar_id", "title", "description",
"dtstart", "dtend", "eventLocation" }, null, null,
null);
}
boolean flag = false;
String add = null;
cursor_event.moveToFirst();
String[] CalNames = new String[cursor_event.getCount()];
int[] CalIds = new int[cursor_event.getCount()];
for (int i = 0; i < CalNames.length; i++)
{
CalIds[i] = cursor_event.getInt(0);
if (ID == CalIds[i])
{
flag = true;
Toast.makeText(getApplicationContext(),
"ID Found : " + CalIds[i], Toast.LENGTH_LONG).show();
CalNames[i] = "Event"
+ cursor_event.getInt(0)
+ ": \nTitle: "
+ cursor_event.getString(1)
+ "\nDescription: "
+ cursor_event.getString(2)
+ "\nStart Date: "
+ cursor_event.getLong(cursor_event
.getColumnIndex("dtstart"))
+ cursor_event.getLong(cursor_event
.getColumnIndex("dtend"))
+ cursor_event.getString(5);
temp = new CalendarData();
temp.Title = cursor_event.getString(1);
temp.Description = cursor_event.getString(2);
// temp.StartDate = new Date(cursor_event.getLong(3));
// temp.EndDate = new Date(cursor_event.getLong(4));
temp.StartDate = cursor_event.getLong(cursor_event
.getColumnIndex("dtstart"));
temp.EndDate = cursor_event.getLong(cursor_event
.getColumnIndex("dtend"));
temp.Location = cursor_event.getString(5);
break;
}
cursor_event.moveToNext();
}
return temp;
}
But I can't get the data of this event. I am not getting where is the problem. Please, help me to solve this.
use this code. its working in my aap
public long GetMaxID(ContentResolver cr, Uri cal_uri, Context context)
{
Uri local_uri = cal_uri;
if (cal_uri == null)
{
// local_uri = Uri.parse("content://calendar/calendars/" +
// "events");
local_uri = Uri.parse("content://com.android.calendar/events");
}
Cursor cursor = cr.query(local_uri, new String[]
{ "MAX(_id) as max_id" }, null, null, "_id");
cursor.moveToFirst();
long max_val = cursor.getLong(cursor.getColumnIndex("max_id"));
return max_val + 1;
}
public static CalendarData GetEventDetails(String ID, Context context)
{
CalendarData temp = null;
ContentResolver contentResolver = context.getContentResolver();
// Fetch a list of all calendars synced with the device, their display
// names and whether the
cursor = contentResolver.query(
Uri.parse("content://com.android.calendar/calendars"),
(new String[]
{ "_id", "displayName", "selected" }), null, null, null);
HashSet<String> calendarIds = new HashSet<String>();
try
{
System.out.println("Count=" + cursor.getCount());
if (cursor.getCount() > 0)
{
System.out
.println("the control is just inside of the cursor.count loop");
while (cursor.moveToNext())
{
String _id = cursor.getString(0);
String displayName = cursor.getString(1);
Boolean selected = !cursor.getString(2).equals("0");
System.out.println("Id: " + _id + " Display Name: "
+ displayName + " Selected: " + selected);
calendarIds.add(_id);
}
}
}
catch (AssertionError ex)
{
ex.printStackTrace();
}
catch (Exception e)
{
e.printStackTrace();
}
// For each calendar, display all the events from the previous week to
// the end of next week.
// for (String id : calendarIds)
for (int id = 0; id <= calendarIds.size(); id++)
{
Uri.Builder builder = Uri.parse(
"content://com.android.calendar/instances/when")
.buildUpon();
// Uri.Builder builder =
// Uri.parse("content://com.android.calendar/calendars").buildUpon();
long now = new Date().getTime();
ContentUris
.appendId(builder, now - DateUtils.DAY_IN_MILLIS * 10000);
ContentUris
.appendId(builder, now + DateUtils.DAY_IN_MILLIS * 10000);
Cursor eventCursor = contentResolver.query(builder.build(),
new String[]
{ "_id", "title", "begin", "end", "allDay" },
"Calendars._id=" + id, null, null);
System.out.println(id + " eventCursor count="
+ eventCursor.getCount());
if (eventCursor.getCount() > 0)
{
eventCursor.moveToFirst();
while (eventCursor.moveToNext())
{
Object mbeg_date, beg_date, beg_time, end_date, end_time;
final String eventID = eventCursor.getString(0);
final String title = eventCursor.getString(1);
final Date begin = new Date(eventCursor.getLong(2));
final Date end = new Date(eventCursor.getLong(3));
final Boolean allDay = !eventCursor.getString(4)
.equals("0");
if (eventID.equals(ID))
{
temp = new CalendarData();
temp.Title = eventCursor.getString(1);
temp.StartDate = eventCursor.getLong(2);
temp.EndDate = eventCursor.getLong(3);
break;
}
}
}
// break;
}
return temp;
}
I used the following code to retrieve all the data on the Calendar which is:
cr = getApplicationContext().getContentResolver();
caluri=CalendarContract.Events.CONTENT_URI;
atteuri=CalendarContract.Attendees.CONTENT_URI;
try
{
cur1 = cr.query(caluri, new String[]{Events.CALENDAR_ID,Events._ID, Events.TITLE, Events.DESCRIPTION,Events.DTSTART, Events.DTEND, Events.EVENT_LOCATION }, null, null, null);
if(cur1!=null){
while(cur1.moveToNext()){
cal_ID=cur1.getString(cur1.getColumnIndex(Events.CALENDAR_ID));
event_ID=cur1.getString(cur1.getColumnIndex(Events._ID));
cur2=cr.query(atteuri,new String[]{Attendees.ATTENDEE_NAME,Attendees.ATTENDEE_EMAIL}, Attendees.EVENT_ID +"=" +event_ID, null, null);
if(cur2!=null){
while(cur2.moveToNext()){
event_Title=cur1.getString(cur1.getColumnIndex(Events.TITLE));
event_Desc=cur1.getString(cur1.getColumnIndexOrThrow(Events.DESCRIPTION));
event_Start=new Date(cur1.getLong(cur1.getColumnIndex(Events.DTSTART)));
event_end=new Date(cur1.getLong(cur1.getColumnIndex(Events.DTEND)));
event_loc=cur1.getString(cur1.getColumnIndex(Events.EVENT_LOCATION));
attendee_name=cur2.getString(cur2.getColumnIndex(Attendees.ATTENDEE_NAME));
attendee_Email=cur2.getString(cur2.getColumnIndex(Attendees.ATTENDEE_EMAIL));
all_attendee +="\n"+attendee_name;
all_Emails +="\n"+attendee_Email;
}
cur2.close();
}
all +="Event title: " + event_Title + "\n" + "Event Description: " + event_Desc + "\n" +"Event Start: " + event_Start + "\n" + "Events End: " + event_end + "\n" + "Event Location: " + event_loc + "\n" + "Attendees: " + "\n" + all_attendee + "\n" + "Emails: "+ "\n" + all_Emails + "\n";
}
cur1.close();
}
}
catch(Exception e)
{
e.printStackTrace();
}
SO all what you need as I guess is to adjust it little bit get data for last event.
ContentResolver cr = getContentResolver();
Uri caluri = CalendarContract.Events.CONTENT_URI;
Uri atteuri = CalendarContract.Attendees.CONTENT_URI;
Cursor cur1, cur2;
String all = null;
try
{
cur1 = cr.query(caluri
, new String[]{ Events.CALENDAR_ID, Events._ID, Events.TITLE, Events.DESCRIPTION, Events.DTSTART, Events.DTEND, Events.EVENT_LOCATION }
, null, null, null);
if (cur1 != null)
{
while (cur1.moveToNext())
{
String event_Title = cur1.getString(cur1.getColumnIndex(Events.TITLE));
String event_Desc = cur1.getString(cur1.getColumnIndexOrThrow(Events.DESCRIPTION));
Date event_Start = new Date(cur1.getLong(cur1.getColumnIndex(Events.DTSTART)));
Date event_end = new Date(cur1.getLong(cur1.getColumnIndex(Events.DTEND)));
String event_loc = cur1.getString(cur1.getColumnIndex(Events.EVENT_LOCATION));
String all_attendee = null;
String all_Emails = null;
String cal_ID = cur1.getString(cur1.getColumnIndex(Events.CALENDAR_ID));
String event_ID = cur1.getString(cur1.getColumnIndex(Events._ID));
cur2 = cr.query(atteuri, new String[]{ Attendees.ATTENDEE_NAME, Attendees.ATTENDEE_EMAIL }
, Attendees.EVENT_ID + "=" + event_ID, null, null);
if (cur2 != null)
{
while (cur2.moveToNext())
{
String attendee_name = cur2.getString(cur2.getColumnIndex(Attendees.ATTENDEE_NAME));
String attendee_Email = cur2.getString(cur2.getColumnIndex(Attendees.ATTENDEE_EMAIL));
all_attendee += "\n" + attendee_name;
all_Emails += "\n" + attendee_Email;
}
cur2.close();
}
all += "Event title: " + event_Title + "\n"
+ "Event Description: " + event_Desc + "\n"
+ "Event Start: " + event_Start + "\n" + "Events End: "
+ event_end + "\n" + "Event Location: " + event_loc
+ "\n" + "Attendees: " + "\n" + all_attendee + "\n"
+ "Emails: " + "\n" + all_Emails + "\n";
}
cur1.close();
}
System.out.println("My log--------" + all);

Categories

Resources