Home > Mobile >  Android fan API online music player lyrics lyrics
Android fan API online music player lyrics lyrics

Time:12-04

Using OKHTTP problems to obtain network lyrics, great god, please help me solve the,
Public String get (String url) throws IOException {
OkHttpClient client=new OkHttpClient (.) newBuilder ()
.build();
Request the Request=new Request. Builder ()
Url (url)
Method (" GET ", null)
.build();
The Response the Response=client. NewCall (request). The execute ();
Return the response body (). The string ();
}

Public void getLyricFromGet () {
New Thread () {
@ Override
Public void the run () {
Super. The run ();
Try {
String Str=songList. Get (I). The song;
Strings Str1=songList. Get (I). Singer;
String [] STR=STR. The split (" [] ");
STR [0]. The trim ();
//curl 'http://gecimi.com/api/lyric/sports/Beyond'
The String result=get (" http://gecimi.com/api/lyric/"+ STR [0]).
System. The out. Println (STR [0]).
The e (" TAG ", result);
The Message MSG=Message. Obtain ();
MSG. What=GET;
MSG. Obj=the result;
Handler. SendMessage (MSG);
} the catch (IOException e) {
e.printStackTrace();
}
}
}.start();

}
Can only get the lyrics to a song, when I click other or up and down the song will appear {" code ": 0," count ": 0," result ": []}
  • Related