I am developing an app that requires mee to allow user to draw any text on an image shown.
I am not able to get the correct term to search the web- should i call it sensing or call it touch event or what it is a gesture application.
Precisely i want to enable the user to scribble any thing or draw any thing on the image.
I have few ideas like it can use canvas or some overlay element But nothing concrete.
P.S. :
I am using the android 2.2 as target.
I am new to android development.
Please help !
Well Answering my own first question 🙂
Actually i could not get directly to the solution – but atleast found 2 ways out.
You can take 2 imageview’s. Allocate the 1st Imageview ( ref it as imageview1 ) with the image source and then place the 2nd Imageview ( ref it as imageview2 ) on imageview1 , such a way that it covers entire screen ( fill parent – both height and width ) .
Now in .java file , assign
imageview2.setOnTouchListener(this);and override the onLoad() method as per your need . Eg.`public boolean onTouch(View v, MotionEvent event) {
}`
This will help to draw on imageview2 but it would seem as if it is been drawn on imageview1 🙂
Create a new class ( cal it MyImageview ) extending ImageView .
Now in your activity class, create an object of MyImageView and
setContentView(myImageView(this))and attach asetOnTouchListener(this);, implement the onTouch method as specified above and this will work fine .