sqlite expert_sqlite手机版_sqlite expert自增(3)

电脑杂谈  发布时间:2017-05-17 06:03:56  来源:网络整理

Log.v("break", "实例化ss成功");

int a = cursor.getColumnCount();

Log.v("break", "实例化a成功");

int b = cursor.getCount();

TextView text = (TextView)findViewById(R.id.text);

Log.v("break", "实例化b成功");

text.setText("行名是:"ss ",列数是:" a ",行数是:" b);

Log.v("break", "text显示成功");

SimpleCursorAdapter adapter = new SimpleCursorAdapter(

MainActivity.this,

R.layout.line, cursor,

new String[] {"_id", "content"},

new int[] {R.id.text0, R.id.text},

CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);

Log.v("break", "绑定成功");

list.setAdapter(adapter);

Log.v("breakthrough", "成功运行");

}

}

xml代码:

activity_main.xml

<LinearLayout xmlns:android=""

xmlns:tools=""

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation = "vertical">

<TextView

android:id = "@id/text"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:text="@string/hello_world" />

<ListView

android:id = "@id/list"

android:layout_width="match_parent"

android:layout_height="wrap_content"/>

</LinearLayout>

line.xml

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android=""

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical" >

<TextView

android:id = "@id/text0"

android:layout_width = "match_parent"

android:layout_height = "wrap_content"/>

<TextView

android:id = "@id/text"

android:layout_width="match_parent"

android:layout_height="wrap_content" />

</LinearLayout>第八步:看结果。


本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/jisuanjixue/article-47593-3.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...