I am implementing a sensoreventlistener.
Whenever the device is shaked I want to provide a password screen.
I need some suggestion on how to implement it. What I am doing is I am inflateing password layout in onShake method can I do that?
The password layout should look like general passcode lock we used in devices..(giving 4 digits)
Any suggestions will be appreciated.
Below is my ShakeListener Activity
public class ShakeListenerTestActivity extends Activity
{
private ShakeListener mShaker;
private EditText password;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mShaker = new ShakeListener(this);
mShaker.setOnShakeListener(new ShakeListener.OnShakeListener () {
public void onShake()
{
Toast.makeText(ShakeListenerTestActivity.this, password.getText(),
Toast.LENGTH_SHORT).show();
}
});
}
public void onResume()
{
mShaker.resume();
super.onResume();
}
@Override
public void onPause()
{
mShaker.pause();
super.onPause();
}
}