Discussion Forums  >  Uncategorized

Replies: 6    Views: 211

RacinJason
Aspiring developer
Profile
Posts: 73
Reg: Jan 13, 2011
Hanover, PA
730
01/01/12 10:11 PM (14 years ago)

Small and Large Device issues

Curious as how BT 1.5 handles detecting large and small devices. My Galaxy Nexus rotates the app and displays all the large device settings even though it's on a cell phone. Is this due to screen resolution? If so this could be a problem for all the new HD resolution phones coming out on the market. My wife has a Rezound and it rotates on her phone as well.
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
01/01/12 10:13 PM (14 years ago)
That's an interesting question, so I'll make a comment so I can subscribe to this thread! I know in the App Core Properties section of your control panel, there is a Allow / Prevent Rotation (landscape, portrait) selection, and you can toggle to only allow large device rotation. But I'm not sure what defines a large device! Mark
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
01/01/12 10:43 PM (14 years ago)
Huh, interesting :)
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
01/01/12 11:08 PM (14 years ago)
Did some poking around in the v1.5 source for Android, and found this snippet of information in src/com/<appname>/BT_device.java. Basically, if the width of the screen is > 600, then this.isLargeDevice = true. You can change this to whatever you want! //constructor public BT_device(){ BT_debugger.showIt(objectName + : Creating root-device object.); try{ //app delegate Application appDelegate = jesussays_appDelegate.getApplication(); //display info Display display = ((WindowManager)appDelegate.getSystemService(appDelegate.WINDOW_SERVICE)).getDefaultDisplay(); //set screen size... this.deviceHeight = display.getHeight(); this.deviceWidth = display.getWidth(); //default's to portrait until it's updateDeviceOrientation() is called when a screen rotates... deviceOrientation = portrait; //are we landscape? if(appDelegate.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE){ this.deviceHeight = display.getWidth(); this.deviceWidth = display.getHeight(); deviceOrientation = landscape; } //large or small device? if(this.deviceWidth > 600){ this.isLargeDevice = true; }else{ this.isLargeDevice = false; } Mark
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
01/01/12 11:10 PM (14 years ago)
And further down in the same file: //updates devices orientation. This is fired on screen rotations.. public void updateDeviceOrientation(String theOrientation){ BT_debugger.showIt(objectName + :updateDeviceOrientation Setting to: + theOrientation); try{ this.deviceOrientation = theOrientation; }catch (Exception je){ BT_debugger.showIt(objectName + :updateDeviceOrientation ERROR: + je.toString()); } } //updates device size public void updateDeviceSize(){ //BT_debugger.showIt(objectName + :updateDeviceSize); try{ //app delegate Application appDelegate = jesussays_appDelegate.getApplication(); //display info Display display = ((WindowManager)appDelegate.getSystemService(appDelegate.WINDOW_SERVICE)).getDefaultDisplay(); //set screen size...It's opposite if we are in landscape! if(this.deviceOrientation.equalsIgnoreCase(portrait)){ this.deviceHeight = display.getHeight(); this.deviceWidth = display.getWidth(); }else{ this.deviceWidth = display.getHeight(); this.deviceHeight = display.getWidth(); } //debug BT_debugger.showIt(objectName + :updateDeviceSize This device has a screen size of: + deviceWidth + (width) x + deviceHeight + (height).); //large or small device? if(this.deviceWidth > 500){ this.isLargeDevice = true; BT_debugger.showIt(objectName + :updateDeviceSize This application considers this to be a \large device\); }else{ this.isLargeDevice = false; BT_debugger.showIt(objectName + :updateDeviceSize This application considers this to be a \small device\); } BT_debugger.showIt(objectName + :updateDeviceSize This device is in \ + this.deviceOrientation + \ orientation.); }catch (Exception je){ BT_debugger.showIt(objectName + :updateDeviceSize ERROR: + je.toString()); } }
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
01/02/12 05:02 AM (14 years ago)
For sure it's a simple setting in the Device file like @ GoNorthWest dug up. The idea is that you can refer to the this.isLargeDevice property of the global device object anywhere in the code you want. This is much easier than doing all sorts of calculations on every different place you may need this. So, the isLargeDevice property is a generic 'if it's over 500 display width' then it must be a large device. However, this could be problematic for all sorts of reasons. Adjust the 'if over this wide' flag as needed ;-)
 
Jake Chasan
Veteran developer
Profile
Posts: 1685
Reg: May 13, 2011
location unknow...
29,650
like
01/02/12 09:40 AM (14 years ago)
I am having the same problem with my Android BT1.5. It works fine on the emulator, but when I test it on my Galaxy Prevail, the tab bar does not look right, it is all squished together, and some icons are missing.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.