To Fix a Very Little Java (Android Studio) Code

В роботі Опубліковано %project.relative_time Оплачується при отриманні
В роботі Оплачується при отриманні

So............. I have the disaster of a code you'll find next.

It's from Android Studio, and it is the following.

-----------------------------------------------------------------------------------------

package [login to view URL];

import [login to view URL];

import [login to view URL];

import [login to view URL];

import [login to view URL];

import [login to view URL];

import [login to view URL];

public class MainActivity extends AppCompatActivity {

private TextView T1;

private Button B1;

@Override

public void onCreate(Bundle savedInstanceState) {

[login to view URL] (savedInstanceState);

setContentView (R.layout.activity_main);

T1 = (TextView) findViewById ([login to view URL]);

B1 = (Button) findViewById ([login to view URL]);

}

public void IndicateTime (View view) {

long TouchDown;

long TotalDuration;

[login to view URL](new OnTouchListener() {

@Override

public boolean onTouch(View v, MotionEvent event) {

if ([login to view URL] () == MotionEvent.ACTION_DOWN) {

TouchDown = [login to view URL] ();

} else if ([login to view URL] () == MotionEvent.ACTION_UP) {

TotalDuration = [login to view URL] () - TouchDown;

}

return true;

}

}

}

-----------------------------------------------------------------------------------------

I do not understand a single bit of what I'm doing.

But.

What I want, is, someone to fix the code, in order to make a little app which just have 1 button, and 1 text, and that: When you Press the Button, and Release it, It Tells you How Much Time Have Passed from When It Was Pressed.

Just That.

I leave a ScreenShot of the Code in Android Studio attached.

Here's the source of where I took part of the code.
There it explains how to use it, but I don't understand how to apply it.
https://stackoverflow.com/questions/11963763/how-to-detect-when-button-pressed-and-released-on-android

Android Java Mobile App Development

ID Проекту: #16970375

Про проект

7 заявок(-ки) Дистанційний проект Остання активність 5 роки(ів) тому

7 фрілансерів(-и) готові виконати цю роботу у середньому за $19

kappDev

Hello I am professional programmer. I work as Android programmer and have developed several apps already. Hire me for your job to be done well at low costs.

$30 USD за 1 день
(4 відгуків(и))
2.4
highsense96

Hi, I'm Himanshu from The Highsense Technologies. We here your request and ready to help you as per your requirements! We expertise in Android Application Development! we glad to help you for fixing code issues! Більше

$10 USD за 1 день
(1 відгук)
0.0
malithpata

Hi there. I recently made an app on java which generated a UI with two text boxes and a dropdown menu too so I feel like what you need is similar to what I just did. If that is the case I can help you out in no tim Більше

$20 USD за 1 день
(0 відгуків(и))
0.0
pathakvineet3

I have had done this same project only small variance. I will provide you with the working code in mean time. Feel free to contact any time for further details. Thank You

$10 USD за 1 день
(0 відгуків(и))
0.0