Skip to content

Instantly share code, notes, and snippets.

@nagendrababu143
Created August 15, 2018 05:45
Show Gist options
  • Save nagendrababu143/ecff5cd4d1305597bea0f4e12ef2b175 to your computer and use it in GitHub Desktop.
Save nagendrababu143/ecff5cd4d1305597bea0f4e12ef2b175 to your computer and use it in GitHub Desktop.
package com.example.nagendra.intentexample;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button = (Button)findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this,SecondActivity.class);
startActivity(intent);
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment