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 7741539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:03:28+00:00 2026-06-01T09:03:28+00:00

I want to modify the existing Android demo application 3D Rubik cube that uses

  • 0

I want to modify the existing Android demo application 3D Rubik cube that uses GLSurfaceView, and when launched, the Rubik cube should render in a translucent way. The Rubik cube should not respond to any touch event and all the touch event should be passed down to the underlying application. While the 3D Rubik cube is rendering on the screen, I should be able to use the device in a normal way.

Till now I am able to run the Rubik cube on top of main menu, but it doesn’t allow any touch event to get pass to the underlying applications. Also the 3D cube exit on pressing back key(not the desired result I want). I am running Android 4.0.3.

public class KubeService extends Service  {

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    Log.i("KubeService", "Received start id " + startId + ": " + intent); 

    // We want this service to continue running until it is explicitly
    // stopped, so return sticky.
    return START_STICKY;
}

@Override
public void onDestroy() {
    super.onDestroy();             
}

@Override
public void onCreate() {
    super.onCreate();

    Intent intent1 = new Intent();         
    intent1.setComponent(new ComponentName("com.abc.appname","com.abc.appname.kube.Kube"));
    intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
    startActivity(intent1);     
}

@Override
public IBinder onBind(Intent intent) {
    return null;
}

I hope everyone understands what is my intension. In a simple way, I want to run a 3D application in such a way that, it should only render on top of every application in a translucent manner, at the same time, the user should be able to use his\her device in a normal way.

I think this is achievable as I have seen one third party 3D graphics application that runs absolutely fine the way I have described. Once launched, The application just runs on top of UI and doesn’t intervene any user interaction. No tweaking of OS, no modification to any other application code.

  • 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-01T09:03:29+00:00Added an answer on June 1, 2026 at 9:03 am

    Finally, figured out how to make it work. Somehow its working for me. The 3D Rubik cube is running fine all over the place 🙂 . OK.. Lets get to the point…

    Most of the changes I made is in "Kube.java" file. The Original Kube class used to extend activity. Now it actually extends service. Now it is KubeService. For this we need to provide body for two functions onBind() and onDistroy().

    public IBinder onBind(Intent intent)
    {
      return null;
    }  
    
    public void onDestroy()
    {
      super.onDestroy();
      if (mView != null)
      {
        ((WindowManager)getSystemService("window")).removeView(mView);
        mView = null;
      }
      Log.v(TAG, "service stopped.");
    }
    

    Where does the window came from? Where we added our view to the window? Now this is the whole trick of making it work..

    We need to rewrite the onCreate() method. Here is the onCreate() method that worked for me.

    public void onCreate()
    {
      Log.v(TAG, "onCreate");
      super.onCreate();
      GLWorld myGLWorld = makeGLWorld();
    
      mView = new GLSurfaceView(this);
      mRenderer = new KubeRenderer(myGLWorld, this);
      mView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
      mView.setRenderer(this.mRenderer);
      mView.getHolder().setFormat(PixelFormat.TRANSLUCENT); //many alpha bits
      //mView.getHolder().setFormat(PixelFormat.TRANSPARENT); // at least 1 alpha bit
      //mView.getHolder().setFormat(PixelFormat.RGBA_8888);
        
      WindowManager localWM = (WindowManager)getBaseContext().getSystemService("window");
      WindowManager.LayoutParams localLP = new WindowManager.LayoutParams(
            WindowManager.LayoutParams.MATCH_PARENT, 
            WindowManager.LayoutParams.MATCH_PARENT,
            WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
            WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |               
                WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
            PixelFormat.TRANSLUCENT);
        
      localLP.setTitle("KubeService");
      localWM.addView(mView, localLP);
      Log.v(TAG, "service started.");
    } 
    

    Apart from these changes, don’t forget to add SYSTEM_ALERT_WINDOW permission and kube.KubeService service as shown below in the Manifest file.

    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
    <service android:enabled="true" 
           android:name=".kube.KubeService">                    
    </service>
    

    Now, everything is setup and we just need to create an intent for KubeService and start the service.

    Intent kubeIntent = new Intent().setClassName("PACKAGE_NAME", "PACKAGE_NAME.kube.KubeService");
    

    And

    startService(kubeIntent);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to modify a connection string that's hard-coded in a Java application (jar
I want to modify an existing Perforce label using a script that I can
I writing a dynamic HTML parsers functionality. I will want to modify existing parsers
I want to know I can dynamically modify an existing Crystal Report (using C#
I want to shape my own browser or at least modify a existing one
My problem that I want to modify a style of a site with my
I want to modify an existing XML-File. I used a DataSet to load the
How can I modify an existing *.gem file? I want to modify a Rakefile
I want to modify an Eclipse workspace programatically from within a plugin (adding existing
I'm trying to modify an existing Pages document from within my application using the

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.