I created the file.java to read file so I don't know why it's error. And there's the error: "android.content.res.AssetManager $AssetInputStream"
public class Test1 extends Activity{ /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); readfilefromlocal(this); } protected void readfilefromlocal(Context ctx) { FileInputStream istream = null; TextView tv = new TextView (this); try { istream = (FileInputStream)ctx.getResources().openRawResource (R.raw.sample); SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); XMLReader xr = sp.getXMLReader(); ExampleHandler myExampleHandler = new ExampleHandler(); xr.setContentHandler(myExampleHandler); xr.parse(new InputSource(istream)); ParsedExampleDataSet parsedExampleDataSet = myExampleHandler.getParsedData(); tv.setText(parsedExampleDataSet.toString1()); } catch (Exception e){ tv.setText("Error: " + e.getMessage()); } this.setContentView(tv); } } If I want to modify to read file at sdcard, how must i do? Thanks, --Alex --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---