我在共享globalVaribale类时遇到了一些麻烦:
这是我的班级:
public class GlobalObjects extends Application {
private Context context;
public GlobalObjects(Context context) {
this.context = context;
}
// Variables
private Network network;
// Getters And Setters
public Context getContext() {
return context;
}
public void setContext(Context context) {
this.context = context;
}
public Network getNetwork() {
return network;
}
public void setNetwork(Network network) {
this.network = network;
}
}
这是我的android清单文件:
<application
android:name="GlobalObjects"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
我已将全局对象添加到现有的应用程序标记中。但是当我运行这个类时它会出错:
08-07 21:19:58.867: E/AndroidRuntime(3588): FATAL EXCEPTION: main
08-07 21:19:58.867: E/AndroidRuntime(3588): java.lang.RuntimeException: Unable to instantiate application com.example.electronicmenu.GlobalObjects: java.lang.ClassNotFoundException: com.example.electronicmenu.GlobalObjects