Q:

Getting Error in Accessing Method from another class

I am not able to access getsongList() method from another class.
I want to access method in MainActivity class from "Songs" class. I tried by following code but i am getting an error. Please check that my code is correct or not.
Help me in fixing the code.
Songs Class
public class Songs extends Fragment {
    private ArrayList<SongModel> songList;
    public void getsongList(){
        //retrieve song info
    ContentResolver musicResolver = getActivity().getContentResolver();
    Uri musicUri = android.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
    Cursor musicCursor = musicResolver.query(musicUri, null, null, null, null);

    if(musicCursor!=null && musicCursor.moveToFirst()){
        //get columns
        int titleColumn = musicCursor.getColumnIndex
                (android.provider.MediaStore.Audio.Media.TITLE);
        int idColumn = musicCursor.getColumnIndex
                (android.provider.MediaStore.Audio.Media._ID);
        int artistColumn = musicCursor.getColumnIndex
                (android.provider.MediaStore.Audio.Media.ARTIST);
        //add songs to list
        do {
            long thisId = musicCursor.getLong(idColumn);
            String thisTitle = musicCursor.getString(titleColumn);
            String thisArtist = musicCursor.getString(artistColumn);
            songList.add(new SongModel(thisId, thisTitle, thisArtist));
        }
        while (musicCursor.moveToNext());
    }
    }
}

MainActivity Class
public class MainActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        Songs obj1 = new Songs();
        song = obj1.getsongList();
    }
}

A:

The method getsongList()  return void .To access like 
song = obj1.getsongList(); you should modify method signature from void to ArrayList and return songlist in that method
public void getsongList() 

to 

public ArrayList<SongModel> getsongList() {
return songList;
}

