具有堆栈跟踪错误的问题 [英] Having problems with Stack trace errors
问题描述
我是新到Android的工作室和我的应用程序破碎besuase code的行
i'm new to android studio and my app is crushing besuase line of code
songProgressBar.setOnSeekBarChangeListener(this);
张贴问题在这里帮助我意识到这是我的布局ID的错字。好吧,这里是code为我的布局songProgressBar作为ID。
posting a question here helped me to realize it is a typo with an id in my layout. Well, here is the code for my layout with songProgressBar as an id.
<SeekBar
android:id="@+id/songProgressBar"
android:layout_width="fill_parent"
android:layout_height="25dp"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:layout_above="@id/player_footer_bg"
android:thumb="@drawable/seek_handler"
android:progressDrawable="@drawable/seekbar_progress_blue"
android:paddingLeft="6dp"
android:paddingRight="6dp"/>
现在,我不知道错字是什么,我不知道我做的。谁告诉我的人这是一个错字说我应该检查组件是否在布局present活动运行时。我有不知道我现在做的事。请帮助。
Now, i don't know what the typo is, and i don't know what i'm to do. the person who told me it is a typo said i should check whether the component is present in the layout when the activity is running. I've got no idea what I'm to do now. pls help.
推荐答案
有似乎是一个空指针异常。
There seems to be a null pointer exception.
21:39:10.999 1443年至1443年/? E / AndroidRuntime:01-10显示java.lang.NullPointerException 21:39:致10.999 1443年至1443年/? E / AndroidRuntime:在com.example.passion.patrimusic.MainActivity.onCreate(MainActivity.java:86)01-10 21:39:10.999
21:39:10.999 1443-1443/? E/AndroidRuntime: Caused by: java.lang.NullPointerException 01-10 21:39:10.999 1443-1443/? E/AndroidRuntime: at com.example.passion.patrimusic.MainActivity.onCreate(MainActivity.java:86) 01-10 21:39:10.999
从你上面的评论,它可能是songProgressBar为空。
如果从布局得到它,检查是否有在ID的错字和组件是在布局present活动运行时。
And from your above comment, its possible that songProgressBar is null. If you are getting it from the layout, check if there's any typo in the Id and whether the component is present in the layout when the activity is running.
这篇关于具有堆栈跟踪错误的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!