android - how to add gestures to gesture file -
i save gestures gesture file, works fine. have problem, gesture file overwritten time save new gesture.
how add gestures gesture file, without overwrite time?
static file mstorefile = new file ( environment.getexternalstoragedirectory (), "gestures" ); if(!mstorefile.exists ()){ toast.maketext ( getapplicationcontext (), "datei war nicht vorhanden", toast.length_short ).show (); file mstorefile = new file ( environment.getexternalstoragedirectory (), "gestures" ); } gestureoverlayview gestureview = ( gestureoverlayview ) findviewbyid ( r.id. gesturelayout ); gestureview.addongesturelistener ( new gesturesprocessor () ); } private class gesturesprocessor implements gestureoverlayview.ongesturelistener { @override public void ongesturestarted ( gestureoverlayview overlay, motionevent event ) { } @override public void ongesture ( gestureoverlayview overlay, motionevent event ) { } @override public void ongestureended ( gestureoverlayview overlay, motionevent event ) { string text; gesture = overlay.getgesture (); if ( gesture.getlength () < length_threshold ) { text = "geste war zu kurz"; dialog_anzeigen2 ( text ); overlay.clear ( false ); } text = "geste übernehmen?"; dialog_anzeigen(text); } @override public void ongesturecancelled ( gestureoverlayview overlay, motionevent event ) { }
and part in gesture file saved:
public void confirm() { if (gesture != null) { log.d ( "hier", "hier " ); gesturelibrary store = gesturelibraries.fromfile ( mstorefile ); // über den namen wird festgemacht, zu welcher applikation die geste gehören soll store.addgesture(name, gesture); store.save(); log.d ( "hier1", "hier1 " ); set<string> entries = store.getgestureentries(); log.d ( "entries1.size ()", "entries1.size() " + entries.size () ); setresult ( result_ok ); } else { log.d ( "hier2", "hier2 " ); setresult(result_canceled); } } }
thanks lot helping.
Comments
Post a Comment