2017-06-08 31 views
-4

你能幫我找出下面的錯誤是什麼意思嗎?我不知道爲什麼我不能在包裝外面訪問它,我的意思是我應該使用哪種ACCESS SPECIFIER? 我嘗試使用靜態和所有說明符,但仍然無法擺脫此錯誤。當用戶使用相機將圖片上傳到服務器時,我一直在使用它。編譯錯誤= multipartentitybuilder()不公開,不能從外部程序包中訪問

public class Logistic_ReportProblem extends Activity { 
@Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_reportproblem); 
     context = this; 
     thisActivity = this; 

     assetsPropertyReader = new AssetsPropertyReader(context); 
     p = assetsPropertyReader.getProperties("tapp.properties"); 
     url1 = p.getProperty("FP_BASEURL").toString(); 
     url2 = p.getProperty("FP_LOGISTIC_IMGUPLD_PROBLEM").toString(); 

     camera = (Button) findViewById(R.id.btn_camera); 
     done = (Button) findViewById(R.id.btn_done); 

     title = (EditText) findViewById(R.id.workorder_title); 
     notes = (EditText) findViewById(R.id.workorder_notes); 
     latlongInfo = (TextView) findViewById(R.id.latlngStatus); 

     showSavedFiles(); 
     camera.setOnClickListener(new View.OnClickListener() { 
      @Override 
      public void onClick(View v) { 

       if (entity == null) { 
        entity = new MultipartEntityBuilder();// err 
       } 

       if (!checkPermissionForStorage()) { 
        requestPermissionForStorage(); 
       } else { 
        if (!checkPermissionForCamera()) { 
         requestPermissionForCamera(); 
        } else { 
         if (5 == file_count) { 
          Toast.makeText(Logistic_ReportProblem.this, "You have already added 5 images", Toast.LENGTH_SHORT).show(); 
         } else { 
          Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 
          startActivityForResult(cameraIntent, CAMERA_REQUEST); 
         } 
        } 
       } 
      } 
     }); 
+1

請分享你的'MultipartEntityBuilder'代碼。你可能把它變成了一個私人類,或者你根本沒有指定一個訪問說明符 – 0xDEADC0DE

+0

_i知道這個問題之前被問過,但是我搜索了每個where__我沒有找到正確的ans_。請只解釋我的問題..足夠.. – opalfire

+0

是你問我MultiriplentEntityBuilder.class由andriod構建的 – opalfire

回答

1

它看起來像MultipartEntityBuilder沒有公共構造函數。請查看文檔: https://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntityBuilder.html

你應該用靜態方法create創建對象:

MultipartEntityBuilder entity = new MultipartEntityBuilder.create() 
+0

仍然有相同的錯誤..沒有變化..我會像共享代碼和圖像的錯誤..但stackoverflow.com不讓我把整個代碼和圖像... – opalfire

+0

你能告訴什麼是這些錯誤的含義 – opalfire

+0

你試圖調用一個非公共的構造函數。 –

相關問題