2011-03-15 2 views
0

gesturebuilder를 사용하여 만든 제스처 라이브러리에서 제스처 ID 목록을 얻은 다음 어레이에 저장된 이미지에 연결합니다. 이미지가 제스처 오버레이보기에 추가되어 사용됩니다.제스처 ID를 가져 와서 배열의 이미지에 연결하는 방법

각 제스처를 이미지에 연결하고 싶기 때문에 어떤 종류의 ID 또는 이름이 필요합니다. 제스처를 위해 샘플 및 기타 온라인 자료를 살펴 보았습니다.이 문제에 대한 정보는 없습니다.

이 문제에 도움을 주시면 감사하겠습니다.

예 :

//Link the images to the gesture ids, so when a user draws an "a", 
//it is linked to the gesture "a" 
if (sStore.load()) 
{ 

     for (String name : sStore.getGestureEntries()) 
    { 
     //Stores the gesture and its name into Gesture gesture 
    for (Gesture gesture : sStore.getGestures(name)) 
    { 
     gesture.getID(); 
      //link IDs to image_array[i] 

     } 
    } 
} 


//match the image and the gesture, after a touch event. 
if (predictions.size() > 0) 
{ 
Prediction prediction = predictions.get(0); 
if(prediction.score > 1.0) 
{ 
     if(prediction.best_score == Current_Image) 
     { 
      Correct(); 
      Next_image(); 
     } 
    } 
} 
+0

자세한 정보가 필요합니다. 제스처 라이브러리의 API에 연결할 수 있습니까? – Blundell

+0

다음은 링크 정보입니다 : http://developer.android.com/reference/android/gesture/package-summary.html http://developer.android.com/resources/articles/gestures.html – Navigatron

답변

0
GestureLibrary store = GestureLibraries.fromFile("/the/gesture/file"); 
if (store.load()){ 
    for (String name : store.getGestureEntries()){ 
     // access each gesture name/id 
    } 
} 

재미있는 것은 사물의 이런 종류의 작업을 수행하는 방법의 전체 예제는 안드로이드 SDK의 샘플 디렉토리 안에 있다는 것입니다.

+0

나는 Cestian을 GestureBuilderActivity.java 파일에서 볼 수 없었습니다. 정보 주셔서 감사합니다! – Navigatron

0

각 제스처에 대해 별도의 제스처 라이브러리를 만드는 경우 각 라이브러리를 배열에 넣을 수 있습니다. 이 제스처 라이브러리 배열은 해당 인덱스와 이미지 배열을 일치시킬 수 있습니다. 이미지를 선택할 때 해당 제스처 라이브러리가로드되어 있는지 확인하십시오.

관련 문제