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.
Asked
Active
Viewed 629 times
1
-
You can style your checkbox widget instead. Check http://stackoverflow.com/a/10139809/1082344 – IsaacCisneros Dec 30 '12 at 22:50
-
1Not *can* but **should**. – dmon Dec 30 '12 at 23:25
-
[check this library](http://androidcustomviews.com/portfolio/multichoiceadapter/) may be it helped you. – Girish Bhutiya Aug 07 '13 at 05:46
-
Did you find a solution to this problem? – smoothBlue Jun 28 '20 at 19:54
-
I don't think, there is a simple solution for that. I did it the right way - created a custom layout and a custom array adapter – Dusan Jun 30 '20 at 11:05
1 Answers
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