I want to access message data from the class which extends BroadcastReceiver but the problem is we need Activty. So i create the object of Activtity by Activity a=new Activity() but it seems there is some issue with it. So please take a look at it. The code is as follow
try { Uri allMessage = Uri.parse("content://sms/"); Log.e("1", "1"); Activity a=new Activity(); Log.e("2", "2"); if(allMessage==null) { Log.e("null", "null"); } Cursor c = a.managedQuery(allMessage, null, null, null, null); Log.e("3", "3"); String logs=""; Log.e("first", String.valueOf(c.getColumnCount())); while (c.moveToNext()) { String row = ""; int index=c.getColumnCount(); //row = c.getString(2) + "-" + c.getString(11) + "-" + c.getString(; for(int i=0;i<index;i++) row=row+"column1" +c.getString(i); logs = logs + row + "\n"; } Log.e(getClass().getSimpleName(), logs ); } catch(Exception e) { Log.e("Exception",e.toString()); } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---