-
}
-
JSONObject jObject = new JSONObject(sb.toString());
-
int count = jObject.getInt(“count”);
-
int index = count == 0 ? 0 : new Random().nextInt() % count;
-
JSONArray jArray = jObject.getJSONArray(“result”);
-
JSONObject obj = jArray.getJSONObject(index);
-
return obj.getString(“lrc”);
-
} catch (MalformedURLException e) {
-
// TODO Auto-generated catch block
-
e.printStackTrace();
-
} catch (IOException e) {
-
// TODO Auto-generated catch block
-
e.printStackTrace();
-
} catch (JSONException e) {
-
// TODO Auto-generated catch block
-
e.printStackTrace();
-
}
-
return null;
-
}
-
// 歌手,歌曲名中的空格进行转码
-
public String Encode(String str) {
-
try {
-
return URLEncoder.encode(str.trim(), “utf-8”);
-
} catch (UnsupportedEncodingException e) {
-
// TODO Auto-generated catch block
-
e.printStackTrace();
-
}
-
return str;
-
}
-
// 歌词文件网络地址,歌词文件本地缓冲地址
-
public boolean wrtieContentFromUrl(String urlPath, String lrcPath) {
android音乐播放器开发在线加载歌词,android自定义view面试
最新推荐文章于 2022-04-26 23:17:30 发布