こんにちは、以下のコードは Android の AR アプリ用です。コードはエラーメッセージを表示します:
エラー:catch型の不正な開始
私は、「catch」ステートメントの前に誤って配置された右中括弧のコードを完全にチェックしました。セミコロンにも。では、なぜJavaが上記のエラーを出すのですか? 私のコードを確認してください。おそらく私は間違ってチェックしました。
public class HelloArActivity<exception> extends
AppCompatActivity implements GLSurfaceView.Renderer {
private static final String TAG =
HelloArActivity.class.getSimpleName();
private GLSurfaceView surfaceView;
private boolean installRequested;
private int session;
Set up tap listener.
private GestureDetector gestureDetector = new
GestureDetector(
this,
new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onSingleTapUp(MotionEvent e) {
onSingleTap(e);
return true;
}
@Override
public boolean onDown(MotionEvent e) {
return true;
}
@Override
public void onLongPress(MotionEvent e) {
onLongPressDown(e);
}
});
private Snackbar messageSnackbar;
private DisplayRotationHelper displayRotationHelper;
private final BackgroundRenderer backgroundRenderer =
new BackgroundRenderer();
private final ObjectRenderer virtualObject = new
ObjectRenderer();
private final ObjectRenderer virtualObjectShadow = new
ObjectRenderer();
private final PlaneRenderer planeRenderer = new
PlaneRenderer();
private final PointCloudRenderer pointCloud = new
PointCloudRenderer();
private final float[] anchorMatrix = new float[16];
private final ArrayBlockingQueue<MotionEvent>
queuedSingleTaps = new ArrayBlockingQueue<>(16);
private final ArrayList<Anchor> anchors = new
ArrayList<>();
private Object UnavailableArcoreNotInstalledException;
private Object
UnavailableUserDeclinedInstallationException;
@SuppressLint("ClickableViewAccessibility")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
surfaceView = findViewById(R.id.surfaceview);
displayRotationHelper = new
DisplayRotationHelper(/*context=*/ this);
surfaceView.setOnTouchListener(
new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return gestureDetector.onTouchEvent(event);
}
});
surfaceView.setPreserveEGLContextOnPause(true);
surfaceView.setEGLContextClientVersion(2);
surfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0); //
Alpha used for plane blending.
surfaceView.setRenderer(this);
surfaceView.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUoSLY);
installRequested = false;
}
private void onLongPressDown(MotionEvent e) {
anchors.clear();
}
@Override
protected void onResume() {
super.onResume();
installRequested = false;
}
private void onLongPressDown(MotionEvent e) {
anchors.clear();
}
@Override
protected void onResume() {
super.onResume();
Exception exception;
if (session == Integer.parseInt(null)) {
exception = null;
String message = null;
try {
session = 0;
int onDrawFrame = 60;
Class<Session> frame = new session();
} catch (IOException e) {
e.printStackTrace();
}
switch (ArCoreApk.getInstance().requestInstall(this, !installRequested)) {
case INSTALL_REQUESTED:
installRequested = true;
return;
case INSTALLED:
break;
}
// ARCore requires camera permissions to operate. If we did not yet obtain runtime
// permission on Android M and above, now is a good time to ask the user for it.
if (!CameraPermissionHelper.hasCameraPermission(this)) {
CameraPermissionHelper.requestCameraPermission(this);
return;
}
session = new Session(/* context= */ this);
}
final UnavailableUserDeclinedInstallationException unavailableUserDeclinedInstallationException = (com.google.ar.core.exceptions.UnavailableUserDeclinedInstallationException) UnavailableUserDeclinedInstallationException;
{
message = "Please install ARCore" | (UnavailableArcoreNotInstalledException);
exception = e;
}
final Exception e = new
ThreadLocal<UnavailableApkTooOldException>();
message = "Please update ARCore";
}
catch(IOError) {