Note that there are some explanatory texts on larger screens.

plurals
  1. POSaving the state of my ListView for screen orientation
    text
    copied!<p>I went through many posts for screen orientation. But my scenario is little bit different. My ListView have custom row layout. With ImageView bitmap being loaded from internet using AsyncTask. What I want is to, is it possible to save the ArrayAdapter of my ListView or the whole ListView so that its state is preserved upon orientation screen change.</p> <p>Please suggests some posts or if some codes are posted it will be very useful.</p> <pre><code>public View getView(int position, View convertView, ViewGroup parent) { final Contents entry = contentList.get(position); View row = convertView; LayoutInflater infltr = null; if (row == null) { infltr = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); row = inflater.inflate(R.layout.highlight_contents_layout, parent, false); } ImageView imgViewImage = (ImageView) row .findViewById(R.id.imgView_Image); if (imgViewImage.getTag() == null) { new DownloadImage(imgViewImage, entry).execute(); //Async Task to download Image } } return row; } </code></pre> <p>and in onCreate i have a function call to populate the list the function call is :</p> <pre><code>init(){ listContent = (ListView) findViewById(R.id.listview); //vairable declared at top of my class; contentlist = new ArrayList&lt;Contents&gt;(); //Variable Declared at top of class; //... Populated the contenlist... in here //.. //.. adapter = new ListAdapter(getApplicationContext(), R.layout._contents_layout, contentList, thumb_image_bytes); listContent.setAdapter(adapter); adapter.notifyDataSetChanged(); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload