问题描述
我要通过Android的hello world教程,并试图创建一个XML UI时被卡住了。出于某种原因,即使是在一个新的程序,在其中我并没有更改默认的构建,它给每一个角色我输入后错误显示java.lang.NullPointerException。我想不通为什么它是这样做的,因为我只是想编辑我想设置可以说比什么是默认设置其他一些文本之间的文本。然而,即使有新的版本,没有任何变化,我只是尝试XML标签内更改文本,它仍然给错误。我需要做什么做的,使它能够让我打?我使用的IDE文摘和Android SDK。我能做到这一点并不涉及XML教程的第一部分。
I am going through the android hello world tutorial, and have been stuck when trying to create an XML UI. For some reason, even on a new program, in which I have made no changes to the default build, it gives the error java.lang.NullPointerException after every character I type. I can't figure out why it is doing this, as I am just trying to edit the text between the Text I want to set it to say something other than what is set by default. However, even with a fresh build, no changes, and I just try to change the text within the xml tags, it still gives the error. What do I need to do to allow it to let me type? I am using the eclips IDE and the android sdk. I was able to do the first part of the tutorial that doesn't involve XML.
推荐答案
好吧,我终于找到了答案其他地方,这是什么问题怎么该文件是默认创建的。我不得不添加的元素的xmlns:安卓如下:
Ok, I finally found the answer somewhere else, it was something wrong with how the file was created by default. I have to add the element xmlns:android as follows
<resources xmlns:android="http://schemas.android.com/apk/res/android" />
有趣的是,如果我在一个时间键入一个字符,驳回弹出每个击键该文件将正常工作。然而,新元素消除了弹出窗口。我不知道为什么会出错弹出,但该计划仍然编译和正确地在我的AVD运行。哦,好吧,如果你有这个错误添加的元素,它会消失。
Interestingly enough, the file will work if I type it one character at a time, dismissing the pop up with each keystroke. However the new element eliminates the pop ups. I am not sure why the error would pop up, yet the program still compile and run correctly on my avd. Oh well, if you have this error add the element and it goes away
这篇关于每个字符I型的Android string.xml错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!