cursor

Proper implementation of changing ListView data with CursorAdapter

狂风中的少年 提交于 2019-12-22 08:44:53
问题 I have a ListView populated via a CursorAdapter. I give my user the ability to alter the data in the list. For example, the user can mark a row as being unread (the data are messages). Suppose my user marked a row unread. Would a proper implementation mark the row in the database as read and then requery the Cursor? 回答1: Would a proper implementation mark the row in the database as read and then requery the Cursor? Yes, that's the right answer. The requery() will trigger an automatic update

How to use query for multiple selection argument using one selection column

送分小仙女□ 提交于 2019-12-22 08:37:11
问题 Here is my query : // Table Name : Question Cursor cursor = db.query("QUESTION", new String[] { "TEXT", "OPTION_A", "OPTION_B", "OPTION_C", "OPTION_D", "OPTION_E", "RIGHT_ANSWER" }, "SUBJECT=?", new String[] { "Ingles", "Historia" }, null,null, null); I can have multiple subjects, right now i am having only two subjects(Ingles,Historia) How to sort data by subjects using query?? I am getting bind or out of range error. I know error is somewhere in where clause , but not able to solve it. 回答1:

How to pass Cursor Object to next Activity using Intents

喜欢而已 提交于 2019-12-22 06:57:16
问题 I'm familiar with how to pass Raw Data(String, int, boolean etc) from one Activity to another Activity. But in my application, I want to pass a Cursor object to next Activity. I'm extending my class from the Activity Class. Though I have looked at this post. but it provides cotradictory solutions. However, as described by one of the users, one should extend Application class to pass cursor data. But I want to extend Activity class. So is there any way to pass Cursor data from an Activity to

React controlled input cursor jumps

*爱你&永不变心* 提交于 2019-12-22 06:46:39
问题 I am using React and have formatted a controlled input field, which works fine when I write some numbers and click outside the input field. However, when I want to edit the input, the cursor jumps to the front of the value in the input field. This only occur in IE, and not in e.g. Chrome. I've seen that for some programmers the cursor jumps to the back of the value. So I think the reason that my cursor is jumping to the front is because the value is aligned to the right instead of to the left

ViewPager and Database

非 Y 不嫁゛ 提交于 2019-12-22 04:47:04
问题 The data is in a Database, so I would normally use CursorAdapter and have it work with CursorLoader on a ListView, however now I need a ViewPager instead of a ListView and that takes a PagerAdapter and I only have it have seen it work with lists. Is there a native pager adapter that uses a cursor or ill have to make it work? Thanks! 回答1: Based on the internals of the CursorAdapter I have an implementation that extends FragmentPagerAdapter with the only difference that you will use the

IllegalStateException: get field slot from row 0 col -1 failed

浪子不回头ぞ 提交于 2019-12-22 04:40:40
问题 Here is my LogCat: 01-15 22:13:08.277: ERROR/AndroidRuntime(28747): java.lang.IllegalStateException: get field slot from row 0 col -1 failed 01-15 22:13:08.277: ERROR/AndroidRuntime(28747): at android.database.CursorWindow.getLong_native(Native Method) 01-15 22:13:08.277: ERROR/AndroidRuntime(28747): at android.database.CursorWindow.getLong(CursorWindow.java:414) 01-15 22:13:08.277: ERROR/AndroidRuntime(28747): at android.database.AbstractWindowedCursor.getLong(AbstractWindowedCursor.java:108

Method invocation may produce java NullpointerException

半城伤御伤魂 提交于 2019-12-22 03:24:18
问题 I have a code: public String getNameUpdateEvent(long id) { Cursor mCursor = db.rawQuery("select name from events WHERE _id=" + id + ";", null); if (mCursor != null) { mCursor.moveToFirst(); } String updateNameEvent; updateNameEvent = mCursor.getString(mCursor.getColumnIndex("name")); return updateNameEvent; } and I´m getting a warning Warning:(173, 45) Method invocation 'mCursor.getColumnIndex("name")' may produce 'java.lang.NullPointerException' How i can fix it pls? 回答1: Your cursor can not

Android: SimpleCursorAdapter usage

心已入冬 提交于 2019-12-22 00:49:51
问题 I have ONE annoying problem with SimpleCursorAdapter. My programm has list view and ListActivity. Each row has it's own layout: <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:layout_width="fill_parent" android:orientation="horizontal" android:weightSum="1.0"> <TableRow> <TextView android:id="@+id/task_time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="24sp" android:text="Time">

Custom cursor in C# Winforms

半腔热情 提交于 2019-12-21 21:58:07
问题 Does anyone know of an easy way to use a custom cursor? I have both a .cur and .png of my cursor. I tried adding it as a resource to my project and also tried including it as a file in the project. Ideally I'd like to embed it but I just want to get it working. When I use Cursor cur = new Cursor("mycursor.cur") I get "Image format is not valid. The image file may be corrupted". I tried this http://mahesg.wordpress.com/2008/02/09/embedding-cursor/ but it didn't work. Using WinForm1.Properties

Call oracle stored procedure with cursor output parameter from python script

风流意气都作罢 提交于 2019-12-21 20:18:23
问题 I am trying to call a oracle stored procedure with 2 in and 1 out parameter from python script. The problem I am having is passing a cursor out-parameter. The Oracle stored procedure is essentially: PROCEDURE ci_lac_state (LAC_ID_IN IN VARCHAR2, CI_ID_IN IN VARCHAR2 DEFAULT NULL, CGI_ID OUT SYS_REFCURSOR) AS BEGIN OPEN cgi_id FOR ... END; The python code calling to the database is: #! /usr/bin/python import cx_Oracle lac='11508' ci='9312' try: my_connection=cx_Oracle.Connection('login/passwd