0
每次我試圖從我的Android資源字符串我得到一個錯誤讀取網站Android的字符串資源網站無法正常工作
<string name="API">http://google.com</string>
和我的Java代碼
String a = getText(R.string.API).toString()+"search?q=";
每次我試圖從我的Android資源字符串我得到一個錯誤讀取網站Android的字符串資源網站無法正常工作
<string name="API">http://google.com</string>
和我的Java代碼
String a = getText(R.string.API).toString()+"search?q=";
嘗試使用的getString( resld)而不是getText()也許它有幫助。
String a = getString(R.string.API)+"search?q=";
這是無效的網址'http://google.comsearch?q='。
您必須在xml或java代碼中添加斜線(/)。
<string name="API">http://google.com/</string>
或
String a = getText(R.string.API).toString()+"https://stackoverflow.com/search?q=";