我在共享 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