0
public class GusterActivity extends Activity implements OnGesturePerformedListener
{
TextView txtmsg;
TextView txtwrt;
private GestureLibrary gesturelib;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GestureOverlayView gestureoverlayview=new GestureOverlayView(this);
View inflate=getLayoutInflater().inflate(R.layout.main,null);
gestureoverlayview.addView(inflate);
gestureoverlayview.addOnGesturePerformedListener(this);
gesturelib= GestureLibraries.fromRawResource(this,R.raw.gestures);
if(gesturelib.load()){
finish();
}
setContentView(gestureoverlayview);
}
public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
ArrayList<Prediction> predictions = gesturelib.recognize(gesture);
for(Prediction prediction : predictions){
if(prediction.score>1.0){
Toast.makeText(this,prediction.name,Toast.LENGTH_SHORT);
}
}
}
安置自己的logcat輸出.. – 2012-01-31 09:59:51
謝謝。它已成功完成並更正 – Nansu 2012-02-14 08:46:46