2017-12-26 2 views
0

내 앱에 github의 라이브러리를 구현했습니다. 나는 그것의 첫번째 발사 후에 그것을 무능하게하는 방법을 알고 싶다. 나는 그것이 앱이 출시 될 때마다 보여지기를 원하지 않는다. 내가 시도한 것을 heres. 부울 변수를 추가하려고했지만 작동하지 않았습니다. 이 질문은이 주제를위한 것이 아닙니다. 앱을 설치 한 후 처음으로 메소드를 호출하려는 경우, 첫 번째 앱 실행 시간에 호출 된 후에 다시 호출되기를 원하지 않습니다. 나는 그것이 무엇을 성취하려고하는지 분명히 밝히기를 바랍니다.첫 출시 활동 사용 안 함

처음 시작
boolean firstLoad; 

    if(firstLoad=true) { 

     TapTargetView.showFor(this,     // `this` is an Activity 
       TapTarget.forView(findViewById(R.id.button), "This is a target", "We have the best targets, believe me") 
         // All options below are optional 
         .outerCircleColor(R.color.colorPrimary)  // Specify a color for the outer circle 
         .outerCircleAlpha(0.96f)   // Specify the alpha amount for the outer circle 
         .targetCircleColor(R.color.colorAccent2) // Specify a color for the target circle 
         .titleTextSize(20)     // Specify the size (in sp) of the title text 
         .titleTextColor(R.color.colorAccent2)  // Specify the color of the title text 

       new TapTargetView.Listener() {   // The listener can listen for regular clicks, long clicks or cancels 
        @Override 
        public void onTargetClick(TapTargetView view) { 
         super.onTargetClick(view);  // This call is optional 

        } 
       }); 
    } 

    firstLoad=false; 
+0

, SharedPreference의 boolean를 작성하고 당신의 논리와 업데이트 부울 따라 – rafid059

+0

가능한 복제를 제어하는 ​​것을 사용 [한 번만 응용 프로그램을 처음 열 때 활동을 시작하는 방법? (https://stackoverflow.com/questions/7238532/how-to-launch-activity-only-once-when-app-is-opened-for-first-time) – rafid059

+0

정확한 활동이 아니며 " 방법 "내가 처음 출시 후 장애가되고 싶다 – user8747695

답변

1
Boolean firstLoad = getSharedPreferences("PREFERENCE", MODE_PRIVATE) 
      .getBoolean("firstLoad", true); 

    if (firstLoad) { 

     //call your method 

     getSharedPreferences("PREFERENCE", MODE_PRIVATE).edit().putBoolean("firstLoad", false).commit(); 

    }