Difference between revisions of "Android Studio: Link Activity to Class"

From OnnoWiki
Jump to navigation Jump to search
(Created page with " The much i got is that you want to go SurfaceViewExample from your main activity for that you need to use intent on button click like Intent i = new Intent(this, SurfaceVie...")
 
 
(2 intermediate revisions by the same user not shown)
Line 10: Line 10:
  
  
 +
 +
 +
==Cara Lain==
 +
 +
 +
# Start the activity connect to the
 +
# specified class
 +
 +
Intent i = new Intent(this, ActivityTwo.class);
 +
startActivity(i);
 +
 +
 +
 +
Intent i = new Intent(this, ActivityTwo.class);
 +
i.putExtra("Value1", "This value one for ActivityTwo ");
 +
i.putExtra("Value2", "This value two ActivityTwo");
 +
 +
 +
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.vogella.com/"));
 +
startActivity(i);
  
  
Line 17: Line 37:
  
 
* https://stackoverflow.com/questions/9858164/how-to-link-the-class-shown-below-with-main-activity
 
* https://stackoverflow.com/questions/9858164/how-to-link-the-class-shown-below-with-main-activity
 +
* http://tutorials.jenkov.com/android/activity.html
 +
* https://www.vogella.com/tutorials/AndroidIntent/article.html

Latest revision as of 18:19, 19 March 2022

The much i got is that you want to go SurfaceViewExample from your main activity for that you need to use intent on button click like

Intent i = new Intent(this, SurfaceViewExample.class);
startActivity(i) ;

and you have to add a permission in menifest to got to that activity like

<activity android:enabled="true" android:name="SurfaceViewExample" />



Cara Lain

# Start the activity connect to the
# specified class

Intent i = new Intent(this, ActivityTwo.class);
startActivity(i);


Intent i = new Intent(this, ActivityTwo.class);
i.putExtra("Value1", "This value one for ActivityTwo ");
i.putExtra("Value2", "This value two ActivityTwo"); 


Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.vogella.com/"));
startActivity(i);



Referensi