java - OkHttp in android for making network requests -
What am I trying to do? :: I try What did I do :: from MyCode : Main activity. Java is facing an error :: in line The customer can not be resolved in a variable How to solve it! > Now I am facing the error: line The method executed (request) is required for OkHttpClient You are receiving this exception because no such method . I think you should use
Import android.app.Activity; Importroid.os.Bundle; Import android.util.log; Import com.squareup.okhttp.OkHttpClient; Import com.squareup.okhttp.internal.http.Request; Import com.squareup.okhttp.internal.http.Response; Public class increases main activity activity {@ Override Protected Zero to Create (Bundle Saved Instantstate) {Super.New (Saved Instantstate); SetContentView (R.layout.activity_main); Request request = new request the creator (). Url ("https://raw.github.com/square/okhttp/master/README.md") .build (); Feedback feedback = client.execute (request); Log D. ("Answer", reaction.boo (). String ()); }}
response = client.execute (request ); I am getting the error like this:
{update}
Expands public class main activity (OKHTP Client Client = New OKHTP Client (); @ Override Protected Zero (Creates Bundle InstantState) {Super .Net (savedinstenstate); setContentView (R.layout.activity_main); request request = new request.bilder () .url ("https://raw.github.com/square/okhttp/master/README.md" ) .build (); Response feedback = client.execute (request); Log D. ("Answer", reaction.bio (). String ());}}
feedback feedback = client Execute (request);
as the method execution (request) type OkHttpClient
for execute (request )
OkHttpClient . Instead, it is applied to the
call object, which is achieved by using the
OkHttpClient object as follows:
call calls = Client.NewColl (request); Feedback response = call.execute ();
feedback feedback = client.newCall (request). Execute ();
Response = instead of client.execute (request)
Comments
Post a Comment