The following piece of code is designed to show a toast with each Action Up event....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
The following piece of code is designed to show a toast with each Action Up event. But, it shows nothing. Find and explain the problem, then fix it. (7m) 1view.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch (View v, Motion Event event) { boolean flag=true; int action event.getActionMasked(); if(action == Motion Event.ACTION_DOWN) { //some code goes here flag- ! flag; 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16}); } } if(action == MotionEvent.ACTION_UP){ Toast.makeText (self, "Action UP", Toast.LENGTH_SHORT).show(); flag- ! flag; } return flag; The following piece of code is designed to show a toast with each Action Up event. But, it shows nothing. Find and explain the problem, then fix it. (7m) 1view.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch (View v, Motion Event event) { boolean flag=true; int action event.getActionMasked(); if(action == Motion Event.ACTION_DOWN) { //some code goes here flag- ! flag; 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16}); } } if(action == MotionEvent.ACTION_UP){ Toast.makeText (self, "Action UP", Toast.LENGTH_SHORT).show(); flag- ! flag; } return flag;
Expert Answer:
Answer rating: 100% (QA)
Problem Explanation The issue in the provided code lies in the incorrect use of the flag variable an... View the full answer
Related Book For
Smith and Roberson Business Law
ISBN: 978-0538473637
15th Edition
Authors: Richard A. Mann, Barry S. Roberts
Posted Date:
Students also viewed these programming questions
-
What is the capacity of each resource pool (please fill in the table below) Resource Pool i Unit Load ( minutes per order ) Number of Units in the Resource Pool Effective Capacity of a Resource Unit...
-
It is initially at 25\deg C. The warehouse is desired to be cooled to 5\deg C. The heat transferred from the external environment to the tank is 1.2 kW. Accordingly, a cooling system with H kW power...
-
Solve the linear equation with the x-intercept method. Check your answer. Approximate the solution to the nearest thousandth whenever appropriate. -1-x = = 0
-
Ryan and Kim are married and commute to and from work together each day. Ryan, a CPA, works in the Project Budgeting Department of Carson Company and his wife Kim works as an engineer in the...
-
For your e-mail, you use a filter to block spam from your inbox. The number of items blocked by day of week is recorded and Minitab is used to perform the analysis that follows. Here are the results:...
-
Define the Haar's wavelets function \(\psi(t)\) and verify that for every \(t\), \[si(t)= \begin{cases}1, & 0 \leq t
-
The Trade Show Bureau conducted a survey to determine why people go to trade shows. The respondents were asked to rate a series of reasons on a scale from 1 to 5, with 1 representing little...
-
83 cities were surveyed to determine sports teams. 24 had baseball, 20 had football, 17 had basketball, 10 had baseball and football, 9 had baseball and basketball, 10 had football and basketball. 3...
-
You want to purchase a home based upon your current salary you decide that you can afford $2000.00 per month. Your bank has approved you for a (30 year) loan at an interest rate of 5%. 1) Based upon...
-
Which of the following characteristics do homologous chromosomes exhibit? They attach together as bivalents in mitosis. They carry information for different traits. They line up during prophase I of...
-
To what extent does the U.S. Constitution protect the right to trial by jury in a criminal case?
-
Is there a justification for the broad discretion vested in a prosecutor?
-
What function does a grand jury serve? Does replacement of the indictment function of grand juries at the state level with prosecutors authorized to charge crimes by filing a sworn information impair...
-
Compare and contrast the functions of trial and appellate courts. How are they similar? How are they different?
-
Describe the functions of federal and state law enforcement agencies.
-
Lab 8 Tinkercad Note: Using Tinkercad software. Part 1 - Working with Function Generator and Oscilloscope 1. Place a breadboard in the Work Area. 2. Place a Function Generator in the Work Area. Set...
-
The liquidliquid extractor in Figure 8.1 operates at 100F and a nominal pressure of 15 psia. For the feed and solvent flows shown, determine the number of equilibrium stages to extract 99.5% of the...
-
Clay orally promises Trent to sell him five crops of potatoes to be grown on Blackacre, a farm in Minnesota, and Trent promises to pay a stated price for them on delivery. Is the contract enforceable?
-
Ethel Greenberg acquired the ownership of the Carlyle Hotel on Miami Beach. Having had little experience in the hotel business, she asked Miller to participate in and counsel her operation of the...
-
The following contract was executed on August 22: Ray agrees to sell and Shaw, the representative of Todd and acting on his behalf, agrees to buy 10,000 pounds of 0.32 1 5/8 stainless steel strip...
-
Comment on this statement: Dynamic modeling is about interaction.
-
Explain how objects interact by exchanging messages.
-
Describe the relationship between dynamic modeling, behavioral modeling, and structural modeling.
Study smarter with the SolutionInn App