cursor

Obtaining phone number from lookup URI

[亡魂溺海] 提交于 2019-12-01 04:48:30
I've been trying to obtain a contact's phone number using their lookup URI, but I'm not getting it to work. Cursor myC = getContentResolver().query(lookupURI, null, null, null, null); String phoneNumber; if (myC.moveToFirst()) { while (myC.moveToNext()) { phoneNumber = myC.getString(myC .getColumnIndex(Phone.NUMBER)); Log.v("t", "phone number is: " + phoneNumber); } } where lookupURI.toString() is this URI: content://com.android.contacts/contacts/lookup/0r1-304846522C3052482C4A3442423C3248/1 Anyone knows what I'm doing wrong? Can't guarantee this'll work for 4.0 because I haven't used it in a

Is SQL or general file access appropriate in the Android main UI thread?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 04:31:24
I'm trying to follow Android best practices, so in debug mode I turn all the following on: StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build()); //detect and log all thread violations StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyLog().build()); //detect and log all virtual machine violations Android now yells at me when I try to use any sort of file access or SQL in the main (UI) thread. But I see so many recommendations to use file access and/or SQL in the main thread. For example, the main activity should load

TSQL Cursor how to check if already declared and thus deallocate

主宰稳场 提交于 2019-12-01 04:26:15
How can I make sure that I deallocate a cursor if it already exists before I try and open it again? For a table I can use something like: if exists (select top 1 from tempdb.sys.tables where name = '##tmpTable') drop table ##tmpTable; ... then I can recreate my ##tmpTable But I can't work out how to do it for a cursor like -- First clean up if already exists.. ..... <----- what goes here??? -- Declare and use a cursor DECLARE someCursorName CURSOR FOR select something from somewhere FOR READ ONLY I'm doing this to ensure that my script cleans up before it starts work Best I can come up with is

How do i set a custom image for the mouse cursor in a google map api v3 map

老子叫甜甜 提交于 2019-12-01 04:25:42
I want to have a custom cursor while moused over the google map component on the page. I'd like to be able to programatically change the cursor to the custom image, then change it back to the default cursor. I believe this is how you set the default cursor on your 'map' object map.setOptions({ draggableCursor: 'default' }); After some research and experimentation, i found the best way to do this was as follows: map.setOptions({ draggableCursor: 'url(path/to/your/image.png), crosshair' }); in css, only webkit supports a url value for the cursor attribute, so other browsers get the value of

mysql number of records in cursor without iterating?

爷,独闯天下 提交于 2019-12-01 04:15:16
I am trying to write mysql procedure for below logic, select id, fullname from users where fullname like concat(lastname, ' ', firstname, ' (' , middlename, '%'); if above query returns 0 records then select id, fullname from users where fullname like concat(lastname, ' ', firstname, '%'); .... few more queries depending upon result, I am trying to write procedure mysql procedure , in that, I am using mysql cursor, DECLARE user_cnt CURSOR FOR select id, fullname from users where fullname like concat(lastname, ' ', firstname, ' (' , middlename, '%'); now I want to check number of records in

CursorIndexOutOfBoundsException Index 0 requested, with a size of 0

风流意气都作罢 提交于 2019-12-01 04:13:55
I'm trying to get a text from a certain row of my database. For this, I made this function public String getTranslation(long rowId) throws SQLException { String str = null; Cursor mCursor = db.query( true, TABLE_LANGUAGE_FR, new String[] { KEY_ID_INTERFACE_TEXT, KEY_ITEM_NAME,KEY_FORM_LABEL_ID, KEY_FORM_RANK }, KEY_FORM_LABEL_ID + "=" + rowId, null, null, null, null, null ); if (mCursor != null) { mCursor.moveToFirst(); str = mCursor.getString(mCursor.getColumnIndex(KEY_ITEM_NAME)); } return str; } and I call it like this : db = new DbAdapter(this); db.createDatabase(); db.openDataBase();

Listen to any changes in a cursor in android

[亡魂溺海] 提交于 2019-12-01 03:40:44
问题 I would like to listen to any changes in a cursor.Is it possible to acheive this without using a contentprovider in android? Note:(I am not using any data adapter) Thanks 回答1: I found that You don't need to use content Provider.When ever the data changes(like during insertions,deletions etc..) you can just call getContentResolver().notifyChange(Uri uri, ContentObserver observer) and set a contentObserver in your activity to listen for the change. 回答2: As far as I know, if your changes in the

cursor:pointer on hover html5 canvas element

ぐ巨炮叔叔 提交于 2019-12-01 03:31:39
is there anyway to do this to let the user know the element is clickable?. I have been using easeljs but haven't found anything related Charlotte You could use this: How to make clickable points in html5 canvas? and while the mouse is in that area, you can set: $('#canvasID').css('cursor','pointer') and $('#canvasID').css('cursor','auto') when it's not over it. I am using Easeljs and to get a pointer cursor I use myObject.cursor = 'pointer' and stage.enableMouseOver(20); ( from the DragAndDrop.html example code ) 来源: https://stackoverflow.com/questions/12608729/cursorpointer-on-hover-html5

WPF Borderless window resize

烂漫一生 提交于 2019-12-01 03:31:05
I am designing my own custom window in WPF and I have been trying to implement the resizing functionality I have used previously in WinForms. For some reason the return value of my WndProc isn't giving me the proper result. I have a NativeMethods class for all my WndProc messages and results: public class NativeMethods { public const int WM_NCHITTEST = 0x84; public const int HTCAPTION = 2; public const int HTLEFT = 10; public const int HTRIGHT = 11; public const int HTTOP = 12; public const int HTTOPLEFT = 13; public const int HTTOPRIGHT = 14; public const int HTBOTTOM = 15; public const int

Can I get the results of a stored procedure into a cursor within another stored procedure in SQL

被刻印的时光 ゝ 提交于 2019-12-01 03:12:19
I'm trying to put the results of a stored procedure into a cursor to use within the current procedure. I've added my code below but I'm not sure if this is possible or if my syntax is correct? DECLARE cursorIDList CURSOR FOR EXEC spGetUserIDs OPEN cursorIDList FETCH NEXT FROM cursorIDList INTO @ID I receive the following error: Incorrect syntax near 'EXEC'. Expecting SELECT, '(' or WITH. Thanks in advance. You can do it like this: DECLARE @t TABLE (ID INT) INSERT INTO @t EXEC spGetUserIDs DECLARE cursorIDList CURSOR FOR SELECT * FROM @t OPEN cursorIDList FETCH NEXT FROM cursorIDList INTO @ID