Skip to content

Instantly share code, notes, and snippets.

@vexdev
Created May 7, 2015 00:04
Show Gist options
  • Save vexdev/54ef26a8f917e6a6dc94 to your computer and use it in GitHub Desktop.
Save vexdev/54ef26a8f917e6a6dc94 to your computer and use it in GitHub Desktop.
Really simple activity to be tested with Android Unit Test
package com.example.android.testingfun;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
/**
* Launches NextActivity and passes a payload in the Bundle.
*/
public class LaunchActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_launch_next);
setupListeners();
}
private void setupListeners() {
Button launchNextButton = (Button) findViewById(R.id.launch_next_activity_button);
launchNextButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(LaunchActivity.this, NextActivity.class);
startActivity(intent);
finish();
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment