Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected List<WeatherForecastInfo.ListItem.Weather> list = null;
- protected ArrayAdapter<WeatherForecastInfo.ListItem.Weather> adapter = null;
- //and in onCreate I have
- mapUtil = WeatherUtil.newInstance();
- button.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- // TODO Auto-generated method stub
- new AsyncTask<String, Void, WeatherForecastInfo>() {
- @Override
- protected void onPreExecute() {
- progressDialog = new ProgressDialog(DemoActivity.this);
- progressDialog.setTitle("Wait...");
- progressDialog.setMessage("Data is being loaded...");
- progressDialog.show();
- }
- @Override
- protected WeatherForecastInfo doInBackground(
- String... params) {
- return mapUtil.getForecastByCityName(DemoActivity.this, editText.getText().toString(), 2);
- }
- @Override
- protected void onPostExecute(WeatherForecastInfo result) {
- textView.setText(result.getCity().getName()+ " " + result.getCity().getCountry());
- list = result.getListItem().getWeather(); // Here Im getting NPE why???
- adapter = new ArrayAdapter<WeatherForecastInfo.ListItem.Weather>(DemoActivity.this, android.R.layout.simple_list_item_1, list);
- listView.setAdapter(adapter);
- progressDialog.dismiss();
- }
- }.execute(null, null, null);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement