How do I run a command on Android by touching the screen or swiping my finger on the screen?

1

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

    
asked by anonymous 12.05.2015 / 21:56

1 answer

1

You have instantiate an element in your Activity class, although it is not very well-suited

   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) {

        }
    });


}

Screen layout xml file:

        <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>
    
12.05.2015 / 22:08