Trying to add onLongListItemClick and getting an exception
<p>I commented out the section I was adding protected boolean onLongListItemClick(ListView l, View v, int position, long id).  </p>

<p>If I un-comment I get an exception.  I am trying to add if there is long press I will delete the file, which will be added later.  Is there a simple way to do this.</p>

<pre><code>public class AndroidExplorer extends ListActivity {

  private List&lt;String&gt; item = null;
  private List&lt;String&gt; path = null;
  private TextView myPath;

  File myFile = new   File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/Boot");
  String root2 = myFile.getAbsolutePath();;

  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    myPath = (TextView)findViewById(R.id.path);
    getDir(root2);
  }

  private void getDir(String dirPath)
  {
    myPath.setText("Location: " + dirPath);

    item = new ArrayList&lt;String&gt;();
    path = new ArrayList&lt;String&gt;();

    File f = new File(dirPath);
    File[] files = f.listFiles();

    if(!dirPath.equals(root2))
    {
        item.add("Return to Boot Directory");
        path.add(f.getParent());
    }

    for(int i=0; i &lt; files.length; i++)
    {
            File file = files[i];
            path.add(file.getPath());
            if(file.isDirectory())
                item.add(file.getName() + "/");
            else
                item.add(file.getName());
    }

    ArrayAdapter&lt;String&gt; fileList =
        new ArrayAdapter&lt;String&gt;(this, R.layout.row, item);
    setListAdapter(fileList);
 }

//    protected boolean onLongListItemClick(ListView l, View v, int position, long id)     {
 //      //  Log.i(TAG, "onLongListItemClick id=" + id);
 //         Toast.makeText(this,
 //                    "I will be terminated",
 //                    Toast.LENGTH_LONG).show();
 //        return true;
 //    }





@Override
protected void onListItemClick(ListView l, View v, int position, long id) {

    File file = new File(path.get(position));

    if (file.isDirectory())
    {
        if(file.canRead())
            getDir(path.get(position));
        else
        {
            new AlertDialog.Builder(this)
            .setIcon(R.drawable.icon)
            .setTitle("[" + file.getName() + "] folder can't be read!")
            .setPositiveButton("OK",
                    new DialogInterface.OnClickListener() {

                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            // TODO Auto-generated method stub
                        }
                    }).show();
        }
    }
    else
    {

          String fileName = file.getName();
          String fname="";
          String ext="";
          int mid= fileName.lastIndexOf(".");
          fname=fileName.substring(0,mid);
          ext=fileName.substring(mid+1,fileName.length());


          if(ext.equals("jpg"))
          {
              Toast.makeText(this,
                        "view the jpg",
                        Toast.LENGTH_LONG).show();
          }

          if(ext.equals("3gp"))
          {
              Toast.makeText(this,
                        "play the video",
                        Toast.LENGTH_LONG).show();
          }
        new AlertDialog.Builder(this)
            .setIcon(R.drawable.icon)
            .setTitle("[" + file.getName() + "]")
            .setPositiveButton("OK",
                    new DialogInterface.OnClickListener() {

                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            // TODO Auto-generated method stub
                        }
                    }).show();
        }
    }
}
</code></pre>
