这个问题已经持续了一周,我需要帮助,如何获取语言类型的值并在对话框中显示 id,以便在此对话框中显示它的语言,如英语、法语等,我将等待接受有效的答案。我真的不知道如何获取此信息并将其显示在对话框列表中。
XML
<streamlanguage>
<language_type id="English">
http://154.obj.netromedia.net/IMMPowered/Aucoms1/playlist.m3u8
</language_type>
<language_type id="French">
http://155.obj.netromedia.net/ipadhigh/Frenchlanx/playlist.m3u8
</language_type>
<language_type id="German">
http://155.obj.netromedia.net/ipadhigh/Germanlanx/playlist.m3u8
</language_type>
<language_type id="Russian">
http://155.obj.netromedia.net/ipadhigh/Russianlanx/playlist.m3u8
</language_type>
<language_type id="Arabic">
http://155.obj.netromedia.net/ipadhigh/Arabiclanx/playlist.m3u8
</language_type>
<language_type id="Hindi">
http://155.obj.netromedia.net/ipadhigh/Hindilanx/playlist.m3u8
</language_type>
<language_type id="Portuguese">
http://155.obj.netromedia.net/ipadhigh/Portulanx/playlist.m3u8
</language_type>
</streamlanguage>
活动
public class Language extends Activity {
String URL = "";
static final String KEY_LANG = "streamlanguage";
static final String KEY_ID = "id";
static final String KEY_TITLE = "language_type";
ArrayList<String> menuItems;
ArrayList<String> menuKeys;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.commentlayout);
XMLParser parser = new XMLParser();
String xml = parser.getXmlFromUrl(URL); // getting XML
Document doc = parser.getDomElement(xml); // getting DOM element
NodeList nl = doc.getElementsByTagName("KEY_LANG");
for (int i = 0; i < nl.getLength(); i++) {
Element e = (Element) nl.item(i);
List<String> list = new ArrayList<String>();
list.add("("+parser.getValue(e, KEY_ID)+") "+parser.getValue(e, KEY_TITLE));
}
}
}