我想在改装中发送具有不同数据类型的多个参数。改装后服务不工作,也不提供错误代码:
应用程序编程接口
public class Api {
private static Retrofit retrofit = null;
public static ApiInterface getClient() {
// change your base URL
if (retrofit==null) {
retrofit = new Retrofit.Builder()
.baseUrl("https://ezyviewbooker.com/api/auth_v1/")
.addConverterFactory(GsonConverterFactory.create())
.build();
}
//Creating object for our interface
ApiInterface api = retrofit.create(ApiInterface.class);
return api; // return the APIInterface object
}
}
我的接口代码:
public interface ApiInterface {
@FormUrlEncoded // annotation used in POST type requests
@POST("candidate_resume_upload_store")
// API's endpoints
Call<Void> registration(@Field("category_id") String category_id,
@Field("full_name") String full_name,
@Field("country") String country,
@Field("address") String address,
@Field("personal_question_id") ArrayList<String> personal_question_id,
@Field("personal_answer_id") ArrayList<String> personal_answer_id,
@Field("competencies_skills") ArrayList<String>
competencies_skills,
@Field("work_responsibilities") ArrayList<String>
work_responsibilities,
@Field("interest_hobbies") ArrayList<String>
interest_hobbies,
@Field("societies") ArrayList<String> societies,
@Field("reference_name") String reference_name,
@Field("reference_position") String reference_position,
@Field("reference_email") String reference_email,
@Field("reference_number") String reference_number,
@Field("token") String token,
@Field("city") String city);
}
主要活动家庭活动:
public class Home extends AppCompatActivity {
ArrayList<String> interest;
ArrayList<String> question;
ArrayList<String> answers;
ArrayList<String> skills;
ArrayList<String> resposnsibilties;
ArrayList<String> socities;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
interest=new ArrayList<String>();
question=new ArrayList<String>();
answers=new ArrayList<String>();
skills=new ArrayList<String>();
resposnsibilties=new ArrayList<String>();
socities=new ArrayList<String>();
socities.add("IPSC");
socities.add("IPSC_@");
interest.add("IPSC");
interest.add("IPSC_@");
question.add("11");
question.add("20");
question.add("21");
question.add("22");
answers.add("9");
answers.add("10");
resposnsibilties.add("app developing");
resposnsibilties.add("Team work");
skills.add("Swift");
skills.add("JAVA");
signUp();
}
private void signUp() {
// display a progress dialog
final ProgressDialog progressDialog = new ProgressDialog(Home.this);
progressDialog.setCancelable(false); // set cancelable to false
progressDialog.setMessage("Please Wait"); // set message
progressDialog.show(); // show progress dialog
(Api.getClient().registration("1",
"Khan",
"pakistan",
"Baheria town",
question,
answers,
skills,
resposnsibilties,
interest,
socities,
"Jon",
"Senior Graphic Designer",
"jon@gmail.com ",
"09009456788",
"eyJ",
"karachi")).enqueue(new Callback<Void>() {
@Override
public void onResponse(Call<Void> call, Response<Void> response) {
progressDialog.dismiss();
}
@Override
public void onFailure(Call<Void> call, Throwable t) {
Log.d("response", t.getStackTrace().toString());
Toast.makeText(Home.this,
t.getStackTrace().toString(),Toast.LENGTH_LONG).show();
progressDialog.dismiss();
}
});
}
}
有五个数组列表,例如:兴趣,soicties等,我想和其他字符串,如名称地址等一起发送
2条答案
按热度按时间ejk8hzay1#
a6b3iqyw2#
尝试此代码-