Q1) Given the following excerpt of code, briefly explain when the method on TouchEvent( gets invoked. (5m) @Override pub

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Q1) Given the following excerpt of code, briefly explain when the method on TouchEvent( gets invoked. (5m) @Override pub

Post by answerhappygod »

Q1 Given The Following Excerpt Of Code Briefly Explain When The Method On Touchevent Gets Invoked 5m Override Pub 1
Q1 Given The Following Excerpt Of Code Briefly Explain When The Method On Touchevent Gets Invoked 5m Override Pub 1 (170.22 KiB) Viewed 70 times
Q1) Given the following excerpt of code, briefly explain when the method on TouchEvent( gets invoked. (5m) @Override public boolean onTouchEvent(MotionEvent event) { Log.d(TAG, "onTouchEvent: "+event.getActionmasked()); return true; } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 @Override protected void onCreate(Bundle savedInstancestate) { super.onCreate(savedInstancestate); setContentView(R.layout.activity_main); layout=findViewById(R.id.layout); outer-findViewById(R.id.view_out); inner=findViewById(R.id.view_inner); layout.setOnTouchListener(new view.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { Log.d(TAG, "Layout: "+motionEvent.getActionMasked()); return layoutFlag; } }); outer.setonTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { Log.d(TAG, "Outer: "+motionEvent.getActionMasked()); return outerFlag; } }); inner.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { Log.d(TAG, "Inner: "+motionEvent.getActionMasked()); return innerFlag; }); }
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply