我有从sqlite数据库检索的数据集,数据将使用textView显示。
这是代码
#WQL
$query = @"
SELECT * FROM __InstanceModificationEvent WITHIN 1 WHERE TargetInstance ISA 'CIM_DataFile' AND TargetInstance.Name='c:\\test\\filewatching\\tester.txt'
"@
$instanceFilter = ([WMICLASS]"\\$Computername\root\subscription:__EventFilter").CreateInstance()
$instanceFilter.QueryLanguage = 'WQL'
$instanceFilter.Query = $query
$instanceFilter.Name = 'EventFilterNameHere'
$instanceFilter.EventNameSpace = 'root/CIMV2'
$result = $instanceFilter.Put()
# Consumer
$script =
@"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("c:\test\filewatching\Log.log", 8, True)
objFile.WriteLine "New File Created"
objFile.Close
"@
$instanceConsumer = ([wmiclass]"\\$Computername\root\subscription:ActiveScriptEventConsumer").CreateInstance()
$instanceConsumer.Name = 'ConsumerNameHere'
$instanceConsumer.ScriptingEngine = 'VBScript'
$instanceConsumer.ScriptFilename = ''
$instanceConsumer.ScriptText = $script
$instanceConsumer.Put()
# Binding
[object]$Filter = (Get-WMIObject -Computername $Computername -Namespace root\Subscription -Class __EventFilter | Sort Name)
[object]$Consumer = (Get-WMIObject -Computername $Computername -Namespace root\Subscription -Class __EventConsumer | Sort Name)
$instanceBinding = ([wmiclass]"\\$Computername\root\subscription:__FilterToConsumerBinding").CreateInstance()
$instanceBinding.Filter = $Filter
$instanceBinding.Consumer = $Consumer
$instanceBinding.Put()
此代码的输出如
ContactDatabase onbOfContactDatabase=new ContactDatabase(getBaseContext());
Cursor allcontact= onbOfContactDatabase.showData();
TextView t=(TextView)findViewById(R.id.textView);
String dbString="";
allcontact.moveToFirst();
do {
dbString+=allcontact.getString(allcontact.getColumnIndex("name"));
dbString+="\n";
t.setText(dbString);
} while(allcontact.moveToNext());
我希望所有数据都可以点击以及如何知道点击了哪些数据? 请帮助这是银色的。
答案 0 :(得分:0)
将TextView更改为ListView,然后为ListView设置onClickListener,然后设置该组
String output = listview.getselecteditem(position);