MyAdapter and ArrayAdapter issues in Fragment

17 Views Asked by At

Here are my codes:

MyAdapter adapter = new MyAdapter(this, n,s,t,image);
        list_view.setAdapter(adapter); //my other problem

ArrayAdapter arrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, arrayList); //my other problem

        list_view.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int pozition, long l) {

                AlertDialog.Builder dialogOlusturucu = new AlertDialog.Builder(FragmentTakvim.this); //the problem is here

                long veriid = arrayAdapter.getItemId(pozition);
                String listeid = String.valueOf(veriid);

                dialogOlusturucu.setMessage("Tarih ve Aktivite Silinsin Mi?")
                        .setCancelable(false)
                        .setPositiveButton("Evet", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialogInterface, int i) {
                                Verisil(listeid);
                            }
                        }).setNegativeButton("Hayır", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialogInterface, int i) {
                                dialogInterface.dismiss();
                            }
                        });
                dialogOlusturucu.create().show();
            }
        });

    return v;} ```

here are my problem:
```java
Builder(android.content.Context)' in 'androidx.appcompat.app.AlertDialog.Builder' cannot be applied to '(com.nisanurturan.lastapp.FragmentTakvim)'

I've tried:

AlertDialog.Builder alertBuilder = new AlertDialog.Builder(v.getContext());

AlertDialog alertDialog = new AlertDialog.Builder(getActivity()).create();

AlertDialog alertDialog = new AlertDialog.Builder(getActivity(), R.style.Theme_AppCompat_Dialog_Alert).create();

but also it didn't work

also I've other problems too but i don't think the other problems according to this problem but I've mark if you think other problems are important too.

0

There are 0 best solutions below