草庐IT

HAND_CURSOR

全部标签

android - 将 Cursor 数据绑定(bind)到非列表布局

我正在编写一个屏幕,显示来自数据库的一行信息。基本上它是一个DetailFragment,表示与表中的一个“行”有关的信息。我想了解将数据从游标(表中的唯一行)绑定(bind)到TextView、复选框等布局的最佳实践。AdapterView是票吗?@JoeMalin建议:Thenwriteanadapterbetweenacursorandanarrayoftextviews.这归结为我的问题。将一系列TextView挂接到游标的正确方法是什么? 最佳答案 如果你想在将一些游标数据移动到TextView之前对其进行处理,那么你将超

android - 如果 moveToFirst() 为 false,是否需要关闭 Cursor?

如果cursor.moveToFirst()返回false,我还需要关闭它吗?因为它在光标为空时返回false。我怀疑正确的方法:if(cursor!=null&&cursor.moveToFirst()){//somecodecursor.close();}或者:if(cursor!=null){if(cursor.moveToFirst()){//somecode}cursor.close();} 最佳答案 您必须关闭所有非空的游标,无论它们是否填充了条目。上述声明的唯一异常(exception)是,如果您知道有问题的Curso

android - 有人可以解释一下 android 中的 Cursor 吗?

有人能解释一下光标的具体工作原理吗?或者下面部分代码的流程?我知道这是子Activity,但我不明白Cursor是如何工作的。finalUridata=Uri.parse("content://contacts/people/");finalCursorc=managedQuery(data,null,null,null,null);String[]from=newString[]{People.NAME};int[]to=newint[]{R.id.itemTextView};SimpleCursorAdapteradapter=newSimpleCursorAdapter(this

android - 滚动基于 Cursor 的适配器的大列表比内存中适配器的小列表快得多

我有一个Android应用,它既有基于CursorAdapter的ListView(由sqlite支持),也有基于自定义BaseAdapter的ListView是根据从服务器下拉的JSON动态构建的。两者显示的数据是相同的-一个图像和几个TextView。我的基于Cursor的ListView有3000行,基于JSON的ListView大约有30行。但是,对于基于Cursor的适配器,向下滚动列表的速度要快得多。对于基于JSON的列表,数据是在行可见之前全部获取的。两种类型列表的图像均按需下载。我将两个ListView配置相同-都将fastScrollEnabled、scrolling

android - 在进程之间传递游标(Parcelable Cursor)

我需要将Cursor(SQLiteCursor)从服务传递到API10上的应用程序,并且很难找到一个像样的(和快速)解决方案。我看过CursorWindow类。这是Parcelable但我无法在API10上实例化此类以使用SQLiteCursor.fillWindow()因为它没有有效的构造函数。CursorWindow(boolean)已弃用。即使我得到一个包含来自SQLiteCursor的数据的CursorWindow实例,我如何将这个窗口复制到一个新的Cursor中?我应该为此使用什么Cursor实现?我看不到扩展AbstractWindowedCursor的可用Cursor。感

android - 构造函数 SimpleCursorAdapter(Context, int, Cursor, String[], int[]) 已弃用

如何解决这个问题?TheconstructorSimpleCursorAdapter(Context,int,Cursor,String[],int[])isdeprecated和ThemethodmanagedQuery(Uri,String[],String,String[],String)fromthetypeActivityisdeprecated代码如下:packagecom.example.kamusdigital;importandroid.app.Activity;importandroid.os.Bundle;importandroid.view.View;impor

android - 陈旧数据异常 : access closed cursor

在我的应用程序中,点击足够多之后,我得到了这个错误:06-0819:47:59.967:ERROR/AndroidRuntime(2429):java.lang.RuntimeException:Unabletopauseactivity{com.MYAPP.app/com.MYAPP.app.MainActivity}:android.database.StaleDataException:Accessclosedcursor我有一个选项卡Activity(我的MainActivity),它有一个ListActivity作为每个选项卡的内容。在每个ListActivity的onCre

java - cursor.getstring() 在数据库中获取错误的字段

所以这是我的代码:publicvoidonItemClick(AdapterViewlistView,Viewview,intposition,longid){Cursorcursor=(Cursor)listView.getItemAtPosition(position);int_id=cursor.getInt(0);String_recipe=cursor.getString(1);Intentintent=newIntent(Luzon1Activity.this,RecipeInstruction.class);intent.putExtra("id",_id);intent

无线感知论文速览 | SenSys 2023, 使用商用WiFi设备构建手部骨架 Construct 3D Hand Skeleton with Commercial WiFi

注1:本文系“最新论文速览”系列之一,致力于简洁清晰地介绍、解读最新的顶会/顶刊论文无线感知论文速览|SenSys2023,使用商用WiFi设备构建手部骨架Construct3DHandSkeletonwithCommercialWiFiSijieJi,XuanyeZhang,YuanqingZheng,MoLi.2023.Construct3DHandSkeletonwithCommercialWiFi.InACMConferenceonEmbeddedNetworkedSensorSystems(SenSys’23),November12–17,2023,Istanbul,Turkiye.

android - 将一个 Cursor 的内容添加到另一个 Cursor

我想连接两个游标,连接后第二个游标的内容也出现在第一个游标中。正是我的代码,publicfinalUriAllImage_URI_Int=MediaStore.Images.Media.INTERNAL_CONTENT_URI;publicfinalUriAllAudio_URI=MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;cContentList=managedQuery(AllImage_URI_Int,null,null,null,MediaStore.Images.ImageColumns.TITLE);cList_Int=manag