对于一个存有Gesture对象的GestureLibrary对象来说, 应该如何保存GestureLibrary对象呢?
static GestureLibrary  fromFile(String path)  这个方法构造了GestureLibrary对象,是不是还需要load一下,才能用recognize等方法呢?

解决方案 »

  1.   


    可以不用这是源码 只是加载文件内存储的手势 没什么特殊标记 但是不load gesturelib内没匹配对象recognize也没用,也可以运行中再加载手势对象然后保存。        public boolean load() {
                boolean result = false;
                final File file = mPath;
                if (file.exists() && file.canRead()) {
                    try {
                        mStore.load(new FileInputStream(file), true);
                        result = true;
                    } catch (FileNotFoundException e) {
                        Log.d(LOG_TAG, "Could not load the gesture library from " + mPath, e);
                    } catch (IOException e) {
                        Log.d(LOG_TAG, "Could not load the gesture library from " + mPath, e);
                    }
                }
              return result;
            }
    一般可以这样写        gesturelib = GestureLibraries.fromFile(path);
            if (!gesturelib.load()) {
       Log.w("GestureActivity", "could not load gesture library");
       finish();
    }
    保存GestureLibrary对象用save方法就保存在path路径里了