I am developing an Android widget. I have an initial layout from the XML for my widget.
But I issued a webservice call and need to update the view according to the response from the webservice.
public void changeTheApartmentTo(Context context, int position){
remoteViews.setTextViewText(R.id.header_text, objj.get(position).getDistance());
remoteViews.setTextViewText(R.id.text_name_row, objj.get(position).getName());
remoteViews.setTextViewText(R.id.text_address_row, objj.get(position).getStreet());
remoteViews.setTextViewText(R.id.text_state_row, objj.get(position).getState());
remoteViews.setTextViewText(R.id.text_price_row, objj.get(position).getPrice());
remoteViews.setTextViewText(R.id.text_bedbath_row, objj.get(position).getBathrooms());
remoteViews.setImageViewBitmap(R.id.img_apartment, ImageLoader.getInstance().get(objj.elementAt(position).getImageUrl()));
appWidgetManager.updateAppWidget(thisWidget, remoteViews);
}
Above is a function I have written in the public class HelloWidget extends AppWidgetProvider
class.
When I am changing the views, it results in a null pointer error.
Where do you call this method? Tell us how you get this exception?
You can use something like: