我有一个用于 recyclerview 的适配器。我从我的活动传递数组列表的地方,比如数据是具有一些数据的 ArrayList。
AlternativeAdapter alternativeAdapter= new AlternativeAdapter(AlternativeActivity.this, data);
recyclerView.setAdapter(alternativeAdapter);
Run Code Online (Sandbox Code Playgroud)
在 AlternativeAdapter 类中,我有一个文本视图和复选框。我可以用复选框显示所有文本项。
在 AlternativeAdapter 类中
public class AlternativeCurrencyAdapter extends RecyclerView.Adapter<AlternativeCurrencyAdapter.ViewHolder>{
ArrayList<String> currencyListArray;
Context context;
View view1;
ViewHolder viewHolder1;
TextView textView;
private int selectedPosition = -1;// no selection by default
public AlternativeCurrencyAdapter(Context context1, ArrayList<String> currencyListArray){
this.currencyListArray = currencyListArray;
context = context1;
}
public class ViewHolder extends RecyclerView.ViewHolder{
public TextView username;
public CheckBox chkSelected;
public ViewHolder(View v){
super(v);
username = (TextView)v.findViewById(R.id.username);
chkSelected = (CheckBox) v.findViewById(R.id.chkSelected);
itemView.setOnClickListener(new View.OnClickListener(){
@Override
public …Run Code Online (Sandbox Code Playgroud) 我想在改造界面中添加或追加我的网址.接口代码如下.
public interface PostInterface {
@POST("api/v1/app/user/resetpassword/token")
@Headers({
"Content-Type: application/json"
})
Call<JsonObject> getResult(@Body JsonObject body);
}
Run Code Online (Sandbox Code Playgroud)
在给定的URL @POST("api/v1/wallet/user/resetpassword/token ")中,我想附加标记值.它是活动变量的值.
我的活动代码在下面给出了我称之为方法的地方.
try {
JsonObject params = new JsonObject();
params.addProperty("email", email);
params.addProperty("signup_mode", "mobile");
PostInterface apiService =TestApiClient.getClient(this).create(PostInterface.class);
Call call = apiService.getResult(params);
call.enqueue(new Callback() {
@Override
public void onResponse(Call call, Response response) {
Run Code Online (Sandbox Code Playgroud)