RuntimeException
添加此库后,我的应用程序正在抛出一个。现在,例如其他帖子建议我必须Activity
在我的Manifest
. 我怎样才能用 BetterPickers 做到这一点?这是Manifest
库中示例应用程序的文件,这是我的:
<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<!-- First item is for saving state while rotating -->
<activity
android:windowSoftInputMode="stateHidden|adjustNothing"
android:configChanges="orientation|keyboardHidden|screenSize"
android:launchMode="singleTop"
android:name="com.foodbuilder.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- Searchable configuration -->
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="@xml/searchable" />
</activity>
</application>
</manifest>
编辑:这是我的 LogCat
08-20 14:32:00.740: E/AndroidRuntime(24371): FATAL EXCEPTION: main
08-20 14:32:00.740: E/AndroidRuntime(24371): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.foodbuilder/com.foodbuilder.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.foodbuilder.MainActivity" on path: /data/app/com.foodbuilder-2.apk
08-20 14:32:00.740: E/AndroidRuntime(24371): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2224)
08-20 14:32:00.740: E/AndroidRuntime(24371): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358)
08-20 14:32:00.740: E/AndroidRuntime(24371): at android.app.ActivityThread.access$600(ActivityThread.java:153)
08-20 14:32:00.740: E/AndroidRuntime(24371): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
08-20 14:32:00.740: E/AndroidRuntime(24371): at android.os.Handler.dispatchMessage(Handler.java:99)
08-20 14:32:00.740: E/AndroidRuntime(24371): at android.os.Looper.loop(Looper.java:137)
08-20 14:32:00.740: E/AndroidRuntime(24371): at android.app.ActivityThread.main(ActivityThread.java:5227)
08-20 14:32:00.740: E/AndroidRuntime(24371): at java.lang.reflect.Method.invokeNative(Native Method)
08-20 14:32:00.740: E/AndroidRuntime(24371): at java.lang.reflect.Method.invoke(Method.java:511)
08-20 14:32:00.740: E/AndroidRuntime(24371): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
08-20 14:32:00.740: E/AndroidRuntime(24371): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
08-20 14:32:00.740: E/AndroidRuntime(24371): at dalvik.system.NativeStart.main(Native Method)
08-20 14:32:00.740: E/AndroidRuntime(24371): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.foodbuilder.MainActivity" on path: /data/app/com.foodbuilder-2.apk
08-20 14:32:00.740: E/AndroidRuntime(24371): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
08-20 14:32:00.740: E/AndroidRuntime(24371): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
08-20 14:32:00.740: E/AndroidRuntime(24371): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
08-20 14:32:00.740: E/AndroidRuntime(24371): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
08-20 14:32:00.740: E/AndroidRuntime(24371): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2215)
08-20 14:32:00.740: E/AndroidRuntime(24371): ... 11 more
这就是我尝试过的:
<activity>
...
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="com.doomonafireball.betterpickers"/>
</intent-filter>
</activity>
这是我添加库的方式:
这也是我的实现:
package com.foodbuilder;
import com.doomonafireball.betterpickers.numberpicker.NumberPickerBuilder;
import com.doomonafireball.betterpickers.numberpicker.NumberPickerDialogFragment;
public class MainActivity extends FragmentActivity implements TablesDialogFragment.NoticeDialogListener, NumberPickerDialogFragment.NumberPickerDialogHandler {
...
private NumberPickerBuilder numberPickerBuilder;
...
}
非常感谢!