Two Plus Two Publishing LLC Two Plus Two Publishing LLC
 

Go Back   Two Plus Two Poker Forums > Other Topics > Programming

Notices

Programming Discussions about computer programming

Reply
 
Thread Tools Display Modes
Old 06-02-2012, 09:18 PM   #1
Pooh-Bah
 
AceofSpades's Avatar
 
Join Date: May 2005
Posts: 5,652
Android programming Question

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] :)
AceofSpades is offline   Reply With Quote
Old 06-04-2012, 10:51 AM   #2
Pooh-Bah
 
jmark's Avatar
 
Join Date: Dec 2003
Location: US
Posts: 3,609
Re: Android programming Question

Did you create R.layout.main?
jmark is offline   Reply With Quote
Old 06-04-2012, 03:07 PM   #3
Pooh-Bah
 
AceofSpades's Avatar
 
Join Date: May 2005
Posts: 5,652
Re: Android programming Question

yeah.

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

any insight?
AceofSpades is offline   Reply With Quote
Old 06-05-2012, 01:39 AM   #4
Pooh-Bah
 
maxtower's Avatar
 
Join Date: Sep 2005
Posts: 5,330
Re: Android programming Question

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.
maxtower is offline   Reply With Quote
Old 06-05-2012, 09:30 AM   #5
Pooh-Bah
 
AceofSpades's Avatar
 
Join Date: May 2005
Posts: 5,652
Re: Android programming Question

I'm trying to code an always on top button overlay that runs over other applications...
AceofSpades is offline   Reply With Quote
Old 06-05-2012, 12:09 PM   #6
Pooh-Bah
 
jmark's Avatar
 
Join Date: Dec 2003
Location: US
Posts: 3,609
Re: Android programming Question

I don't think you can run your own window over other applications.
jmark is offline   Reply With Quote
Old 06-06-2012, 12:54 AM   #7
Pooh-Bah
 
maxtower's Avatar
 
Join Date: Sep 2005
Posts: 5,330
Re: Android programming Question

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?
maxtower is offline   Reply With Quote
Old 06-06-2012, 12:03 PM   #8
Pooh-Bah
 
AceofSpades's Avatar
 
Join Date: May 2005
Posts: 5,652
Re: Android programming Question

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
AceofSpades is offline   Reply With Quote
Old 06-06-2012, 01:47 PM   #9
Pooh-Bah
 
jmark's Avatar
 
Join Date: Dec 2003
Location: US
Posts: 3,609
Re: Android programming Question

Interesting -- I guess you can do it with root. I wonder what you call to take over the screen like that.
jmark is offline   Reply With Quote

Reply
      

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -4. The time now is 10:54 PM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.
Copyright © 2008-2010, Two Plus Two Interactive