当我点击按钮时,它应该从CalendarContract.Events中检索(现在)Title列,然后设置在Edit Text View中检索的Title。我使用的代码是:
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行是主要问题,因为Code没有运行并在LogCat中突出显示...请尽快回复。