C carchek Member Licensed User Longtime User Feb 9, 2012 #1 Hi! I am new member here. I have a question, since I am new to Android (I know VB language). I am developing an application, that will be able to check for switch between horizontal and landscape position of the telephone. Can you please give me any guidelines so I can learn more about it. Thanks in advance, Carchek
Hi! I am new member here. I have a question, since I am new to Android (I know VB language). I am developing an application, that will be able to check for switch between horizontal and landscape position of the telephone. Can you please give me any guidelines so I can learn more about it. Thanks in advance, Carchek
NJDude Expert Licensed User Longtime User Feb 9, 2012 #2 You mean to detect if the device is in Portrait or Landscape? If the answer is yes then you can do something like this: Code: Copy If Activity.Width > Activity.Height Then Msgbox("Landscape", "") Else Msgbox("Portrait", "") End If Upvote 0
You mean to detect if the device is in Portrait or Landscape? If the answer is yes then you can do something like this: Code: Copy If Activity.Width > Activity.Height Then Msgbox("Landscape", "") Else Msgbox("Portrait", "") End If
C carchek Member Licensed User Longtime User Feb 9, 2012 #3 NJDude said: You mean to detect if the device is in Portrait or Landscape? If the answer is yes then you can do something like this: Code: Copy If Activity.Width > Activity.Height Then Msgbox("Landscape", "") Else Msgbox("Portrait", "") End If Click to expand... Thank you! :sign0008: Upvote 0
NJDude said: You mean to detect if the device is in Portrait or Landscape? If the answer is yes then you can do something like this: Code: Copy If Activity.Width > Activity.Height Then Msgbox("Landscape", "") Else Msgbox("Portrait", "") End If Click to expand... Thank you! :sign0008:
rfresh Well-Known Member Licensed User Longtime User Feb 26, 2012 #4 What Sub would you put this code in to detect? Upvote 0
nfordbscndrd Well-Known Member Licensed User Longtime User Feb 26, 2012 #6 It's a little more efficient to put it in Activity_Create. Activity_Resume will always execute when the program has been interrupted, whether the orientation has changed or not. Activity_Create will only be executed if Android restarts the app, which includes changing the orientation. See Tricks Of The Trade - Basic4android Wiki Upvote 0
It's a little more efficient to put it in Activity_Create. Activity_Resume will always execute when the program has been interrupted, whether the orientation has changed or not. Activity_Create will only be executed if Android restarts the app, which includes changing the orientation. See Tricks Of The Trade - Basic4android Wiki