그래서 내 응용 프로그램에는 시작 화면 이미지 + 소리가 2 초 동안 유지되고 메뉴에 들어갑니다. 메뉴 항목은 다음과 같습니다.
<activity
android:name=".helloWorld"
android:label="@string/app_name">
<intent-filter>
<action android:name="ro.dixy.Boston_Tutorial_App.HELLOWORLD"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
내 Menu.java 파일에는 다음 코드 행이 있습니다.
protected void onListItem(ListView l, View v, int position, long id)
{
super.onListItemClick(l,v,position,id);
String test = classes[position];
try
{
//Selectare meniu in functie de nume(pozitie)
Class ourClass = Class.forName("ro.dixy.Boston_Tutorial_App." + test);
Intent ourIntent = new Intent(Menu.this, ourClass);
startActivity(ourIntent);
}
catch(ClassNotFoundException e)
{
e.printStackTrace();
}
}
문제는 "클래스"에서 메뉴를 클릭하면 아무 작업도 수행하지 않는다는 것입니다.
저는 Android를 처음 사용하고 Boston Tutorials에서 배우려고합니다.
다른 것이 필요하면 알려주세요. 감사합니다.
그만큼:
Menu.java
public class Menu extends ListActivity
{
//Nume Meniuri
String classes[] = {"helloWorld","TextPlay","example2","example3","example4","example5"};
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
//ListAdapter pentru ListActivity
setListAdapter(new ArrayAdapter<String>(Menu.this, android.R.layout.simple_list_item_1, classes));
}
protected void onListItem(ListView l, View v, int position, long id)
{
super.onListItemClick(l, v, position, id);
String test = classes[position];
try
{
//Selectare meniu in functie de nume(pozitie)
Class ourClass = Class.forName("ro.dixy.Boston_Tutorial_App." + test);
Intent ourIntent = new Intent(Menu.this, ourClass);
startActivity(ourIntent);
}
catch(ClassNotFoundException e)
{
e.printStackTrace();
}
}
}
내 오류를 찾았습니다. 다음은 좋은 코드입니다.
@Override
protected void onListItemClick(ListView l, View v, int position, long id)
{
//your code here
}
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다