0
'클래스'에는 노란색 밑줄이 그어져 있으며 '클래스는 원시 유형입니다.'라는 경고가 표시됩니다. 제네릭 형식 클래스에 대한 참조는 매개 변수화되어야합니다. 'android development eclipse (목록 활동)
Class ourClass = Class.forName("com.thenewboston.jack." + cheese);
모든 빠른 수정과 모든 것을 시도했습니다. 나는 무엇을해야할지 모른다. 어느 누구라도 도와주고 무엇을해야할지 말해 줄 수 있습니까? 이
Class<Activity> ourClass = Class.forName("com.thenewboston.jack." + cheese);
같이
package com.thenewboston.jack;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class Menu extends ListActivity{
String classes[] = {"Startingpoint", "Example1", "Example2", "Example3"
, "Example4", "Example5", "Example6", "Example7", "Example7", "Example7"};
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(Menu.this, android.R.layout.simple_expandable_list_item_1, classes));
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
// TODO Auto-generated method stub
super.onListItemClick(l, v, position, id);
String cheese = classes[position];
try{
Class ourClass = Class.forName("com.thenewboston.jack." + cheese);
Intent ourIntent = new Intent(Menu.this, ourClass);
startActivity(ourIntent);
}catch(ClassNotFoundException e){
e.printStackTrace();
}
}
}
경고를 없애지 않습니다. Class ourClass = Class.forName ("com.thenewboston.jack."+ cheese); 그러나 이것은 @SuppressWarnings ("rawtypes")입니다. \t \t \t 클래스 ourClass = Class.forName ("com.thenewboston.jack."+ cheese); 도와 주셔서 감사합니다. 왜 다른 하나가 작동하지 않았는지 말할 수 있습니까? –