簡體   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