Advertisement
Hanif_Amrullah

Untitled

Jan 24th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. package com.hanif.intent;
  2.  
  3. import android.content.Context;
  4. import android.content.Intent;
  5. import android.support.v7.app.AppCompatActivity;
  6. import android.os.Bundle;
  7. import android.view.View;
  8. import android.widget.Button;
  9.  
  10. public class FirstActivity extends AppCompatActivity {
  11. //inisilisasi widget
  12. Button mButton1;
  13. //Context context = this;
  14.  
  15.  
  16. @Override
  17. protected void onCreate(Bundle savedInstanceState) {
  18. super.onCreate(savedInstanceState);
  19. setContentView(R.layout.activity_first);
  20. // assign widget
  21. mButton1=(Button) findViewById(R.id.btn_pindah1);
  22. ///aksi klik button
  23. mButton1.setOnClickListener(new View.OnClickListener() {
  24. @Override
  25. public void onClick(View v) {
  26. //inisialisasi intent
  27. Intent pindahHalaman = new Intent(FirstActivity.this, SecondActivity.class);
  28. startActivity(pindahHalaman);
  29. }
  30. });
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement