2015-05-18 57 views
-1

我想繪製圓形作爲圖標以顯示當前位置。嘗試從空字段'java.lang.String com.indooratlas.android.FloorPlan.url'讀取空對象參考

但在此問題標題中出現錯誤。

public void onServiceUpdate(ServiceState state) {  
FloorPlan floorPlan = null; 
    BitmapFactory.Options options = new BitmapFactory.Options(); 
    options.inDither = true; 
    options.inScaled = false; 
    options.inPreferredConfig = Bitmap.Config.ARGB_8888; 
    FutureResult<Bitmap> result = mIndoorAtlas.fetchFloorPlanImage(floorPlan, options); <---- line 257 --- 
    result.setCallback(new ResultCallback<Bitmap>() { 
     @Override 
     public void onResult(final Bitmap result) { 
      runOnUiThread(new Runnable() { 
       @Override 
       public void run() { 
        ImageView imageView = (ImageView) findViewById(R.id.imageView); 
        Bitmap bitmapCircle = Bitmap.createBitmap(result.getWidth(), result.getHeight(), result.getConfig()); 
        Canvas canvas = new Canvas(bitmapCircle); 
        Paint paint = new Paint(); 
        paint.setAntiAlias(true); 
        paint.setColor(Color.BLUE); 
        paint.setStrokeWidth(10); 
        canvas.drawBitmap(result, new Matrix(), null); 
        canvas.drawCircle(i, j, 10, paint); 
        imageView.setImageBitmap(bitmapCircle); 
       } 
      }); 

     } 

這是錯誤的語句:

嘗試從外地「java.lang.String中com.indooratlas.android.FloorPlan.url」讀上在com.indooratlas空對象引用 。 _internal.cd.fetchFloorPlanImage at skripsi.ubm.studenttracking.indoor.onServiceUpdate(indoor.java:257)

正如我的推測是在Floorplan floorplan = null。

回答

0

該方法需要一個非空的第一個參數。不要用空參數來調用它。

相關問題