Hello my static method works when i call it first time but when i call it more than once its giving me strange error. Please help me in resolving this error
My Method
public static void XVD(String string){
String youtubeLink = "https://www.website.com/data?v="+string;
new DataExtractor(MainActivity.context) {
@Override
public void onExtractionComplete(SparseArray<YtFile> ytFiles, VideoMeta vMeta) {
if (ytFiles != null) {
}
}
}.extract(youtubeLink, true, true);
}
Error (on second call to above method)
java.lang.NullPointerException: Attempt to invoke virtual method 'java.io.File android.content.Context.getCacheDir()' on a null object reference