Question: Does anyone know how to select(check) all the check boxes in column of handsontable by checking the first check box of a particular column. I tried all the possible options to get it done but I,m not able to do it by any means. 

Here is the code,

```
  function getCarData() {
    return [
      { available: true,available2: true,available3: true, comesInBlack: 'yes'},
      {available: false,available2: true,available3: true,available3: true, comesInBlack: 'yes'},
      { available: true,available2: true,available3: true, comesInBlack: 'no'},
      {available: false,available2: true,available3: true, comesInBlack: 'yes'},
      { available: false,available2: true,available3: true, comesInBlack: 'no'}
    ];
  }

  var example1 = document.getElementById('example1'),
    hot1;

  hot1 = new Handsontable(example1, {
    data: getCarData(),
    colHeaders: ['Available','Available2','Available3'],
    columns: [

      {
        data: 'available',
        type: 'checkbox'
      },{
        data: 'available2',
        type: 'checkbox'
      },{
        data: 'available3',
        type: 'checkbox'
      }
    ]
  });

```

Answer: 
You are trying to open AlertDialog from BroadcastReceiver that is not able to find context(context you) .Do one thing redirect user to from broadcastreceiver and from there show alertdialog in onCreate.

Problem One : You have to pass theme in Alert Dialog 

> 
> AlertDialog.Builder builder = new
>  AlertDialog.Builder(context,
>  R.style.AppTheme);
> 
> 
> 

**Secondly** you can't show dialog from Broadcastreceiver its not getting context as a developer hope you know how to redirect user from Broadcastreceiver to activity .
Error you must be getting crash for this

> 
> java.lang.RuntimeException: Unable to start receiver
>  com.stackoverflow.Kommit:
>  android.view.WindowManager$BadTokenException: Unable to add window --
>  token null is not for an application
> 
> 
> 

So redirect user to MainActivity instead of showing alertDialog and in onCreate of MainActivity show alert dialog where you will have context on MainActivity

**UPDATED** Kommit.java(onReceive)

```
Intent i = new Intent(context, MainActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Bundle b = new Bundle();
b.putInt("notify", 1);
i.putExtras(b); //Put your id to your next Intent 
context.startActivity(i);

```

**In MainActivity** OnCreate()

```
Bundle b = getIntent().getExtras();  int value = 0; // or other values
if(b != null) 
value = b.getInt("notify"); 
if(value !=0)
{
 //show alertdialog 
}

```

EDIT by P. Dee: Corrected your notify.
Normally a dialog needs an Activity context, or make the dialog type a system alert dialog

> 
> alert.getWindow().setType(WindowManager.LayoutParams.TYPE\_SYSTEM\_ALERT);
> 
> 
> 

This needs the android.permission.SYSTEM\_ALERT\_WINDOW to be declared in manifest.