To Fix a Very Little Java (Android Studio) Code

sedang Berlangsung Dipasang 5 tahun yang lalu Dibayar saat pengiriman
sedang Berlangsung Dibayar saat pengiriman

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 Proyek: #16970375

Tentang proyek

7 proposal Proyek online Aktif 5 tahun yang lalu

7 freelancer rata-rata menawar $19 untuk pekerjaan ini

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 dalam 1 hari
(4 Ulasan)
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! Lebih banyak

$10 USD dalam 1 hari
(1 Ulasan)
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 Lebih banyak

$20 USD dalam 1 hari
(0 Ulasan)
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 dalam 1 hari
(0 Ulasan)
0.0