0
我已經看過大多數有關他們的prestashop.Some的問題是說,有在這個環節沒有API的prestashop.look如何將android應用程序連接到PrestaShop?
http://online.fastchef.in/api/customers/12?output_format=JSON
它給結果JSON form.only事是解析這個form.but仍m到處錯誤 我的代碼:MainActivity
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(API_BASE_URL)
.addConverterFactory(GsonConverterFactory.create(gson))
.build();
int id=Integer.parseInt(mEditText.getText().toString());
PrestaShopClient client =retrofit.create(PrestaShopClient.class);
Call<Customer> hj=client.getCustomer(id);
hj.enqueue(new Callback<Customer>() {
@Override
public void onResponse(Call<Customer> call, Response<Customer> response) {
int status = response.code();
Customer customer = response.body();
mTextView.setText(customer.getFirstname());
}
@Override
public void onFailure(Call<Customer> call, Throwable t) {
}
});
PrestaShopCLient:
public interface PrestaShopClient {
@GET("customers/{id}?output_format=JSON")
Call<Customer> getCustomer(@Path("id") int id);
}
幫我傢伙...這個問題我花了一天半次(