Note that there are some explanatory texts on larger screens.

plurals
  1. POFile list error on load Android ListActivity
    primarykey
    data
    text
    <p>I got this error, and i dont know who is the problem. In some devices work de app but in other make this error.</p> <p>//THIS IS THE CODE</p> <pre><code>package com.neoadn.takerenamephoto; import java.io.File; import java.util.ArrayList; import java.util.List; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.app.AlertDialog; import android.app.ListActivity; import android.content.DialogInterface; import android.content.Intent; import android.view.View; import android.view.Window; import android.widget.AdapterView; import android.widget.AdapterView.OnItemLongClickListener; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast; public class ListaFotos extends ListActivity { private File file, temp_file; private List&lt;String&gt; myList; String root_sd; File imagen; String direccionFile; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getListView().setBackgroundResource(R.drawable.fondo_p); myList = new ArrayList&lt;String&gt;(); root_sd = Environment.getExternalStorageDirectory().toString(); file = new File( root_sd + "/Pictures/TRPHOTO" ) ; File list[] = file.listFiles(); for( int i=0; i&lt; list.length; i++) { myList.add( list[i].getName() ); } setListAdapter(new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, myList )); </code></pre> <p>The line 41 is:</p> <pre><code> for( int i=0; i&lt; list.length; i++) </code></pre> <p>This shows a listactivity of files and folders into some folders.</p> <p><strong>UPDATED:</strong> </p> <p>Finally i used this to fix the problem: ( if list is not null, then load. If is null not load)</p> <pre><code> if(list != null) { for( int i=0; i&lt; list.length; i++) { // do your for loop } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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