得到错误,变量不能解析为一个类型或者是不是现场 [英] Getting error , Variable cannot be resolved to a type or is not a field
本文介绍了得到错误,变量不能解析为一个类型或者是不是现场的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想一个数组是在3个不同的活动,可我想在任何活动所做的更改将反映在所有3项活动。所以,我创建了一个类
I want an array to be available in 3 different activities and I want the changes done in any activity to be reflected in all the 3 activities. So I created a class
public class GlobalSongList extends Application{
public ArrayList<SongDetails> NP_List = new ArrayList<SongDetails>();
public int position;
}
所以,当我尝试使用我可以用这NP_List在我activities.But
so that i can use this NP_List in my activities.But when i try to use
getApplicationContext().NP_List =//something i want......
我得到的错误如上所述....
I get the error as stated above ....
推荐答案
您需要转换 getApplicaitonContext()
到类:((GlobalSongList )getApplicationcontext())NP_List;
这篇关于得到错误,变量不能解析为一个类型或者是不是现场的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文