Я создал проект, в котором я использую несколько редактируемых текстов и одну кнопку при нажатии кнопки, он показывает некоторые специфические c данные в моем пользовательском recyclerview, пока здесь он не работает нормально. Теперь я хочу показать все данные, которые пользователь ввел в мой множественный текст редактирования, поэтому я создал настраиваемый класс alerttdialobox, в котором, когда пользователь щелкает настраиваемый элемент recyclerview, отображаются все данные в поле alerttdailog, я не могу установить значения в представлении окна alerttdialog .
// это основной метод в моем основном классе, где он добавляет мои данные в адаптер представления Recycler
public void final_step() {
recyclerView = findViewById(R.id.recycler_view_last1);
mAdapter1 = new Land_adapters(last_Year1,context);
recyclerView.setHasFixedSize(true);
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext());
recyclerView.setLayoutManager(mLayoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(mAdapter1);
recyclerView.addOnItemTouchListener(new RecyclerTouchListener(getApplicationContext(), recyclerView, new RecyclerTouchListener.ClickListener() {
@Override
public void onClick(View view, int position) {
alert_box.startLoadingDialog();
// Here I want that my alerbox have 6 text which should be shown according to postion seleted of recycler
}
@Override
public void onLongClick(View view, int position) {
}
}));
Land_list last_year1 = new Land_list(land_acre, land_kanal, village_selected1, land_marla, district_selected1, teshil_selected1, block_selected1);
last_Year1.add(last_year1);
mAdapter1.notifyDataSetChanged();
}
// Адаптер моего представления Recycler
public class Land_adapters extends RecyclerView.Adapter<Land_adapters.Myviewholder> {
private List<Land_list> Land_list;
Context context;
public class Myviewholder extends RecyclerView.ViewHolder {
public TextView acre1, marla1, kanal1,village_anme,district_name1,s_no1;
public Myviewholder(View view) {
super(view);
village_anme = view.findViewById(R.id.land__view);
district_name1 = view.findViewById(R.id.land_district_view);
s_no1 = view.findViewById(R.id.land_sn0_view);
}
}
public Land_adapters(List<Land_list> land_list, Context context) {
this.Land_list = land_list;
this.context = context;
}
@NonNull
@Override
public Land_adapters.Myviewholder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.land_list, parent, false);
return new Myviewholder(itemView); }
@Override
public void onBindViewHolder(@NonNull Myviewholder holder, int position) {
final Land_list current_year= Land_list.get(position);
holder.district_name1.setText(current_year.getDistrict_name());
holder.village_anme.setText(current_year.getVillage_name());
holder.s_no1.setText(String.valueOf(position+1));
}
@Override
public int getItemCount() {
return Land_list.size();
}
}
// класс pojo моего recyclerview
public class Land_list {
private String acre,kanal,marla,village_name,district_name,teshil_name,block_name;
private int s_no;
public Land_list(String acre, String kanal, String village_name, String marla , String district_name, String teshil_name, String block_name){
this.acre = acre;
this.kanal = kanal;
this.village_name = village_name;
this.district_name = district_name;
this.marla = marla;
this.block_name = block_name;
this.teshil_name = teshil_name;
}
public String getTeshil_name() {
return teshil_name;
}
public Land_list setTeshil_name(String teshil_name) {
this.teshil_name = teshil_name;
return this;
}
public String getBlock_name() {
return block_name;
}
public Land_list setBlock_name(String block_name) {
this.block_name = block_name;
return this;
}
public String getAcre() {
return acre;
}
public Land_list setAcre(String acre) {
this.acre = acre;
return this;
}
public String getKanal() {
return kanal;
}
public Land_list setKanal(String kanal) {
this.kanal = kanal;
return this;
}
public String getMarla() {
return marla;
}
public Land_list setMarla(String marla) {
this.marla = marla;
return this;
}
public String getVillage_name() {
return village_name;
}
public Land_list setVillage_name(String village_name) {
this.village_name = village_name;
return this;
}
public String getDistrict_name() {
return district_name;
}
public Land_list setDistrict_name(String district_name) {
this.district_name = district_name;
return this;
}
public int getS_no() {
return s_no;
}
public Land_list setS_no(int s_no) {
this.s_no = s_no;
return this;
}
}
класс настраиваемого окна alerttdialog
public class Alertbox_dialog {
private Activity activity;
private AlertDialog dialog;
private List<Land_list> last_Year1 = new ArrayList<Land_list>();
Alertbox_dialog(Activity myActivity){
activity = myActivity;
}
void startLoadingDialog(){
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
LayoutInflater inflater = activity.getLayoutInflater();
View dialogView = inflater.inflate(R.layout.alertbox_recycler, null,false);
//THESE ARE THE TEXT VIEW WHERE I WANT TO SHOW SPECIF ITEMS AT SPECIF POSTION IN RECYCLER
TextView dist= dialogView.findViewById(R.id.alert_text_dist);
TextView teshil= dialogView.findViewById(R.id.alert_text_teshil);
TextView block= dialogView.findViewById(R.id.alert_text_block);
TextView village= dialogView.findViewById(R.id.alert_text_village);
TextView acre= dialogView.findViewById(R.id.alert_text_acre);
TextView kanal= dialogView.findViewById(R.id.alert_text_kanal);
TextView marla= dialogView.findViewById(R.id.alert_text_marla);
builder.setView(dialogView);
builder.setCancelable(false);
dialog = builder.create();
dialog.show();
}
}