常見api位址
圖靈機器人:http://www.tuling123.com
http://www.tuling123.com/openapi/api?key=6af9822f5491fadfc142b53818bbd63a
常見報錯資訊
報錯:Syntax error on token “int”, Dimensions expected after this token
原因:引用類型和原始類型沒有搞清楚!
Java 提供兩種不同的類型:引用類型和原始類型(或内置類型)。
Java為每個原始類型提供了封裝類,int是java的原始資料類型,Integer是java為int提供的封裝類。
報錯:The method setOnClickListener(View.OnClickListener) in the type View is not applicable for the arguments (HelloworldActivity.MyButtonListener)
原因:Import的包導錯了
将import android.content.DialogInterface.OnClickListener;
改為import android.view.View.OnClickListener;
報錯:Missing contentDescription attribute onimage
解決:在可視化布局中點選右上角的紅色按鈕,選擇fix或suppress issue。
快捷鍵
Windows常用快捷鍵:https://baike.so.com/doc/85411-90156.html
設定
設定則自動補全代碼:
1、Window->Preference->Java->Editor->Content Assist->Auto activation triggers for Java->修改為“
._abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
”
2、Window->Preference->XML->XML File->Editor->Content Assist->prompt when these characters are inserted->
<=:.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRESTUVWXYZ(,
xml檔案的打開方式:在xml檔案上點右鍵 -> openWith -> 選擇XML Editor
單獨在logcat中檢視System.out輸出的資訊:
打開logcat面闆:Window->show view–>other–>Android->Logcat。
可以在logcat界面點那個綠色的“+”号,在Filter name 和 By log tag裡面均填入System.out,
如果找不到綠色的“+”,在logcat的右上角找到clear log旁邊的display saved filters view點選。