0

我在我的项目中遇到了07-03 06:16:58.687: E/AndroidRuntime(1729): java.lang.NoClassDefFoundError: com.example.tottal.baby.care.MySimpleCursorAdapter这个错误。

这是我的 MySimpleCursorAdapter 类:

public class MySimpleCursorAdapter extends SimpleCursorAdapter {

    public MySimpleCursorAdapter(Context context, int layout, Cursor c,
        String[] from, int[] to) {
        super(context, layout, c, from, to);
    }

    @Override
    public void setViewImage(ImageView image_v, String id) {
         String path = id;

        Log.v("path", path);
        Bitmap b = BitmapFactory.decodeFile(path);
        if (b==null){
        Log.v("tag",";( ");
        }
        else{
        Bitmap resizedBitmap = Bitmap.createScaledBitmap(b, 230, 230, true);
        image_v.setImageBitmap(resizedBitmap);

    }
    }

}

我如何在其他类中使用这个适配器类:

String[] from = new String[]{ DbManager.Image_path,DbManager.babyName,DbManager.babydob,DbManager.b_date}; 
        int[] to = new int[] {R.id.list_image, R.id.title,R.id.artist,R.id.duration};                   
        MySimpleCursorAdapter   Adapter = new MySimpleCursorAdapter(this, R.layout.list_row, c1, from, to);  
        updateListitem();
        list.setAdapter(Adapter);
        list.setOnItemClickListener(listOnItemClickListener);}

这是logcat:

07-03 06:16:58.687: E/AndroidRuntime(1729): FATAL EXCEPTION: main
07-03 06:16:58.687: E/AndroidRuntime(1729): java.lang.NoClassDefFoundError: com.example.tottal.baby.care.MySimpleCursorAdapter
07-03 06:16:58.687: E/AndroidRuntime(1729):     at com.example.tottal.baby.care.baby_list.onCreate(baby_list.java:62)
07-03 06:16:58.687: E/AndroidRuntime(1729):     at android.app.Activity.performCreate(Activity.java:5104)
07-03 06:16:58.687: E/AndroidRuntime(1729):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
07-03 06:16:58.687: E/AndroidRuntime(1729):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
07-03 06:16:58.687: E/AndroidRuntime(1729):     at android.app.ActivityThread.startActivityNow(ActivityThread.java:2023)
07-03 06:16:58.687: E/AndroidRuntime(1729):     at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:135)
07-03 06:16:58.687: E/AndroidRuntime(1729):     at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:347)
07-03 06:16:58.687: E/AndroidRuntime(1729):     at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:749)
07-03 06:16:58.687: E/AndroidRuntime(1729):     at android.widget.TabHost.setCurrentTab(TabHost.java:413)
07-03 06:16:58.687: E/AndroidRuntime(1729):     at android.widget.TabHost$2.onTabSelectionChanged(TabHost.java:154)
07-03 06:16:58.687: E/AndroidRuntime(1729):     at android.widget.TabWidget$TabClickListener.onClick(TabWidget.java:546)
07-03 06:16:58.687: E/AndroidRuntime(1729):     at android.view.View.performClick(View.java:4204)
07-03 06:16:58.687: E/AndroidRuntime(1729):     at android.view.View$PerformClick.run(View.java:17355)
07-03 06:16:58.687: E/AndroidRuntime(1729):     at android.os.Handler.handleCallback(Handler.java:725)
07-03 06:16:58.687: E/AndroidRuntime(1729):     at android.os.Handler.dispatchMessage(Handler.java:92)
07-03 06:16:58.687: E/AndroidRuntime(1729):     at android.os.Looper.loop(Looper.java:137)
07-03 06:16:58.687: E/AndroidRuntime(1729):     at android.app.ActivityThread.main(ActivityThread.java:5041)
07-03 06:16:58.687: E/AndroidRuntime(1729):     at java.lang.reflect.Method.invokeNative(Native Method)
07-03 06:16:58.687: E/AndroidRuntime(1729):     at java.lang.reflect.Method.invoke(Method.java:511)
07-03 06:16:58.687: E/AndroidRuntime(1729):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
07-03 06:16:58.687: E/AndroidRuntime(1729):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
07-03 06:16:58.687: E/AndroidRuntime(1729):     at dalvik.system.NativeStart.main(Native Method)
4

1 回答 1

2

试试这个。 解决方案

我会解释一下,实际上暂时无法访问代码

于 2013-07-04T05:30:52.440 回答