Java Android AsyncTask错误,试图分配较弱的访问权限。

Java Android AsyncTask错误,试图分配较弱的访问权限。,java,android,android-asynctask,Java,Android,Android Asynctask,我被此问题困扰,我继续收到以下错误: “processFinish(Boolean)”中的匿名类派生自 MainActivity.AsyncGETRequestProcess.AsyncResponse'与发生冲突 中的“processFinish(布尔)”命令 MainActivity.AsyncGETRequestProcess.AsyncResponse';试图 分配较弱的访问权限(“packageLocal”);这是公开的 我试图完成的是,在我收到来自Intent的数据后,从内部Main

我被此问题困扰,我继续收到以下错误:

“processFinish(Boolean)”中的匿名类派生自 MainActivity.AsyncGETRequestProcess.AsyncResponse'与发生冲突 中的“processFinish(布尔)”命令 MainActivity.AsyncGETRequestProcess.AsyncResponse';试图 分配较弱的访问权限(“packageLocal”);这是公开的

我试图完成的是,在我收到来自Intent的数据后,从内部
MainActivity
运行AsyncTask

以下是接收到错误的onResume代码,以及调用Asynctask的代码:

 @Override
    protected void onResume(){
        super.onResume();

        IntentFilter intentFilter = new IntentFilter("cb.MainActivity.WebServiceReceiver.ReturnedReceivedDataFilePath");
        receiver = new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                //Get message from WebServiceReceiver Intent
                String ReceivedDataFilePath = intent.getStringExtra("WebServiceReceiver_ReturnedReceivedDataFilePath");


                new AsyncGETRequestProcess(new AsyncGETRequestProcess.AsyncResponse(){
                      //THE ABOVE ERROR HAPPENS HERE... processFinish
                      @Override
                      void processFinish(boolean success){
                        if(success){
                            MainActivity.getInstance().txtStatus.setText("Loading screen...");
                            Intent RouteScreenActivityIntent = new Intent(MainActivity.getInstance(), RouteScreenActivity.class);
                            MainActivity.getInstance().startActivity(RouteScreenActivityIntent);
                        }else{
                            //ERROR MSG
                        }
                        //Stop the spinner in MainActivity
                        MainActivity.getInstance().MainActSpinner.setVisibility(View.GONE);
                        MainActivity.getInstance().txtStatus.setText("");
                    }
                }).execute(ReceivedDataFilePath).get();

            }
        };
下面是我的
AsyncGETRequestProcess类
,它扩展了AsyncTask:

 //THE FOLLOWING CLASS RESIDES WITHIN MainActivity Class...
 public static class AsyncGETRequestProcess extends AsyncTask<String, Void, Void> {

        public interface AsyncResponse {
            void processFinish(boolean success);
        }

        public AsyncResponse delegate = null;

        public AsyncGETRequestProcess(AsyncResponse delegate){
            this.delegate = delegate;
        }

        @Override
        protected Void doInBackground(String... strings) {
            //Read the temp file location and create model of 'GET' Data Received.
            GetRequestRoot getRequestRootModel = Core.Helper.GetRootObjFromGetRequestTempFile(strings[0]);

            Boolean responseResult = ServerResponse.ProcessGetRequestResultModel(getRequestRootModel);

            if(responseResult)
            {
                Core.Data.ObjModel = Core.Helper.GetInputFileAsObject();
                if(Core.Data.ObjModel == null){
                    delegate.processFinish(false);
                }
                else{
                    delegate.processFinish(true);
                }
            }else{
                delegate.processFinish(false);
            }

            return null;
        }

        @Override
        protected void onPreExecute(){

        }

        @Override
        protected void onPostExecute(Void result){

        }

    }
//以下类驻留在MainActivity类中。。。
公共静态类AsyncGETRequestProcess扩展了AsyncTask{
公共接口异步响应{
void processFinish(布尔成功);
}
公共异步响应委托=null;
公共AsyncGETRequestProcess(AsyncResponse委托){
this.delegate=委托;
}
@凌驾
受保护的Void doInBackground(字符串…字符串){
//读取临时文件位置并创建接收到的“获取”数据的模型。
GetRequestRoot getRequestRootModel=Core.Helper.GetRootObjFromGetRequestTempFile(字符串[0]);
Boolean responseResult=ServerResponse.ProcessGetRequestResultModel(getRequestRootModel);
如果(响应结果)
{
Core.Data.ObjModel=Core.Helper.GetInputFileAsObject();
if(Core.Data.ObjModel==null){
delegate.processFinish(false);
}
否则{
delegate.processFinish(true);
}
}否则{
delegate.processFinish(false);
}
返回null;
}
@凌驾
受保护的void onPreExecute(){
}
@凌驾
受保护的void onPostExecute(void结果){
}
}
我还得到了以下编译时错误

错误:(108,28)错误:中的processFinish(布尔值)无法在中实现processFinish(布尔值) AsyncResponse试图分配较弱的访问权限;是 公开的


我怎样才能解决这个问题?我不明白为什么会发生这种情况。

您应该公开您的方法processFinish:

           new AsyncGETRequestProcess(new AsyncGETRequestProcess.AsyncResponse(){
                  //THE ABOVE ERROR HAPPENS HERE... processFinish
                  @Override
                  public void processFinish(boolean success){
                  ^^^^^^

默认情况下,所有接口方法都是公共的

您缺少了
public
@Ferrybig这是我一直在读的内容,但我试图将其公开,什么都没有。哦,天哪。。。我一直这样做,但发现整个方法都出现了错误。。我从来没有费心把鼠标移过,看到我只是错过了一次尝试/捕捉!叹息。。。