androidでxmlを読み込む。
ファイルからの読み込みの場合は、getAssets()を使う。
この場合、ファイルはassets配下に置くこと。
// 参照元 http://isakado.blog106.fc2.com/blog-entry-10.html TextView tv = (TextView) findViewById(R.id.txt); StringBuffer sb = new StringBuffer(); try { InputStream stream = getAssets().open("test.txt"); byte[] b = new byte[1024]; while ((stream.read(b)) >= 0) { sb.append(new String(b)); } stream.close(); } catch (IOException e) { } tv.setText(sb.toString());
xmlは XmlPullParser クラスを使う。以下を参照のこと
http://blog.5ive.info/archives/938
http://www.ibm.com/developerworks/jp/xml/library/x-android/