Android: call a custom dialog from acceleration sensor
<p>I am new to android and now I am learning sensor. I do a small program just like:</p>

<pre><code>@Override
    public void onSensorChanged(SensorEvent event) {
        // TODO Auto-generated method stub
        if(event.sensor.getType() == Sensor.TYPE_ACCELEROMETER){
            float[] values = event.values;
            float x = values[0];
            float y = values[1];
            float z = values[2];
            float SR_Accelation = (x * x + y * y + z * z) / (SensorManager.GRAVITY_EARTH * SensorManager.GRAVITY_EARTH);
            long currentTime = System.currentTimeMillis();
            if(SR_Accelation &gt;= 2){
                if(currentTime - lastUpdateTime &lt; 200){
                    return;
                }
                lastUpdateTime = currentTime;
                Toast.makeText(ImgTest0130Activity.this, "Shake it!!!", 0).show();
            }
        }
    }
</code></pre>

<p>It works well and will pop up the toast. Now I want to pop up a dialog instead of toast. I know how to create a dialog, but how can I put it into program? How to call it?</p>
