我正在解析服务器上的XML,我读它并解析它没有任何错误但是我无法看到数据.
这是我的XML:
<BookData><book><Title><![CDATA[ABC]]></Title><AuthorFName1><![CDATA[A]]></AuthorFName1><AuthorLName1><![CDATA[B]]></AuthorLName1></book><book><Title><![CDATA[XYZ]]></Title><AuthorFName1><![CDATA[A]]></AuthorFName1><AuthorLName1><![CDATA[B]]></AuthorLName1></book>
Run Code Online (Sandbox Code Playgroud)
我正在使用DocumentBuilderFactory即使我设置也看到了代码
dbf.setCoalescing(true);
Run Code Online (Sandbox Code Playgroud)
但仍然无法正常工作请参阅DocumentBuilderFactory的代码
Document doc = null;
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setCoalescing(true);
try {
DocumentBuilder db = dbf.newDocumentBuilder();
InputSource is = new InputSource();
is.setCharacterStream(new StringReader(xml));
doc = db.parse(is);
} catch (ParserConfigurationException e) {
Log.d("XML parse Error:", e.getMessage());
return null;
} catch (SAXException e) {
Log.d("Wrong XML File Structure", e.getMessage());
return null;
} catch (IOException e) {
Log.d("IOException", e.getMessage());
return null;
}
Run Code Online (Sandbox Code Playgroud) 我正在开发一个应用程序,该应用程序以图像作为索引来选择活动将开始的特定图像,但我不知道如何在 Canvas 中设置 onClickListener 或 onTouchListener 这是我的代码
public class DrawView extends View implements OnTouchListener {
LinearLayout mLayout;
Bitmap index;
Bitmap book;
Bitmap bird;
Bitmap game;
Bitmap mail;
Bitmap music;
Bitmap torch;
Paint paint;
public DrawView(Context context) {
super(context);
setFocusable(true);
setFocusableInTouchMode(true);
this.setOnTouchListener(this);
index = BitmapFactory.decodeResource(getResources(), R.drawable.photo1);
book = BitmapFactory.decodeResource(getResources(), R.drawable.book);
game = BitmapFactory.decodeResource(getResources(), R.drawable.game);
music = BitmapFactory.decodeResource(getResources(), R.drawable.music);
}
public void onDraw(Canvas canvas){
paint = new Paint();
Bitmap indexcanvas = Bitmap.createScaledBitmap(index, canvas.getWidth(),
canvas.getHeight(), true);
canvas.drawBitmap(indexcanvas, 0, 0, paint);
canvas.drawBitmap(book, 160, 100, …Run Code Online (Sandbox Code Playgroud) 我正在开发一个Android应用程序我想从Excel文件中读取数据任何人有想法如何在Android中读取Excel文件.我将我的文件保存在res/raw文件夹中并尝试按照本教程中的说明阅读http://www.vogella.de/articles/JavaExcel/article.html如果有人有想法然后回复请不要工作
谢谢
阿布舍克
我正在开发一个Application.My要求是显示图像和字符串(标题和字幕).图像和字符串都被下载和解析然后显示.我正在使用Hashmap<ImageView, String>/目前我能够在ListView中显示图像,但我不知道如何根据Image显示字符串.请帮助我如果有人有逻辑.
谢谢.
阿布舍克
在我的Android应用程序中,我正在尝试显示德语文本.öäüß这些角色无法显示TextView.如果有人知道如何设置字体或如何显示字符让我知道.我从服务中收到的数据.