Open Side Menu Go to the Top

06-02-2012 , 09:18 PM
I'm trying to hack together an app that displays a overlay for android...

But I'm a bit confused right now about how the views work etc. Any help? Nothing is displaying at all...

Code:
import android.app.Activity;
import android.app.Service;
import android.content.Intent;
import android.os.Bundle;
import android.os.IBinder;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;

public class PageByPage extends Activity {

	
	public void onCreate(Bundle currentState) {
		super.onCreate(currentState);
		View mView;
		setContentView(R.layout.main);
		// Create object that refers to main android screen and puts buttons on it.
		WindowManager.LayoutParams myScreen = new WindowManager.LayoutParams();
		myScreen.width = WindowManager.LayoutParams.WRAP_CONTENT;
		myScreen.height = WindowManager.LayoutParams.WRAP_CONTENT;
		myScreen.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL; // Allow other touches outside the buttons 
		WindowManager myWin = (WindowManager)getSystemService("window");
		//View v = new View(this);
		//View mainbtn = new View(R.layout.main);
		//setContentView(R.layout.main);
		//myWin.addView(v, myScreen);
		LayoutInflater l = LayoutInflater.from(this);
        
        // The main buttons
        mView = l.inflate(R.layout.main, null);
        myWin.addView(mView, myScreen);
	}
}

Last edited by _dave_; 06-03-2012 at 03:49 AM. Reason: code tags need a [square bracket] :)
Android programming Question Quote
Android programming Question
150% up to $2,000 Welcome Bonus on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
Android programming Question
06-04-2012 , 10:51 AM
Did you create R.layout.main?
Android programming Question Quote
06-04-2012 , 03:07 PM
yeah.

I'm confused at what the difference is between a "view", a "viewgroup", the current screen, and what inflating actually does...

any insight?
Android programming Question Quote
06-05-2012 , 01:39 AM
What are you trying to do?
If you remove all the code after
Quote:
setContentView(R.layout.main);
what do you get?

Your code as written works for me btw. I am just not sure what you're trying to accomplish.

Last edited by maxtower; 06-05-2012 at 01:51 AM.
Android programming Question Quote
06-05-2012 , 09:30 AM
I'm trying to code an always on top button overlay that runs over other applications...
Android programming Question Quote
06-05-2012 , 12:09 PM
I don't think you can run your own window over other applications.
Android programming Question Quote
06-06-2012 , 12:54 AM
Yeah, I doubt the SDK is going to let you do that. You might have to go lower level. My knowledge won't be able to help you there.

Why do you need an always on top button? Would services and notifications not get the job done?
Android programming Question Quote
06-06-2012 , 12:03 PM
I'm trying to code something that overlays like ButtonSavior for the nook simple touch. I want to create a layer of buttons that create % swipe events when pressed, so you can do page by page scrolling in applications like web browsers etc that don't offer it.

The e-ink don't do small amounts of scrolling well...

http://www.appbrain.com/app/button-s...om.smart.swkey
Android programming Question Quote
06-06-2012 , 01:47 PM
Interesting -- I guess you can do it with root. I wonder what you call to take over the screen like that.
Android programming Question Quote
Android programming Question
150% up to $2,000 Welcome Bonus on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
Android programming Question

      
m