When slide phone open, view needs to stay the same

Put your problem here if it does not fit any of the other categories.

When slide phone open, view needs to stay the same

Postby xklownx » Mon Apr 27, 2009 5:46 am

i was going to see what i need to do so that when i slide open the phone the program doesnt change its stays the same view and look as if the phone was closed.
Thanks
xklownx
Junior Developer
Junior Developer
 
Posts: 14
Joined: Mon Mar 16, 2009 8:02 am

Top

Postby abraxas » Mon Apr 27, 2009 3:35 pm

you have to specify the orientation in your manifest.xml file for your activity to portrait or whatever you want.

<activity>
...

android:screenOrientation="portrait"
. . .
</activity>


here are all other options
android:screenOrientation=["unspecified" | "user" | "behind" |
"landscape" | "portrait" |
"sensor" | "nonsensor"]
abraxas
Junior Developer
Junior Developer
 
Posts: 20
Joined: Fri Feb 06, 2009 12:33 pm

Further Help

Postby xklownx » Tue Apr 28, 2009 7:57 am

Thanks abraxas that worked when i put that in. i have 1 more problem with my programe i have a random textview with random text that comes up when the program is started but when i slide open the phone my text changes again its like the program reopens again. Any Help with this problem would be great thanks

abraxas wrote:you have to specify the orientation in your manifest.xml file for your activity to portrait or whatever you want.

<activity>
...

android:screenOrientation="portrait"
. . .
</activity>


here are all other options
android:screenOrientation=["unspecified" | "user" | "behind" |
"landscape" | "portrait" |
"sensor" | "nonsensor"]
xklownx
Junior Developer
Junior Developer
 
Posts: 14
Joined: Mon Mar 16, 2009 8:02 am

Postby Hebus » Tue Apr 28, 2009 10:11 am

When the orientation is changed, by default the activity is restarted (onCreate is called) wich explain why your text changes.
To avoid this just add

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <activity>
  3.  
  4. ...
  5.  
  6. android:configChanges="keyboardHidden|orientation"
  7.  
  8. </activity>
  9.  
  10.  
Parsed in 0.000 seconds, using GeSHi 1.0.8.4


in your manifest file.

Have fun!!
Hebus
Junior Developer
Junior Developer
 
Posts: 14
Joined: Wed Apr 15, 2009 1:10 pm

Postby alpesh_harsoda » Wed Apr 29, 2009 12:57 pm

Hebus wrote:When the orientation is changed, by default the activity is restarted (onCreate is called) wich explain why your text changes.
To avoid this just add

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <activity>
  2. ...
  3. android:configChanges="keyboardHidden|orientation"
  4. </activity>
  5.  
Parsed in 0.000 seconds, using GeSHi 1.0.8.4


in your manifest file.

Have fun!!


Hi Hebus,

can u explain this line android:configChanges="keyboardHidden|orientation".???
Regards,
Alpesh Patel,
Logistic Infotech
http://www.logisticinfotech.com
User avatar
alpesh_harsoda
Senior Developer
Senior Developer
 
Posts: 106
Joined: Sat Sep 20, 2008 12:35 pm
Location: Rajkot,Gujarat(India)

Postby aabolin » Fri May 01, 2009 4:52 am

alpesh_harsoda wrote:can u explain this line android:configChanges="keyboardHidden|orientation".???

Check this link:
http://developer.android.com/reference/android/app/Activity.html#ConfigurationChanges
aabolin
Freshman
Freshman
 
Posts: 4
Joined: Wed Apr 29, 2009 1:58 pm

Top

Postby alpesh_harsoda » Fri May 01, 2009 8:56 am

Hi,
Thnks.
Regards,
Alpesh Patel,
Logistic Infotech
http://www.logisticinfotech.com
User avatar
alpesh_harsoda
Senior Developer
Senior Developer
 
Posts: 106
Joined: Sat Sep 20, 2008 12:35 pm
Location: Rajkot,Gujarat(India)

Postby xklownx » Fri May 01, 2009 9:33 am

Awesome info on this very helpful, now suppose you want the view that is viewed say when you back out of the program and then back in it that you will see the same thing it leaves off were you were and what was displayed? thanks

aabolin wrote:
alpesh_harsoda wrote:can u explain this line android:configChanges="keyboardHidden|orientation".???

Check this link:
http://developer.android.com/reference/android/app/Activity.html#ConfigurationChanges
xklownx
Junior Developer
Junior Developer
 
Posts: 14
Joined: Mon Mar 16, 2009 8:02 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 30 guests