How to use Cursor's in non Activity Classes

I wan't to get data's from CallLog.Calls.CONTENT_URI in non Activity classes. Am using cursor to get these data's from CallLog. But in non activity class cursor shows some error so how i can how i can do this?

Presently am doing like this,

public class CallReceiver extends Activity { @Override public void onCreate(Bundle bundle) { super.onCreate(bundle); Cursor cursor = managedQuery(android.provider.CallLog.Calls.CONTENT_URI,null,null,null,null); startManagingCursor(cursor);

-------------Problems Reply------------

Cursor c = context.getContentResolver().query(uri, projection, selection, null, sortOrder);
if (c.moveToFirst()) {
...
}
c.close();

Category:android Views:0 Time:2011-06-10

Related post

  • Cursor moves to new active window when closing a window 2013-11-18

    I updated to Win 8.1 and now whenever I close a window, my cursor jumps to the next active window. For example, if I have Word open on the left and IE open on the right, when I close Word, my cursor jumps across the screen to the middle of IE even if

  • Android ContentResolver: Pass the data with cursor without requery or get the exact executed cursor when querying from activity 2010-09-08

    Say, I'm having a ContentProvider (which in fact do not performs database call) and I want to pass some additional data (for example, call statistics) with the cursor to the caller: public class SomeProvider extends ContentProvider { . . . public Cur

  • When typing in an 'active' window, the screen flashes and the cursor is no longer active..... 2013-04-30

    No matter where I'm typing - in an email, on a website, even here posting this question - every few seconds the cursor stops being active and I have to click in the test area to set it again before I can keep typing --------------Solutions-----------

  • GtkTreeView's row-activated and cursor-changed signals 2010-02-13

    I have a treeview and I am watching for the cursor-changed and row-activated signals. The problem is that in order to trigger the row-activate I first have to click on the row (triggering cursor-changed) and then do the double click, requiring 3 clic

  • jQuery UI Sortable and :active mouse cursor for handle 2011-11-28

    I'm trying to use Sortable to reorder the items of a list. I've got a handle for each item of the list, which has :hover and :active css cursor settings, so that the cursor changes when the user mouses over the handles (and again when dragging). <

  • Cursor disappears from active window - Windows 7 2012-06-24

    Hi, I have a similar problem to the ‘Jumping cursor problem using Windows 7’, but reinstalling my mouse driver has not helped. I have an ASUS A54C laptop, running Windows 7 and with an external Logitech keyboard and mouse, both going through a powere

  • Cursor location changes active screen 2013-09-29

    I frequently have multiple screen open. The cursor will change the active screen if it passes over another screen and make that screen the active screen, This is particularly annoying when trying to download a clip, for example. Can this obnoxious pr

  • Get all item from cursor in android 2009-08-20

    I use this code to get the item from cursor, but it just return one item on my list. So, how can I get all items to my list, this is my code? class MyAdapter extends SimpleCursorAdapter { private Context context; public MyAdapter(Context context, int

  • How can you implement a grabbing cursor icon in Chrome? 2010-09-03

    I know it's possible to use a grabbing cursor icon in Chrome (in gmail, of course), but I can't figure out how to implement it in my code. I have tried (in CSS): body { cursor: grab; } body { cursor: -webkit-grab; } body { cursor: url(http://www.worl

  • Problem with "Finalizing Cursor" error in custom CursorAdapter 2010-09-07

    I have a cursor adapter and the logcat is filled with above errors, as soon as I click on a view. I am already releasing the CursorAdapter's cursor in onDestroy(). Is there any way to get information about when the cursor was opened? --------------So

  • change cursor when loading page 2010-09-17

    So what I trying to do is to change the cursor to wait when some page is loading. I thought this was possible with css, I trying to achieve this when someone click on some link, so what I have is this: #something a:hover { cursor: hand; } #something

  • How to change cursor style in android? 2010-10-08

    I have different views on my activity. I wanna change my cursor style when cursor is move to any view. How to do same in android.For example there is a normal cursor on the android activity when cursor moves to a button i wanna change cursor style no

  • Android Cursor.registerContentObserver() 2011-01-06

    I am using a couple of listviews, each using a subclasses SimpleCursorAdapter to deal with results from a db. It's a simple diary viewer, activity 1 = day, activity 2 = week. I am trying to delete an item in the day listview, and then have both the d

  • Android: Cursor requery when replacing entire database 2011-01-09

    I have a ListActivity which uses a SimpleCursorAdapter to display database content. I am having problems getting the view refreshed when the underlying database changes. As an experiment, I've added a call to Cursor.requery() in the activity's onResu

  • SQLite Exception on Resuming Android Activity 2011-01-27

    My app has a hierarchy of Activities, A -launches- B -launches- C In the third Activity 'C' I have a button. In the onClickListener of this button I launch an Intent as follows: Intent intent = new Intent(Intent.ACTION_DIAL); intent.setData(Uri.parse

  • Unable to return Cursor object - close() was never explicity called error 2011-04-10

    Hey. I'm trying to return a cursor object to my activity where its gonna be used in a SimpleCursorAdapter, but Im having a close() was never explicity called error. I cant find any solution for this error, and I'm about to think that its a non-soluti

  • Honeycomb and cursors (frustrated) 2011-05-30

    I have this activity that was completely converted to use honeycomb. I reworked all the cursor management to use the new cursorLoader. Everything works great on all other os versions (using the compatibility library), but still does not work on honey

  • Should the cursor be closed in bind view? 2011-07-05

    public void bindView(View view, Context context, Cursor cursor) { int num=cursor.getLong(0); //cursor.close(); } is closing cursors in adapter bindview correct ? and in what conditions should I do that ? or maybe I should never do it . . . ----------

  • when i click the list view in the first class how will i get the datas stored in that list in my next activity??can someone help me out|? 2012-02-21

    public class GroceryList extends ListActivity { Button btn_create; Cursor cursor; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layou

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.107 (s). 11 q(s)