Mah95
Mah95

Reputation: 9

Android Studio Cannot resolve method setView

I have a problem. I want to make an application with Augmented Images and this is a part of my code:

package com.google.ar.sceneform.samples.augmentedimage;

import android.content.Context;
import android.net.Uri;
import android.util.Log;
import com.google.ar.core.AugmentedImage;
import com.google.ar.sceneform.AnchorNode;
import com.google.ar.sceneform.Node;
import com.google.ar.sceneform.math.Vector3;
import com.google.ar.sceneform.rendering.ModelRenderable;
import com.google.ar.sceneform.rendering.ViewRenderable;

import java.util.concurrent.CompletableFuture;


import android.app.Activity;


@SuppressWarnings({"AndroidApiChecker"})
public class AugmentedImageNode extends AnchorNode {

  private static final String TAG = "AugmentedImageNode";

  private AugmentedImage image;

  private static CompletableFuture<ModelRenderable> anzeige;
  private ViewRenderable testrenderable;


  public AugmentedImageNode(Context context) {
    if (anzeige == null) {

      anzeige =
              ViewRenderable.builder()
                      .setView(this, R.layout.test)
                      .build().thenAccept(renderable -> testrenderable = renderable);
    }
  }

At this position

.setView(this, R.layout.test)

I get the error warning : "Cannot resolve method setView(com.google.ar,sceneform.samples.augmentedimage.AugmentedImageNode,int)

Can someone help me please

Upvotes: 0

Views: 863

Answers (1)

theBrainyGeek
theBrainyGeek

Reputation: 584

If you reference The ARCore Reference, you'll see that the builder() of ViewRenderable object has a method setView but the forst parameter is context. Replace your line with .setView(context, R.layout.test)

Upvotes: 1

Related Questions