我一直在瀏覽器中輸入下面的例子:定製的Android的ListView項目使用自定義ArrayAdapter
http://www.ezzylearning.com/tutorial.aspx?tid=1763429
這是一個定製的Android ListView
項目與Custom ArrayAdapter
。
一切都靜是工作,但我不動態獲得它:
Weather weather_data[] = new Weather[]
{
new Weather(R.drawable.weather_cloudy, "Cloudy"),
new Weather(R.drawable.weather_showers, "Showers"),
new Weather(R.drawable.weather_snow, "Snow"),
new Weather(R.drawable.weather_storm, "Storm"),
new Weather(R.drawable.weather_sunny, "Sunny")
};
對於動態數據,它說:
Weather weather_data[] = youservice.GetWeatherData();
你能不能有人請舉一個例子如何實施
youservice.GetWeatherData();
我試了很多東西,但不管理它。
它不是Android的問題,而是你的Java概念的問題。 –
你應該閱讀一個Json解析器[**教程**](http://www.androidhive.info/2012/01/android-json-parsing-tutorial/)。 'youservice.GetWeatherData();'是簡單的函數爲你的適配器返回正確的格式輸入數據。在你的情況下,它返回一個'Weather'數組。 「動態」遠非簡單的答案。提供輸入數據的方式太多了。 –