Android Activity 여러개 사용하는 방법


  • Android Activity 여러개 사용하는 방법

Code (csharp):
  1. #if UNITY_ANDROID
  2.    //Grab the current activity (the one declared as MAIN in the manifest - can be an other plugin)
  3.    AndroidJavaClass ajc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
  4.    AndroidJavaObject ajo = ajc.GetStatic<AndroidJavaObject>("currentActivity");
  5.    //Give the activity instance to my own static method to launch an activity from there
  6.    var jc = new AndroidJavaClass("com.my.package.RootActivity");
  7.    jc.CallStatic("launchActivity", ajo, showUI, true"string"0);
  8. #endif

In the com.my.package.RootActivity java file :

Code (csharp):
  1. public static void launchActivity(Activity rootboolean param1, String param2, int param3) {
  2.     Intent intent = new Intent(root, CameraActivity.class);
  3.     intent.putExtra(RootActivity.EXTRA_BOOLEAN_PARAM1, param1);
  4.     intent.putExtra(RootActivity.EXTRA_STRING_PARAM2, param2);
  5.     intent.putExtra(RootActivity.EXTRA_INT_PARAM3, param3);
  6.     root.startActivity(intent);
  7. }




댓글

이 블로그의 인기 게시물

야구 WBC 한국 대표팀 외국계 선수 출전 가능한 이유 (혈통 규정 완벽 정리)

대기업 프론트엔드(frontend) 프레임워크 성향

입체각이란?