2011-11-21 5 views
2

ListViewActivity에서 두 번째 활동을 호출하려고합니다. 나는 이것을 시도했다두 번째 호출 활동 Android

Intent intent = new Intent(this, Activity2.class); 
startActivity(intent); 

그러나 그것은 doesnt한다 일한다, maybee 당신은 나를 도울 수있다. 이클립스는 다음과 같이 말합니다 :

The constructor Intent(new AdapterView.OnItemClickListener(){}, Class<Activity2>) is undefined 

같은 결과로 이것을 시도했습니다. 당신의 도움이

답변

3

에 대한

Intent intent = new Intent(Activity2.this, Activity2.class); 

덕분에 당신은이 같은 의도를 만들어야합니다 this`는`OnItemClickListener`를 참조한다`, 첫 번째 코드 예제에서는

Intent intent = new Intent(YourCurrentActivity.this, Activity2.class); 
+2

을하지 부모 활동 클래스. Arhimed가 보여 주듯이, 대신에 'YourCurrentActivity.this'를 사용하여 어떤'this '를 사용하려고하는지 명확히해야합니다. –

+0

감사합니다. 이제 작동합니다! =) – Miguel13366

관련 문제