Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8800503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:36:19+00:00 2026-06-14T00:36:19+00:00

Im experienced iOS dev but new to Android dev and asking some newbie questions

  • 0

Im experienced iOS dev but new to Android dev and asking some newbie questions here…

I am making a app that does a lot of custom drawing of png’s and animations and has no standard UI elements at all, and I have choosen to go down the SurfaceView road. I handle all the detection on what is touched in my SurfaceView code also.

But how on earth do I handle navigation between views from within my SurfaceView code? How do I e.g. navigate to a activity called QuizActivity? In a “normal” view/activity I do it like this:

Intent intent = new Intent(getBaseContext(), QuizActivity.class);
startActivity(intent);

But I do not have access to getBaseContext and startActivity from within my SurfaceView, and even if I did would doing this result in multiple views loaded at the same time?

Bottom line: How do I implement this navigation manually in my code from within my SurfaceView?

Thank you

Søren

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T00:36:20+00:00Added an answer on June 14, 2026 at 12:36 am

    from your surface view just call:

        Intent intent = new Intent(getContext(), QuizActivity.class);
        getContext().startActivity(intent)
    

    every view have a reference to the context they’re running, and the context can always start new activities, services, get the resources, etc.

    edit

    on your surfaceview you include this:

        private SurfaceCallbacks listener;
    
        public interface SurfaceCallbacks{
           public void onTouch(/* any data you want to pass to the activity*/);
        }
    
        public void registerSurfaceCallbacksListener(SurfaceCallbacks l){
           listener = l;
        }
    
        // and then whenever the surface being touched and you want to call something outside of the surface you do:
    
        if(listener!=null)
           listener.onTouch(/* pass the parameters you declared on the interface */);
    

    and on the activity that holds the surface you do this:

        public ActivityThatHoldsSurface extends Activity implements SurfaceCallbacks{
    
           // that comes form the surface
           @Override
           onTouch(/* your parameters */){
              // do the navigation stuff
           }
    
           // and immediately after you inflate or instantiate your surface you do:
           mySurface.registerSurfaceCallbacksListener(ActivityThatHoldsSurface.this);
    
        }
    

    does it make sense???

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im experienced iOS dev but new to Android dev and asking some newbie questions
I’m an experienced developer, but relatively new to iOS. I’m having some trouble with
I am a experienced iOS developer but I am totally new to Android. I
I am fairly experienced C programmer but IOS is new for me. I do
I am a experienced developer that is new to iOS developement (on iPhone in
Trying to ease my animation in some iOS app I'm working on. Experienced a
I am an experienced C++/Java programmer but am new to iOS. I am writing
I'm new to OpenGL ES, but quite experienced with Objective-C and iOS development. I've
I am currently developing a web app targeting primarily iOS devices (but possibly Android
I am an experienced web developer, but new to rails. I am writing a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.