2014-03-06 2 views
0

onCreate()에서 생성 된 AsyncTask가 있습니다. GatherText() 뷰 밖으로 TextView를 슬라이드하는 애니메이션이 있습니다. 해당 애니메이션이 끝나면 AsyncTask를 호출해야합니다. 여기 안드로이드 - onAnimationEnd에서 클래스를 실행하는 방법

내가 GatherText() can not be resolved to a type을 말한다 오류를받은 onAnimationEnd() 방법에 내 코드

public class MainActivity extends Activity implements AnimationListener { 
public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 

class GatherText extends AsyncTask<JSONObject, String, JSONObject> { 

      @Override 
      protected void onPreExecute() { 
       super.onPreExecute(); 

      } 

      @Override 
      protected void onProgressUpdate(String... values) { 
       super.onProgressUpdate(values); 

      } 

      } 

      @Override 
      protected void onPostExecute(JSONObject json) { 

      }//end onPostExecute 

     }//end GatherText Asynctask 


    }//end onCreate 


    @Override 
    public void onAnimationEnd(Animation animation) { 
     if(animation == slideout){ 
      //THIS IS WHERE THE ERROR OCCURS 
        new GatherText().execute(); 
       } 
    }//End onAnimationEnd 


}//end Main Activity 

의 기본적인 생각이다. onCreate 외부의 GatherText()으로 전화하려면 어떻게해야합니까?

+1

는 것을조차 컴파일 않는 외부에서 AsyncTask를 클래스를 넣어? 왜 GatherText가 onCreate 안에 있습니까? – njzk2

+0

다른 곳으로 가겠습니까? – user2861085

+0

외부에 붙여 넣기, 범위 문제입니다. – Gak2

답변

0

는에서 onCreate

public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 



}//end onCreate 

class GatherText extends AsyncTask<JSONObject, String, JSONObject> { 

     @Override 
     protected void onPreExecute() { 
      super.onPreExecute(); 

     } 

     @Override 
     protected void onProgressUpdate(String... values) { 
      super.onProgressUpdate(values); 

     } 

     } 

     @Override 
     protected void onPostExecute(JSONObject json) { 

     }//end onPostExecute 

    }//end GatherText Asynctask 


@Override 
public void onAnimationEnd(Animation animation) { 
    if(animation == slideout){ 
     gathertext = new GatherText(); 
     new GatherText().execute(); 
    } 
}//End onAnimationEnd 
관련 문제