0

I'm trying to create a dialog with a clock on the top and days of the week at the bottom. But I'm not able to place the clock above the setMultiChoiceItems.

public void onFabClick(){


    clock = new TextView(this);

    //Setting Listener for Clock.
    clock.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            //Calling Time picker
            timepicker();

        }
    });

    AlertDialog.Builder adb = new AlertDialog.Builder(this);
    adb.setView(clock);
    final String[] Colors = new String[]{
            "Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"
    };
    final ArrayList<Integer> selectedItems = new ArrayList<Integer>();
    final boolean[] preCheckedItems = new boolean[]{
            true,true,true,true,true,true,true
    };
    adb.setMultiChoiceItems(Colors, preCheckedItems, new DialogInterface.OnMultiChoiceClickListener(){
        @Override
        public void onClick(DialogInterface dialog, int which, boolean isChecked){
//Insert Code here
    });

    adb.setPositiveButton("Ok", new DialogInterface.OnClickListener(){
        @Override
        public void onClick(DialogInterface dialog, int which){
           //Test
            Log.d("alertdialog!!!!","Clicked OK");
        }
    });

    adb.setNeutralButton("Cancel", null});

    adb.show();
}
FluffyKitten
  • 13,824
  • 10
  • 39
  • 52
svaithin
  • 75
  • 1
  • 7

1 Answers1

0

You can create layout file with all items and order you exactly need. Then just use .setView(view); to your AlertDialog.Builder() Something like this