2

当我单击该按钮时,它应该(暂时)从 CalendarContract.Events 检索标题列,然后设置在编辑文本视图中检索到的标题。我使用的代码是:

public void oc(View view1)
{       
    final String[] EVENT_PROJECTION = new String[] {

        Events.TITLE                  // 1
};

final int PROJECTION_TITLE_INDEX = 1;
Cursor cur = null;
ContentResolver cr = getContentResolver();
Uri uri = Events.CONTENT_URI;   
String selection = "((" +  Events.TITLE + " = ?))";
cur = cr.query(uri, EVENT_PROJECTION, selection, null, null);

// Use the cursor to step through the returned records
while (cur.moveToLast()) {
    String title = null;
    title = cur.getString(PROJECTION_TITLE_INDEX);
    etv2.setText(title);   //etv2 is edit text view

我的 LogCat 显示:

01-13 03:44:27.312: E/SensorManager(23418): thread start
01-13 03:44:27.317: D/SensorManager(23418): registerListener :: handle = 0  name= LSM330DLC Acceleration Sensor delay= 200000 Listener= android.view.OrientationEventListener$SensorEventListenerImpl@423b0`enter code here`238
01-13 03:45:07.787: D/SensorManager(23418): unregisterListener::  Listener= android.view.OrientationEventListener$SensorEventListenerImpl@423b0238
01-13 03:45:07.787: D/Sensors(23418): Remain listener = Sending .. normal delay 200ms
01-13 03:45:07.787: I/Sensors(23418): sendDelay --- 200000000
01-13 03:45:07.787: D/SensorManager(23418): JNI - sendDelay
01-13 03:45:07.787: I/SensorManager(23418): Set normal delay = true
01-13 03:45:07.997: W/IInputConnectionWrapper(23418): getSelectedText on inactive InputConnection
01-13 03:45:07.997: W/IInputConnectionWrapper(23418): setComposingText on inactive InputConnection
01-13 03:45:07.997: W/IInputConnectionWrapper(23418): getExtractedText on inactive InputConnection

最后 3 行是代码未运行并在 LogCat 中突出显示的主要问题...请尽快回复。

4

0 回答 0