Bitmap bmpImg = BitmapFactory.decodeFile("/sdcard/hi.png");
MediaStore.Images.Media.insertImage(getContentResolver(), bmpImg, null, null);
Monday, December 6, 2010
Dispatching touch event of one view to aother view
Button btnFirst = new Button(this);
btnFirst.setOnTouchListener(new OnTouchListener()
{
@Override
public boolean onTouch(View v, MotionEvent event)
{
Log.i("First Button","This is first button's onTouch()");
return false;
}
}));
Button btnSecond = new Button(this);
btnSecond.setOnTouchListener(new OnTouchListener()
{
@Override
public boolean onTouch(View v, MotionEvent event)
{
btnFirst.dispatchTouchEvent(event);
return false;
}
}));
btnFirst.setOnTouchListener(new OnTouchListener()
{
@Override
public boolean onTouch(View v, MotionEvent event)
{
Log.i("First Button","This is first button's onTouch()");
return false;
}
}));
Button btnSecond = new Button(this);
btnSecond.setOnTouchListener(new OnTouchListener()
{
@Override
public boolean onTouch(View v, MotionEvent event)
{
btnFirst.dispatchTouchEvent(event);
return false;
}
}));
Subscribe to:
Posts (Atom)