简体   繁体   English

Android Studio:无法解析符号

[英]android studio: cannot resolve symbol

I am unable to identify the problem. 我无法确定问题所在。 The songCollection.searchById ( songCollection is always underlined red) saying that the symbol cannot be identified even though I already have a SongCollection class. songCollection.searchByIdsongCollection始终songCollection红色下划线)表示即使我已经具有SongCollection类,也无法识别该符号。

public void handleSelection(View view) {
    String resourceId = AppUtil.getResourceId(getContext(), view);
    Song selectedSong = songCollection.searchById(resourceId);

    AppUtil.popMessage(getContext(), "Streaming Song: " + selectedSong.getTitle());

    sendDataToActivity(selectedSong);
}

song collection class 歌集班

public class SongCollection {
   private Song[] songs = new Song[5];

   public SongCollection() {
    prepareSong();
   }

Therefore, I cannot play my application or make my songs clickable 因此,我无法播放我的应用程序或使我的歌曲无法点击

可能是您没有在这样的地方实例化SongSelection:

SongSelection songSelection = new SongSelection(); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM