Select folder intent & Work out when intent complete?
<p>So I'm making a wallpaper and I want the user to select a folder. So I
have a button in the preferences that launches an intent to open an
image, but what I want is actually just a directory (I guess in the
worst case i can strip the filename from the end). So that's my first
problem: what's the best way to select a folder only?</p>

<p>The second problem is how do I get notified of when the intent is
complete?</p>

<pre><code>public class FilePreference extends DialogPreference implements
    View.OnClickListener
{
 public void onClick(View v)
 {
  // open up a gallery/file browser
  Intent intent = new Intent();
  intent.setType("image/*");
  intent.setAction(Intent.ACTION_GET_CONTENT);
  getContext().startActivity(Intent.createChooser(intent, "Select Folder"));
 }
</code></pre>
