android - Unable to start activity ComponentInfo{..} : java.lang.NullPointerException -


i'm trying start new activity when button playlistbtn clicked, , i'm getting nullpointerexception, can't see did go wrong references.

complete error log:

04-08 17:02:07.847: e/androidruntime(5869): fatal exception: main 04-08 17:02:07.847: e/androidruntime(5869): java.lang.runtimeexception: unable start activity componentinfo{app.and.androidmusic/app.and.androidmusic.playlistactivity}: java.lang.nullpointerexception 04-08 17:02:07.847: e/androidruntime(5869):     @ android.app.activitythread.performlaunchactivity(activitythread.java:2180) 04-08 17:02:07.847: e/androidruntime(5869):     @ android.app.activitythread.handlelaunchactivity(activitythread.java:2230) 04-08 17:02:07.847: e/androidruntime(5869):     @ android.app.activitythread.access$600(activitythread.java:141) 04-08 17:02:07.847: e/androidruntime(5869):     @ android.app.activitythread$h.handlemessage(activitythread.java:1234) 04-08 17:02:07.847: e/androidruntime(5869):     @ android.os.handler.dispatchmessage(handler.java:99) 04-08 17:02:07.847: e/androidruntime(5869):     @ android.os.looper.loop(looper.java:137) 04-08 17:02:07.847: e/androidruntime(5869):     @ android.app.activitythread.main(activitythread.java:5039) 04-08 17:02:07.847: e/androidruntime(5869):     @ java.lang.reflect.method.invokenative(native method) 04-08 17:02:07.847: e/androidruntime(5869):     @ java.lang.reflect.method.invoke(method.java:511) 04-08 17:02:07.847: e/androidruntime(5869):     @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:793) 04-08 17:02:07.847: e/androidruntime(5869):     @ com.android.internal.os.zygoteinit.main(zygoteinit.java:560) 04-08 17:02:07.847: e/androidruntime(5869):     @ dalvik.system.nativestart.main(native method) 04-08 17:02:07.847: e/androidruntime(5869): caused by: java.lang.nullpointerexception 04-08 17:02:07.847: e/androidruntime(5869):     @ app.and.androidmusic.playlistactivity.oncreate(playlistactivity.java:68) 04-08 17:02:07.847: e/androidruntime(5869):     @ android.app.activity.performcreate(activity.java:5104) 04-08 17:02:07.847: e/androidruntime(5869):     @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1080) 04-08 17:02:07.847: e/androidruntime(5869):     @ android.app.activitythread.performlaunchactivity(activitythread.java:2144)    

mainactivity.java:

    public class mainactivity extends listactivity { ... protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main); ... button btnplaylist = (button) findviewbyid(r.id.playlistbtn); btnplaylist.setonclicklistener(new view.onclicklistener() {                                       @override             public void onclick(view arg0) {             intent in = new intent(getapplicationcontext(), playlistactivity.class);                         startactivity(in); 

playlistactivity.java:

public class playlistactivity extends listactivity{ ... @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_playlist); { 

androidmanifest.xml:

<activity             android:name="app.and.androidmusic.mainactivity"             android:label="@string/app_name" >             <intent-filter>                 <action android:name="android.intent.action.main" />                 <category android:name="android.intent.category.launcher" />             </intent-filter>         </activity>                 <activity             android:name=".playlistactivity" /> 

ok, here activity_main.xml asked it's quite long:

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"     tools:context=".mainactivity" >      <app.and.androidmusic.dragndroplistview         android:id="@+id/android:list"         android:layout_width="match_parent"         android:layout_height="300dp"         android:layout_below="@+id/playlistbtn"         android:layout_alignparentleft="true" >    </app.and.androidmusic.dragndroplistview>      <button         android:id="@+id/playbtn"         android:layout_width="wrap_content"         android:layout_height="wrap_content"        android:layout_below="@id/android:list"         android:layout_torightof="@+id/prevbtn"         android:text="@string/playbtn" />      <button         android:id="@+id/pausebtn"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_below="@id/android:list"         android:layout_torightof="@+id/playbtn"         android:text="@string/pausebtn" />      <button         android:id="@+id/prevbtn"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_below="@id/android:list"         android:text="@string/prevbtn" />      <button         android:id="@+id/nextbtn"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_below="@id/android:list"         android:layout_torightof="@+id/pausebtn"         android:text="@string/nextbtn" />       <button         android:id="@+id/songsbtn"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_below="@+id/songtxt"         android:text="@string/songsbtn" />       <button         android:id="@+id/playlistbtn"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_below="@+id/songtxt"         android:layout_torightof="@+id/songsbtn"         android:text="@string/playlistbtn" />       <button         android:id="@+id/eqbtn"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_below="@+id/songtxt"         android:layout_torightof="@+id/playlistbtn"         android:text="@string/eqbtn" />       <textview          android:id="@+id/songtxt"          android:layout_width="wrap_content"          android:layout_height="wrap_content"          android:layout_alignparenttop="true"          android:layout_centerhorizontal="true"          android:text="" />  </relativelayout> 

wild guess:

btnplaylist null , there's no button id playlistbtn in activity_main.xml.

edit:

the problem inside playlistactivity (line 68). whatever object you're accessing there null.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -