Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to go about having a button and a custom paint view on the same screen? android
    primarykey
    data
    text
    <p>I am pretty new to android and am trying to build an app where the user can draw a letter, press a button that connects a service that reads it, and then the letter is displayed back to them.</p> <p>This is my main layout: !(<a href="http://i58.photobucket.com/albums/g271/billmoney3/layout_zps71eb45ca.jpg" rel="nofollow">http://i58.photobucket.com/albums/g271/billmoney3/layout_zps71eb45ca.jpg</a>)</p> <p>I want the user to be able to draw in the blue area. I made the blue area a custom view called InnerDrawingView. I need help on how to organize the views and the OnTouchListener.</p> <p>Right now I have this java code:</p> <pre><code>public class DoodleActivity extends Activity { Button confirmButton; EditText drawingResult; InnerDrawingView innerView; // on create protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_doodle); // main layout // where the drawing happens innerView = (InnerDrawingView) findViewById(R.id.innerDrawingView1); innerView.setOnTouchListener(handleTouch); ... ... // handle the touching of the inner view private OnTouchListener handleTouch = new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { drawingResult.setText("O RLY?!"); // just a test return true; } }; // end of class </code></pre> <p>Is this the correct way to go about it? What kind of touch listener do I put in the InnerDrawingView class? Can I just call: innerView.onTouch() from inside my main activity's onTouch()? Or the onDraw() method? If someone could direct me to a good paint tutorial also that would help me a lot.</p> <p>Thanks for the input.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload