cursor

How to get contact name for sms conversations?

这一生的挚爱 提交于 2019-12-01 06:08:23
问题 I'm retrieving list of last sms/mms conversations using following query: String[] columns={"type", "address", "date", "body", "conversation_id"}; Cursor cursor=context.getContentResolver().query(Uri.parse("content://mms-sms/conversations"), columns, null, null, "date desc"); Can anyone advise me how to get in the same query also contact name? Specifically field ContactsContract.PhoneLookup.DISPLAY_NAME ? I mean, I understand how to get those field in separate query, but I need to get it in

Getting cursor position in a canvas without jQuery

杀马特。学长 韩版系。学妹 提交于 2019-12-01 05:57:25
问题 I am trying to learn how to use the HTML canvas element, and naturally, I am making a drawing application. So, I have the code set up for the actual drawing and animating part of the app, but I am not sure how to approach getting the position of the mouse cursor. I really would prefer not to use jQuery, for I would rather not want to learn all of what it does and have to go through the process of getting it set up. Thanks for any help! 回答1: function getMousePos(canvas, evt) { var rect =

Cursor icon does not change after triggering setCursor method

安稳与你 提交于 2019-12-01 05:52:18
There is a JTable in my application with resizable header columns. Normally when I move the cursor over table header for resizing, the cursor icon changes to resize arrow, like <-->. But things are different in the following scenario. There is a button action in the same Frame , and during action performed, I am setting the cursor to busy icon and change it back to default cursor once the action is completed, using Container.setCurosr(Cursor cursor) method. Sometimes if I move the cursor over table header of resizing, after a button action, the cursor icon does not change to resize arrow,

IOS: UItextfield disabled

一个人想着一个人 提交于 2019-12-01 05:43:40
When we push on a textfield, a cursor appear in this textfield; but I don't want that this cursor appear; then I want make this textfield disabled, where you can't write inside, how can I do? Can you set enabled property/userInteractionEnabled of text field to No in ViewDidLoad() using the code textField.enabled = NO; or textField.userInteractionEnabled = NO; If you're working with storyboards or .nib files and you want it to start out disabled you can also easily uncheck the enabled property in interface builder for some time-saving. 来源: https://stackoverflow.com/questions/5947965/ios

iOS: Programmatically move cursor up, down, left and right in UITextView

落花浮王杯 提交于 2019-12-01 05:38:47
问题 I use the following code to move the cursor position to 5 characters from the beginning of a UITextField : txtView.selectedRange = NSMakeRange(5, 0); Now, if I have a cursor at an arbitrary position as shown in the image below, how can I move the cursor up, down, left and right? 回答1: Left and right should be more or less easy. I guess the tricky part is top and bottom. I would try the following. You can use caretRect method to find the current "frame" of the cursor: if let cursorPosition =

Generating a sequence in sql server

梦想与她 提交于 2019-12-01 05:31:18
问题 I am working on a function that will take a low number and a high number as paramaters and returns a table containing everything between (and including). I know I could use a cursor and increment a variable adding it to a scope based table every iteration, but I would prefer to avoid a cursor if possible. Does anyone else have a suggestion for a way to do this? (As i'm typing this im thinking possibly a CTE, which I will go investigate). 回答1: Just create an indexed permanent auxiliary numbers

Listen to any changes in a cursor in android

旧时模样 提交于 2019-12-01 05:23:43
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 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. As far as I know, if your changes in the cursor are due to requery() or some other method on the cursor like close(), then you can use a dataset observer

Cursor while loop returning every value but the last

て烟熏妆下的殇ゞ 提交于 2019-12-01 05:22:11
I am using a while loop to iterate through a cursor and then outputing the longitude and latitude values of every point within the database. For some reason it is not returning the last (or first depending on if I use Cursor.MoveToLast) set of longitude and latitude values in the cursor. Here is my code: public void loadTrack() { SQLiteDatabase db1 = waypoints.getWritableDatabase(); Cursor trackCursor = db1.query(TABLE_NAME, FROM, "trackidfk=1", null, null, null,ORDER_BY); trackCursor.moveToFirst(); while (trackCursor.moveToNext()) { Double lat = trackCursor.getDouble(2); Double lon =

Sort DB data and display in list view

£可爱£侵袭症+ 提交于 2019-12-01 05:21:08
问题 I get data from my DB using cursor = db.query("WebLeadMaster", select, "condition1="+conditionVal1+ " and condition2="+ConditionVal2,null, null, null, "RegistrationTime DESC"); I am getting the data in my cursor alright. To display the data, i use the following code: SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(this, R.layout.resultleadlookup, cursor, columns, to); mAdapter.notifyDataSetChanged(); lstResult.setAdapter(mAdapter); So, I cannot modify the contents of the cursor. The

Using SimpleCursorAdapter with Spinner?

戏子无情 提交于 2019-12-01 05:03:15
问题 I have a db with table "mytable" having 2 colums "id","sampletext" I want to query distinct values of sampletext and feed to a Spinner using SimpleCursorAdapter. here is what is tried String[] cols=new String[]{"sampletext"}; int[] lbls=new lbls[]{android.R.id.text1}; mycursor=sdb.query(true,"mytable", cols,null,null,null,null,null,null); sca=new SimpleCursorAdapter(this, android.R.layout.simple_spinner_item, mycursor, cols,lbls,0); sca.setDropDownViewResource(android.R.layout.simple_spinner