Skip to content

Instantly share code, notes, and snippets.

@Sren-Hmkn
Last active August 6, 2018 09:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sren-Hmkn/298e80a7e525d6a17dcc37168eb6532f to your computer and use it in GitHub Desktop.
Save Sren-Hmkn/298e80a7e525d6a17dcc37168eb6532f to your computer and use it in GitHub Desktop.
MainActivity for initial setup
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
//one lonely little button will do the job!
<Button
android:id="@+id/start_cam"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_margin="16dp"
android:text="Start Camera"
/>
</RelativeLayout>
// change this to your own package:
package com.example.android.myapplication;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
Button startCam;
// Load library initially
static {
System.loadLibrary("native");
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
startCam = (Button) findViewById(R.id.start_cam);
startCam.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// do stuff here
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment