I am making an app which has a switch on its main page and when the switch is on then it starts another activity . Here I am using getIntent() in the second activity . But it is not working and givivg the error "Undefined method" .I searched and found that this is due to the reason that my class extends 'service' and not 'activity' .But I still don't understand the solution.
public class OverlayButtonActivity extends Service implements OnTouchListener {
Button mButton;
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public void onCreate() {
super.onCreate();
Intent intent = getIntent();
//mView = new HUDView(this);
mButton = new Button(this);
mButton.setText("Overlay button");
mButton.setOnTouchListener(this);
}
}
Any help??