Skip to content

Instantly share code, notes, and snippets.

@MiraLak MiraLak/ Secret
Last active Aug 29, 2015

What would you like to do?
Android app: Basic accelerometer
public class StartActivity extends ActionBarActivity {
public static final String URL = "restURL"; //Default url to post data
private EditText restURL;
protected void onCreate(Bundle savedInstanceState) {
// show first layout called activity_start.xml
// get url value from field 'editURL'
restURL = (EditText) findViewById(;
// declare start button
Button myButton = (Button) findViewById(;
myButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent();
//after click on button we switch to AccelerometerActivity class
//with parameter restURL
intent.setClass(StartActivity.this, AccelerometerActivity.class);
intent.putExtra(URL, restURL.getText().toString());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.