第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

錯(cuò)誤:數(shù)據(jù)庫(kù)類中的方法 cleanCart 無(wú)法應(yīng)用于給定類型

錯(cuò)誤:數(shù)據(jù)庫(kù)類中的方法 cleanCart 無(wú)法應(yīng)用于給定類型

偶然的你 2024-01-05 10:26:48
在做一個(gè)食品應(yīng)用程序項(xiàng)目時(shí),我的 cleanCart() 方法遇到了問(wèn)題。這是我的堆棧跟蹤:error: method cleanCart in class Database cannot be applied to given types;                new Database(getBaseContext()).cleanCart();                                              ^  required: Order  found: no arguments  reason: actual and formal argument lists differ in lengthNote: Some input files use or override a deprecated API.Note: Recompile with -Xlint:deprecation for details.1 errorFAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':app:compileDebugJavaWithJavac'.> Compilation failed; see the compiler error output for details.這是我的 Cart.java 類private void showAlertDialogue() {        AlertDialog.Builder alertDialogue=new AlertDialog.Builder(Cart.this);        alertDialogue.setTitle("One more step!");        alertDialogue.setMessage("Enter your address :");        final EditText edtAddress=new EditText(Cart.this);        LinearLayout.LayoutParams lp=new LinearLayout.LayoutParams(                LinearLayout.LayoutParams.MATCH_PARENT,                LinearLayout.LayoutParams.MATCH_PARENT        );        edtAddress.setLayoutParams(lp);        alertDialogue.setView(edtAddress);  //Add edit text to alert dialog        alertDialogue.setIcon(R.drawable.ic_shopping_cart_black_24dp);        alertDialogue.setPositiveButton("YES", new DialogInterface.OnClickListener() {            @Override            public void onClick(DialogInterface dialog, int which) {                //Create new request                Request request=new Request(                        Common.currentUser.getPhone(),                        Common.currentUser.getName(),                        txtTotalPrice.getText().toString(),                        edtAddress.getText().toString(),                        cart                );
查看完整描述

1 回答

?
慕妹3146593

TA貢獻(xiàn)1820條經(jīng)驗(yàn) 獲得超9個(gè)贊

這有點(diǎn)難以理解,但看起來(lái)這會(huì)給您帶來(lái)錯(cuò)誤,因?yàn)槟腸leanCart方法有一個(gè)Order order需要根據(jù)數(shù)據(jù)庫(kù)類傳入的參數(shù)。


但是,當(dāng)您調(diào)用該方法時(shí),調(diào)用該方法時(shí)不帶任何參數(shù)。


因?yàn)槟緵](méi)有Order在cleanCart方法中使用對(duì)象,所以可以從方法中刪除參數(shù),如下所示:


數(shù)據(jù)庫(kù)類:


public void cleanCart() { // remove parameter

    SQLiteDatabase db = getReadableDatabase();

    String query = String.format("DELETE FROM OrderDetail");


    db.execSQL(query);

}


查看完整回答
反對(duì) 回復(fù) 2024-01-05
  • 1 回答
  • 0 關(guān)注
  • 151 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)