Retrofit 2.0を使用してURLを構築しようとしています。問題は、それがこのURLを返しますです:Retrofit 2.0が不正なURLを返す
http://query.yahooapis.com/v1/public/yql?&q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22YHOO%22)&format=json%26diagnostics%3Dtrue%26env%3Dstore%253A%252F%252Fdatatables.org%252Falltableswithkeys%26callback%3D
私はそれが代わりにこのURLを返すようにしたい:
https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22YHOO%22)&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=
誰もが、私はこの問題を解決しますどのようにアドバイスしてくださいことはできますか?ここで
は、URLを返すコードは次のとおりです。ここで
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(API_BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
mQuoteAdapter = new QuoteAdapter(items);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.question_list);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(mQuoteAdapter);
StockApiServiceInterface stockApiServiceInterface = retrofit.create(StockApiServiceInterface.class);
stockApiServiceInterface.listQuotes(
"select * from yahoo.finance.quotes where symbol in (\"YHOO\")",
"json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=")
.enqueue(new Callback<ResultWrapper>() {
@Override
public void onResponse(Response<ResultWrapper> response) {
response.body().getQuery().getResults().getQuote().getAsk();
}
@Override
public void onFailure(Throwable t) {
Log.e("listQuotes threw: ", t.getMessage());
}
});
は私StockApiServiceです:
public final class StockApiService {
public interface StockApiServiceInterface {
@GET("v1/public/yql?")
Call<ResultWrapper> listQuotes(
@Query("q") String query,
@Query("format") String env
);
}
}