我想将圆圈画成图标以显示当前位置。
但是错误发生在这个问题标题中。
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);
}
});
}
这是错误陈述:
尝试从字段中读取&#39; java.lang.String com.indooratlas.android.FloorPlan.url&#39;在null对象引用上 在com.indooratlas._internal.cd.fetchFloorPlanImage 在skripsi.ubm.studenttracking.indoor.onServiceUpdate(indoor.java:257)
正如我的推测是在Floorplan floorplan = null。
答案 0 :(得分:0)
该方法需要非null的第一个参数。不要用空参数调用它。