Android Intents and Scala -


i attempting convert following tutorial, http://savagelook.com/blog/android/swipes-or-flings-for-navigation-in-android, scala code android. have working well, except mygesturedetector class have not yet completed have errors in. code follow

class mygesturedetector extends simpleongesturelistener {   override def onfling(e1:motionevent, e2:motionevent, velocityx:float, velocityy:float):boolean ={   var intent:intent = new intent (mainactivity.this.getbasecontext(), mainactivity.class)    true   }   override def ondown(e:motionevent):boolean = {   true }  } 

my code giving me red underline on mainactivity.this.getbasecontext() , mainactivity.class. red x next line says mainactivity not enclosing class, identifier expected .class found, , mainactivity not value. importing following packages

import android.app.activity import android.os.bundle import android.content.intent import android.view.gesturedetector import android.view.gesturedetector.simpleongesturelistener import android.view.motionevent import android.view.view 

can point out going wrong?? thank

michael

try this.:

val myintent = new intent(currentactivity.this, classof[destinationactivity]) 

the first parameter should instance of current activity. ( since activity extends context, , current context needed)


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -