How to run a command on Android when touching the screen or swiping your finger on the screen?

Asked

Viewed 279 times

1

How to run a command on Android by touching the screen or swiping your finger on the screen, if someone can help me

1 answer

1

You have instantiating an element in your Activity class, although d is not very indicated does

   package com.containersol.scecarro;

   import android.app.Activity;

    import android.view.View;
   import android.widget.LinearLayout;
   import android.widget.TextView;
   import android.widget.Toast;

 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;

 import java.sql.SQLException;

 public class MainActivity extends Activity {protected void onCreate(Bundle           savedInstanceState) {
    super.onCreate(savedInstanceState);

  final LinearLayout tela = (LinearLayout) findViewById(R.id.tela);
    tela.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

        }
    });


}

xml file of the screen layout:

        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:paddingBottom="@dimen/activity_vertical_margin"
            android:paddingLeft="@dimen/activity_horizontal_margin"
            android:paddingRight="@dimen/activity_horizontal_margin"
            android:paddingTop="@dimen/activity_vertical_margin"

            android:gravity="center|center_horizontal"
            android:id="@+id/tela">


            </LinearLayout>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.