Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to display file size in list view with file name
    primarykey
    data
    text
    <p>file in my folder i have give path and display in list view but i want to in list file display with its size. i give you snippet code by this code i am get all file name in list view but i want to file name with its size in list plz help me.</p> <pre><code>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() ); } 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); </code></pre> <p>protected void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id);</p> <pre><code> 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(); } }) .setNegativeButton("Restore", new DialogInterface.OnClickListener() { // do something when the button is clicked public void onClick(DialogInterface arg0, int arg1) { String s5=temp_file.toString(); String z1[]={"Field1","Field2"}; try { String from= temp_file.toString(); </code></pre> <p>here my xml file*<strong><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; </code></pre> <p></p> <p>i want to display file size in sub item plz give me solution what change in my xml file and code.</p>
    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.
    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