android遇到的BUG

來源:互聯網
上載者:User

標籤:

1BUG,(sqlite有關)

遇到:     attempt to re-open an already-closed object: SQLiteDatabase: /data/data/com.example.biye/databases/ToDothing.db

嘗試重新開啟一個已經關閉的對象:sqlitedatabase......

解決:查看前面的方法裡有關閉資料庫的操作沒?如:db.close();   將其注釋掉或刪除。

2.BUG,(EditText賦值有關)

遇到:EditText edit31.setText("就是不讓你賦值");
研究:報錯null 指標異常nullpointerexception;

        id錯了沒?1. <EditText    android:id="@+id/edit31" />     2 .  edit31 = (EditText) findViewById(R.id.edit31);    沒錯啊!!糾結

找出原因:edit31 = (EditText) findViewById(R.id.edit31); 位置在按鈕事件後面,執行btn事件時程式是沒有將UI介面上EditText賦值給edit31,所以edit31是null。

解決:edit31 = (EditText) findViewById(R.id.edit31); 位置調到setOnClickListener(); 上面去,bug解決。如:

3.BUG(sqlite有關)

遇到:unrecognized token。。。。一句sql語句  報錯地址: db.update("thing", cv, "thing_name=" + name, null);  //name是傳過來的參數String類型

研究:sql語句有問題,name是字元類型,sql語句中應該加  ‘‘  單引號

解決:  1.   String[] str={name};   db.update("thing", cv, "thing_name=?", str);

          2    db.update("thing", cv, "thing_name=‘"+name+"‘", null);

4.BUG(sqlite有關)

遇到:NotFoundException: String resource ID #0x4

研究找出原因:Toast.makeText(context, reslut.length, 5000).show();  //reslut.length是int類型,Toast.makeText()裡面需要String類型

解決:就要將int轉化成String,或在該int值後面+"" 如:Toast.makeText(context, reslut.length+"", 5000).show();

5.BUG (程式不運行)

遇到:The connection to adb is down, and a severe error has occured.

 研究:adb串連發生了問題,去百度搜了下

解決: 方法1.cmd中adb kill-server,然後adb -startserver   (我試了,並沒有什麼卵用)               

     cmd裡找到到你的android SDK 的platform-tools下, :

         方法2.方法1不管用,那麼在工作管理員中殺死adb.exe,然後重啟Eclipse。(這個到是解決了,不要關閉虛擬手機的情況下,不然找不到adb.exe)

 

 

持續積累中,如有錯誤請幫忙指出,好的建議請賜教,有的解決方案也是在晚上搜尋的,謝謝

 

android遇到的BUG

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.