0

我的应用程序突然无法在页面之间交换,并且出现以下错误,我无法弄清楚我所做的更改,或者为了做到这一点而进行的更改。这是错误。我不知道您需要我发布哪个代码,所以请告诉我;

10-17 16:02:51.720: D/dalvikvm(4436): newInstance failed: no <init>()
10-17 16:02:51.720: D/AndroidRuntime(4436): Shutting down VM
10-17 16:02:51.720: W/dalvikvm(4436): threadid=1: thread exiting with uncaught exception (group=0x40c6a1f8)
10-17 16:02:51.730: E/AndroidRuntime(4436): FATAL EXCEPTION: main
10-17 16:02:51.730: E/AndroidRuntime(4436): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.directenquiries.assessment.tool/com.directenquiries.assessment.tool.AddAsset}: java.lang.InstantiationException: can't instantiate class com.directenquiries.assessment.tool.AddAsset; no empty constructor
10-17 16:02:51.730: E/AndroidRuntime(4436):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1894)
10-17 16:02:51.730: E/AndroidRuntime(4436):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
10-17 16:02:51.730: E/AndroidRuntime(4436):     at android.app.ActivityThread.access$600(ActivityThread.java:128)
10-17 16:02:51.730: E/AndroidRuntime(4436):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
10-17 16:02:51.730: E/AndroidRuntime(4436):     at android.os.Handler.dispatchMessage(Handler.java:99)
10-17 16:02:51.730: E/AndroidRuntime(4436):     at android.os.Looper.loop(Looper.java:137)
10-17 16:02:51.730: E/AndroidRuntime(4436):     at android.app.ActivityThread.main(ActivityThread.java:4517)
10-17 16:02:51.730: E/AndroidRuntime(4436):     at java.lang.reflect.Method.invokeNative(Native Method)
10-17 16:02:51.730: E/AndroidRuntime(4436):     at java.lang.reflect.Method.invoke(Method.java:511)
10-17 16:02:51.730: E/AndroidRuntime(4436):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
10-17 16:02:51.730: E/AndroidRuntime(4436):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
10-17 16:02:51.730: E/AndroidRuntime(4436):     at dalvik.system.NativeStart.main(Native Method)
10-17 16:02:51.730: E/AndroidRuntime(4436): Caused by: java.lang.InstantiationException: can't instantiate class com.directenquiries.assessment.tool.AddAsset; no empty constructor
10-17 16:02:51.730: E/AndroidRuntime(4436):     at java.lang.Class.newInstanceImpl(Native Method)
10-17 16:02:51.730: E/AndroidRuntime(4436):     at java.lang.Class.newInstance(Class.java:1319)
10-17 16:02:51.730: E/AndroidRuntime(4436):     at android.app.Instrumentation.newActivity(Instrumentation.java:1027)
10-17 16:02:51.730: E/AndroidRuntime(4436):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1885)
10-17 16:02:51.730: E/AndroidRuntime(4436):     ... 11 more

汤姆

编辑:添加资产代码

 public AddAsset(View view){

        String Barcode = tbBarcode.getText().toString();
        String LongDescription = tbLongDescription.getText().toString();
        String LocalReference = tbLocalReference.getText().toString();
        String Quantity = tbQuantity.getText().toString();

        String VisualCondition = "VisualCondition";

        String NewAssetStationObjectID = DBFunctions.getNextID(Global.StationID, "StationObjects");

        if(DBFunctions.isBarcodeUnique(Barcode, StationObjectID).equals("True")){

            DBFunctions.addAsset(NewAssetStationObjectID, Barcode, AssetType, AssetGroup, AssetSubGroup, " ", LocalReference, LongDescription, VisualCondition, Quantity, StationObjectID, " ", "Y");   

        } else {

            ShowAlert("Duplicate Barcode", "This barcode has already been used");
        }


    }
4

1 回答 1

0

你的类AddAsset缺少一个空的(又名 default )构造函数

尝试添加构造函数

public AddAsset() { }

注意

public AddAsset(View view) { ... }

不是一个空的构造函数,因为它有参数。

于 2012-10-17T15:08:28.297 回答