繁体   English   中英

android debug error column'data3'不存在

[英]android debug error column 'data3' does not exist

java.lang.IllegalArgumentException:列'data3'不存在,而data3列又是什么?

LogCat

03-24 07:05:36.091:错误/ AndroidRuntime(2540):致命异常:主

03月24日07:05:36.091:错误/AndroidRuntime(2540):java.lang.RuntimeException:无法启动活动ComponentInfo {fypj.e / fypj.ee}:java.lang.IllegalArgumentException:列“ data3”不存在

03-24 07:05:36.091:错误/ AndroidRuntime(2540):位于android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)

03月24日07:05:36.091:错误/ AndroidRuntime(2540):在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)

03-24-24:05:36.091:错误/ AndroidRuntime(2540):at android.app.ActivityThread.access $ 2300(ActivityThread.java:125)

03-24 07:05:36.091:错误/ AndroidRuntime(2540):位于android.app.ActivityThread $ H.handleMessage(ActivityThread.java:2033)

03月24日07:05:36.091:错误/ AndroidRuntime(2540):位于android.os.Handler.dispatchMessage(Handler.java:99)

03-24 07:05:36.091:错误/ AndroidRuntime(2540):位于android.os.Looper.loop(Looper.java:123)

03月24日07:05:36.091:错误/ AndroidRuntime(2540):位于android.app.ActivityThread.main(ActivityThread.java:4627)

03-24 07:05:36.091:错误/ AndroidRuntime(2540):位于java.lang.reflect.Method.invokeNative(本机方法)

03-24 07:05:36.091:错误/ AndroidRuntime(2540):at java.lang.reflect.Method.invoke(Method.java:521)

03月24日07:05:36.091:错误/ AndroidRuntime(2540):在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:868)

03月24日07:05:36.091:错误/ AndroidRuntime(2540):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)

03月24日07:05:36.091:错误/ AndroidRuntime(2540):在dalvik.system.NativeStart.main(本机方法)

03-24 07:05:36.091:错误/ AndroidRuntime(2540):由以下原因引起:java.lang.IllegalArgumentException:列'data3'不存在

03-24 07:05:36.091:错误/ AndroidRuntime(2540):位于android.database.AbstractCursor.getColumnIndexOrThrow(AbstractCursor.java:314)

03月24日07:05:36.091:错误/ AndroidRuntime(2540):位于android.database.CursorWrapper.getColumnIndexOrThrow(CursorWrapper.java:99)

03-24 07:05:36.091:错误/ AndroidRuntime(2540):位于android.widget.SimpleCursorAdapter.findColumns(SimpleCursorAdapter.java:312)

03-24 07:05:36.091:错误/ AndroidRuntime(2540):位于android.widget.SimpleCursorAdapter。(SimpleCursorAdapter.java:87)

七月3日至24日:05:36.091:ERROR / AndroidRuntime(2540):在fypj.eeonCreate(e.java:48)

03-24 07:05:36.091:错误/ AndroidRuntime(2540):在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)

03-24 07:05:36.091:错误/ AndroidRuntime(2540):位于android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)

03-24 07:05:36.091:错误/ AndroidRuntime(2540):...还有11个

package fypj.e;

import android.app.ListActivity; 
import android.content.ContentUris;
import android.content.ContentValues;
import android.database.Cursor; 
import android.net.Uri;
import android.os.Bundle; 
import android.provider.Contacts.People; 
import android.provider.ContactsContract;
import android.provider.ContactsContract.CommonDataKinds.Phone; 
import android.provider.ContactsContract.CommonDataKinds.StructuredName;
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.RawContacts;
import android.widget.*;  

public class e extends ListActivity  {
    private SimpleCursorAdapter myAdapter;     @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        ContentValues values = new ContentValues(); 
        values.put(RawContacts.ACCOUNT_TYPE, ""); 
        values.put(RawContacts.ACCOUNT_NAME, ""); 
        Uri rawContactUri = 
getContentResolver().insert(RawContacts.CONTENT_URI, values); 
        long rawContactId = ContentUris.parseId(rawContactUri); 


        values.clear(); 
        values.put(Data.RAW_CONTACT_ID, rawContactId); 
        values.put(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE); 
        values.put(StructuredName.DISPLAY_NAME, "Misha"); 
        values.put(Phone.LABEL, "Mis");
        values.put(ContactsContract.Data.DATA3, "View Contact");
        getContentResolver().insert(Data.CONTENT_URI, values); 


        //contentResolver = getContentResolver(); 



        Cursor cursor = getContentResolver().query(People.CONTENT_URI, null, null, null, null);         
        startManagingCursor(cursor);          
        String[] column = new String[] {Phone.LABEL};         
        int[] names = new int[] {R.id.contact_name};         
        myAdapter = new SimpleCursorAdapter(this, R.layout.main, cursor, column, names);         
        setListAdapter(myAdapter);     
    } 
}

除了猜测之外,别无所求,但是也许您正在使用“ data3”作为数据库工作某个函数的参数,而“ data3”在您的数据库中不存在?

我不知道您使用的是sdk,但是在2.2版中,大多数数据包都是不完整的。 但是,问题在于游标返回的列中不存在具有常量值“ data3”的Phone.Label列。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM