I am trying to get the file path of the intent. Everything I find doesn't
seem to work. This is what I have so far:
Intent i = getIntent();
Uri uri = i.getData();
if (uri == null)
{
return;
}
String startFile = "";
try
{
startFile = uri.getPath();
}
catch (Exception ex)
{
Toast.makeText(this, "Error:\n" + ex.getMessage().toString(),
Toast.LENGTH_LONG).show();
return;
}
if (startFile == null)
{
return;
}
StringBuilder text = new StringBuilder();
can = false;
sel = false;
try
{
file = new File(CurDir, startFile);
reader = new BufferedReader(new FileReader(file));
String line;
while ((line = reader.readLine()) != null)
{
text.append(line);
text.append('\n');
}
}
catch (Exception e)
{
Toast.makeText(this, "Error:\n" + e.getMessage().toString(),
Toast.LENGTH_LONG).show();
}
TextEditor.setText(text);
FileName.setText(startFile);
However if I open a file in "/mnt/sdcard/test.txt" it tries to open
"/mnt/sdcard/mnt/sdcard/test.txt" this is frustrating me to no end... Any
help is appreciated.
--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.