Note that there are some explanatory texts on larger screens.

plurals
  1. POi have create list view with file name with size but after then set on click list view they throw null pointer exception
    primarykey
    data
    text
    <p>before to add file size its properly work but after then add this concept its showing error onclicklistitem below i give you snippet of code plz help me check my code and inform me.</p> <p>list_file.xml*<strong><em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>***</strong></p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;ListView android:id="@+id/mylist" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:background="#aa0000" android:drawSelectorOnTop="false" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>code*<strong><em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>***</strong></p> <pre><code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); myList = new ArrayList&lt;String&gt;(); myDB = this.openOrCreateDatabase("Recycle", MODE_PRIVATE, null); String root_sd = Environment.getExternalStorageDirectory().toString(); file = new File( root_sd + "/recycle/" ) ; File list[] = file.listFiles(); for( int i=0; i&lt; list.length; i++) { myList.add( list[i].getName() + "\n" + readableFileSize(list[i].length())); } setListAdapter(new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, myList )); setContentView(R.layout.main); mFilePathTextView = (TextView)findViewById(R.id.file_path_text_view); mStartActivityButton = (Button)findViewById(R.id.start_file_picker_button); mStartActivityButton.setOnClickListener(this); } protected void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); final File temp_file = new File( file, myList.get( position ) ); AlertDialog alertbox = new AlertDialog.Builder(this) .setTitle("File Detail") .setMessage("File Name:"+temp_file) .setPositiveButton("Delete", new DialogInterface.OnClickListener() { // do something when the button is clicked public void onClick(DialogInterface arg0, int arg1) { DeleteRecursive(temp_file); refresh(); //mylist.invalidateViews(); //adapter.notifyDataSetChanged(); } }) </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
    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