GridView into CustomDialog doesn't show ArrayList String

  • Replies:1
  • OpenNot stickiedUnanswered
  • Forum posts: 1

Jul 30, 2015 12:41:34 PM via Website

Hi everybody, I have a problem with the creation of GridView into a CustomDialog. this is the code:

LayoutInflater lf = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View mView = lf.inflate(R.layout.custom_dialog, null);
    grid = (GridView) mView.findViewById(R.id.Grid);

    gridArray.add(MONUMENTI);
    gridArray.add(PANORAMI);
    gridArray.add(SELFIE);
    gridArray.add(NOCATEGORIA);

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(mContext,
            android.R.layout.simple_list_item_1, gridArray);
    grid.setAdapter(adapter);

    dialog = new AlertDialog.Builder(mContext);

    LayoutInflater inflater = CameraActivity.this.getLayoutInflater();

    dialog.setView(inflater.inflate(R.layout.custom_dialog,null));

    alert = dialog.create();

gridArray is a ArrayList of Strings.

I don't understand why I can't see the Strings into CustomDialog.

thankyou so much

  • Forum posts: 208

Aug 5, 2015 7:17:56 AM via Website

Check if items aree adding the grid array or not. count the length first.