Hey,
macroid.ActivityContext is a wrapper around android.content.Context. If you
are inside an activity, use this:
startActivity(new Intent(this, classOf[MyActivity]))
Alternatively, you could request a macroid.ActivityContext from outside and
unwrap it:
def foo(implicit ctx: macroid.ActivityContext) = {
...
startActivity(new Intent(ctx.get, classOf[MyActivity]))
}
Or like this:
startActivity(new Intent(implicitly[macroid.ActivityContext].get, classOf[
MyActivity]))
I know this part of Macroid’s DSL is lacking. In fact, there was a
discussion on
it: https://groups.google.com/forum/#!topic/macroid/BFDlv0Kmohc
Unfortunately, there was no pull request, and right now I don’t have time
to work on it, but I’d like to get back to it at some point
(3.0.0-M4/3.0.0).
Nick
On Wednesday, November 19, 2014 6:53:12 PM UTC, Benny Thompson wrote:
>
> I've been looking through the library code itself, examples, etc and I
> can't find an example of how to start a new activity. When I try a simple
>
> startActivity(new Intent(macroid.ActivityContext, classOf[MyActivity]))
>
>
> it complains about not finding the appropriate constructor. I would
> include Scaloid to use SIntent, but would hate to pull in the entire
> library, just for that.
>
--
You received this message because you are subscribed to the Google Groups
"scala-on-android" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.