私は Android の新入生です。Web サイトから xml をフェッチして、リストビューにサムネイルと共にテキストを表示することができます。デフォルトのアプリケーションでアイテムを表示できます。ほとんどの場合、ブラウザまたはメディア プレーヤーが開きますが、アプリケーション内のコンテンツを二次的なアクティビティで表示したいと考えています。xml のタグからメディアの種類を検出し、関連するモジュール/クラスを使用して二次アクティビティに表示する必要があります。アクティビティを追加し、さまざまなメディア タイプを内部で開く方法がわかりません。以下は私が今使っているコードです。私は全くの初心者であることを念頭に置いて私を導いてください。前もって感謝します。
xml は次のようになります。
<items count="1">
<item>
<title>This is title no 1</title>
<description>this is description</description>
<type>mp3, image, video</type>
<date>date of item</date>
<thumb>url of an thumbnail</thumb>
<url>url to play item from</url>
</item>
</items>
//リストビューのクリックコード:
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String title = ((TextView) view.findViewById(R.id.title)).getText().toString();
String description = ((TextView) view.findViewById(R.id.desc)).getText().toString();
String type = ((TextView) view.findViewById(R.id.type)).getText().toString();
String cTime = ((TextView) view.findViewById(R.id.time)).getText().toString();
Element e = (Element) nl.item(position); //using final var to get previously declared xmls
String imageurl = parser.getValue(e, KEY_URL);
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(imageurl)));
}