1

I'm building a small app which displays a multichoice dialog. What i need to do, is to change the checkbox image. I want to replace the green tick, with my custom bitmap. Is there a simple way to do this? Can it be done without creating a custom adapter? Thanks.

Dusan
  • 3,284
  • 6
  • 25
  • 46

1 Answers1

0

you can use this code to show a dialog box to user:

btn2.setOnClickListener(new OnClickListener() 
    {
        @Override
        public void onClick(View v) 
        {
            Builder alert2 = new AlertDialog.Builder(MainActivity.this);
            alert2.setTitle("pick one of below");
            alert2.setSingleChoiceItems(items, 0, new DialogInterface.OnClickListener() 
            {
                @Override
                public void onClick(DialogInterface dialog, int which) 
                {
                    itemsCecked[which] = true;
                }
            });
            alert2.setPositiveButton("OK", new DialogInterface.OnClickListener() 
            {   
                @Override
                public void onClick(DialogInterface dialog, int which) 
                {
                    for(int i=0; i<items.length ; i++)
                    {
                        if(itemsCecked[i]==true)
                        {
                            txt.setText(items[i]);
                        }
                    }
                }
            });

use this in oncreate() method.

mahdi
  • 660
  • 10
  • 20