调用CanvasWatchFaceService时没有实例错误



当我调用"私有类引擎扩展CanvasWatchFaceService。引擎",我得到的错误是"没有类型的封闭实例"android.support.wearable.watchface。CanvasWatchFaceService'在作用域中'

我已经调用了import类import android.support.wearable.watchface.CanvasWatchFaceService;但是它说这是一个未使用的import语句

更新:这是我的MyWatchFace.java的全部

package com.projects.kainowitzke.googlewatchface;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.os.Bundle;
import android.support.wearable.watchface.CanvasWatchFaceService;
import android.support.wearable.watchface.WatchFaceService;
import android.view.SurfaceHolder;
import android.support.wearable.watchface.CanvasWatchFaceService;
public class MyWatchface {
}
public class AnalogWatchFaceService extends MyWatchface {
@Override
public WatchFaceService.Engine onCreateEngine() {
    /* provide your watch face implementation */
    return new CanvasWatchFaceService.Engine();
}
/* implement service callback methods */
    private class MyWatchfac extends CanvasWatchFaceService.Engine {
    @Override
    public void onCreate(SurfaceHolder holder) {
        super.onCreate(holder);
        /* initialize your watch face */
    }
    @Override
    public void onPropertiesChanged(Bundle properties) {
        super.onPropertiesChanged(properties);
        /* get device features (burn-in, low-bit ambient) */
    }
    @Override
    public void onTimeTick() {
        super.onTimeTick();
        /* the time changed */
    }
    @Override
    public void onAmbientModeChanged(boolean inAmbientMode) {
        super.onAmbientModeChanged(inAmbientMode);
        /* the wearable switched between modes */
    }
    @Override
    public void onDraw(Canvas canvas, Rect bounds) {
        /* draw your watch face */
    }
    @Override
    public void onVisibilityChanged(boolean visible) {
        super.onVisibilityChanged(visible);
        /* the watch face became visible or invisible */
    }
}

}

MyWatchface必须扩展CanvasWatchFaceService

相关内容

  • 没有找到相关文章

最新更新