Android multi stroke gesture not working -


i modified existing app,gesturebuilder,to accept multiple strokes.hence accept letter a,d, f , on. created simple app recognises if letter correct or not.my problem is:

1.i have recorded multi stroke letter in file called gesture gesturebuilder. 2.my application not accept multi stroke gesture.but have set fadeoffset 1000 , gesturestroketype multiple.i not know why happening.the moment enter next xtroke write capital previous stroke dissapears.i cant write multi stroke letters/symbols.

code:

xml file:

    <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:paddingbottom="@dimen/activity_vertical_margin"     android:paddingleft="@dimen/activity_horizontal_margin"     android:paddingright="@dimen/activity_horizontal_margin"     android:paddingtop="@dimen/activity_vertical_margin"     tools:context=".mainactivity"       >          <android.gesture.gestureoverlayview         android:id="@+id/gestures_overlay"         android:layout_width="match_parent"         android:layout_height="0dip"         android:layout_weight="1.0"         android:fadeoffset="5000"         android:eventsinterceptionenabled="true"          android:gesturestroketype="multiple" />            </linearlayout> 

java file:

package com.example.gesture_letter;           import java.util.arraylist;            import android.os.bundle;          import android.app.activity; import android.gesture.gesture; import android.gesture.gesturelibraries; import android.gesture.gesturelibrary; import android.gesture.gestureoverlayview; import android.gesture.gestureoverlayview.ongesturelistener; import android.gesture.gestureoverlayview.ongestureperformedlistener; import android.gesture.prediction; import android.graphics.color; import android.util.log; import android.view.menu; import android.view.motionevent; import android.view.view; import android.widget.toast;  public class mainactivity extends activity implements  ongestureperformedlistener {     gesturelibrary mlibrary;      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);          gestureoverlayview gestureoverlayview=new gestureoverlayview(this);          view inflate=getlayoutinflater().inflate(r.layout.activity_main,null);         gestureoverlayview.setgesturecolor(color.rgb(0, 255, 0));         gestureoverlayview.setgesturevisible(true);         gestureoverlayview.setuncertaingesturecolor(color.rgb(0,0,255));          gestureoverlayview.addview(inflate);         gestureoverlayview.addongestureperformedlistener(this);         mlibrary=gesturelibraries.fromrawresource(this,r.raw.gestures);         if(!mlibrary.load())         {             log.i("debug","failed");          }         else         {             log.i("debug","loaded");         }          log.i("debug","oncreate");         setcontentview(gestureoverlayview);       }      @override     public void ongestureperformed(gestureoverlayview arg0, gesture arg1) {         // todo auto-generated method stub          arraylist<prediction> predictions=mlibrary.recognize(arg1);         if(predictions.size()>0)         {             prediction prediction=predictions.get(0);             if(prediction.score>1.0)             {                 string s=prediction.name;                   toast.maketext(getapplicationcontext(), s,toast.length_long).show();             }             else                 if(prediction.score<1.0)                 {                     toast.maketext(getapplicationcontext(), "none",toast.length_long).show();                 }                 }          }     } 

thank you.

i resource gesture application building.thank you

i not know why, android:gesturestroketype="multiple" did not work. struck me try java side. set :

gestureoverlayview.setgesturestroketype(gestureoverlayview.gesture_stroke_type_multiple); gestureoverlayview object of gestureoverlayview(you can name anything) 

(in main_activity.java file newbies) you'll see works.

i think bug, i'm not sure.i spent weeks hovering on :(


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -