java - Launching activity from library : NullPointerException -
java - Launching activity from library : NullPointerException -
i'm coming : how create jar android library project
which accepted reply assume work intented. :
i have project library b attached (properties->android->library->add)
the library b declared library (properties->android->library->is library checked) , have followed step described commonsware in original thread linked above (meaning, classes in jar in library , src folder empty ensure library not modified open source one)
i have declared activities library b in manifest of a. , there no activity nor ressources same name in b , a.
i using in :
intent = new intent(mainactivity.this.getapplicationcontext(), com.dmdsante.mydmdpost.activity.mdpmainactivity.class); i.putextra("access_token", "test"); startactivity(i);
and next error :
06-24 14:25:49.826: e/androidruntime(14778): fatal exception: main 06-24 14:25:49.826: e/androidruntime(14778): process: com.example.ids, pid: 14778 06-24 14:25:49.826: e/androidruntime(14778): java.lang.nullpointerexception 06-24 14:25:49.826: e/androidruntime(14778): @ com.dmdsante.mydmdpost.activity.mdpmainactivity$getconfig.onpostexecute(mdpmainactivity.java:303) 06-24 14:25:49.826: e/androidruntime(14778): @ com.dmdsante.mydmdpost.activity.mdpmainactivity$getconfig.onpostexecute(mdpmainactivity.java:1) 06-24 14:25:49.826: e/androidruntime(14778): @ android.os.asynctask.finish(asynctask.java:632) 06-24 14:25:49.826: e/androidruntime(14778): @ android.os.asynctask.access$600(asynctask.java:177) 06-24 14:25:49.826: e/androidruntime(14778): @ android.os.asynctask$internalhandler.handlemessage(asynctask.java:645) 06-24 14:25:49.826: e/androidruntime(14778): @ android.os.handler.dispatchmessage(handler.java:102) 06-24 14:25:49.826: e/androidruntime(14778): @ android.os.looper.loop(looper.java:136) 06-24 14:25:49.826: e/androidruntime(14778): @ android.app.activitythread.main(activitythread.java:5017) 06-24 14:25:49.826: e/androidruntime(14778): @ java.lang.reflect.method.invokenative(native method) 06-24 14:25:49.826: e/androidruntime(14778): @ java.lang.reflect.method.invoke(method.java:515) 06-24 14:25:49.826: e/androidruntime(14778): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:779) 06-24 14:25:49.826: e/androidruntime(14778): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:595) 06-24 14:25:49.826: e/androidruntime(14778): @ dalvik.system.nativestart.main(native method)
line 303 refers btn_devenez_evaluateur.settext("test");
in sample of code library b :
setcontentview(com.dmdsante.mydmdpost.r.layout.mdp_activity_main); btn_devenez_evaluateur = (button) findviewbyid(com.dmdsante.mydmdpost.r.id.btn_devenez_evaluateur); btn_devenez_evaluateur.settext("test");
when using b library in classic way (meaning no jar , classes in src folder), works fine. doing wrong ?
edit : manifest.xml project :
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.ids" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="10" android:targetsdkversion="19" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.get_tasks" /> <uses-permission android:name="android.permission.access_network_state" /> <application android:icon="@drawable/ic_launcher" android:allowbackup="true" android:theme="@style/apptheme" > <activity android:name="com.example.ids.mainactivity" android:launchmode="singletask" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name="com.dmdsante.mydmdpost.activity.mdpmainactivity" android:windowsoftinputmode="statehidden" > </activity> <activity android:name="com.dmdsante.mydmdpost.activity.mdpsearchactivity" android:windowsoftinputmode="statehidden" > </activity> <activity android:name="com.dmdsante.mydmdpost.listview.mdpplatformlistviewactivity" android:windowsoftinputmode="statehidden" > </activity> <activity android:name="com.dmdsante.mydmdpost.activity.mdplookupactivity" > </activity> <activity android:name="com.dmdsante.mydmdpost.activity.mdpfullscreenviewactivity" > </activity> </application> </manifest>
java android
Comments
Post a Comment