从dip转换为px

时间:2011-06-01 21:06:49

标签: android

我目前正在运行下面的堆栈输出,因为它会引发错误。

    Resources r = getResources();
    float pix = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 14, r.getDisplayMetrics());

> Uncaught handler: thread main exiting due to uncaught exception
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test.pne/com.test.pne.one}: android.content.res.Resources$NotFoundException: String resource ID #0xe
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
at android.app.ActivityThread.access$2100(ActivityThread.java:116)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4203)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.res.Resources$NotFoundException: String resource ID #0xe
at android.content.res.Resources.getText(Resources.java:205)
at android.widget.TextView.setText(TextView.java:2809)
at com.quiz.max.Quiz.onCreate(Quiz.java:87)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
... 11 more

1 个答案:

答案 0 :(得分:0)

我甚至不知道你的问题是什么,但错误似乎是由一个未找到的String资源引起的(也许尝试修复Android项目属性?)

Caused by: android.content.res.Resources$NotFoundException: String resource ID #0xe at 

也许如果你解释更多你想要的东西,我可以尝试提供更多帮助。