launch android activity from non-activity class
Posted
by
Alberto Barrera
on Stack Overflow
See other posts from Stack Overflow
or by Alberto Barrera
Published on 2012-10-27T22:56:17Z
Indexed on
2012/10/27
23:00 UTC
Read the original article
Hit count: 253
im New on Android. I know theres a lot of similar Questions but anyone is helping. Im using a 3rd party app that just launch a class that extends their own class. So from that class i would like to launch an activity.
public class SkyTest extends VtiUserExit {
@Override
public VtiUserExitResult execute() throws VtiExitException {
// TODO Auto-generated method stub
logInfo("TEST");
return null;
}
}
How do i launch an activity named MainActivity from here.
i tryed this:
Context context = null;
Intent intent = new Intent(context, MainActivity.class);
context.startActivity(intent);
but its not working, i know i cant use the null context, but how do i create a context o how it works?
Thanks
© Stack Overflow or respective owner