的Android給錯誤在延續的問題谷歌教程在asList方法
Google Android tutorial - not compiling
的asList
使用,同時創造weekForecast變量給了一個錯誤 - 無法解析方法..?除了上述解決方案和support.v4外,我還使用了這些頭文件。 它不是完整的程序。
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;
public static class PlaceholderFragment extends Fragment{
public PlaceholderFragment(){
}
public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
View rootView= inflater.inflate(R.layout.fragment_main,container);
String[] forecastArray = {
"Today - Sunny - 88/63",
"Tomorrow - Foggy - 70/40",
"Weds - Cloudy - 72/63",
"Thurs - Asteroids - 75/65",
"Fri - Heavy Rain - 65/56",
"Sat - HELP TRAPPED IN WEATHERSTATION - 60/51",
"Sun - Sunny - 80/68"
};
List<String> weekForecast = new ArrayList<String>(Array.**asList**(forecastArray));
ArrayAdapter mForecastAdapter = new ArrayAdapter<String>(getActivity(),R.layout.list_item_forecast,
R.id.list_item_forecast_textview,weekForecast);
ListView listView = (ListView) rootView.findViewById(R.id.listview_forecast);
listView.setAdapter(mForecastAdapter);
return rootView;
}
}
[當有人回答我的問題,我應該怎麼辦?(http://stackoverflow.com/help/someone-answers) – 2Dee