Get Set Screen Orientation Android Code
// in AndroidManifest.xml
<Activity
android:screenOrientation="portrait" // or landscape
// in MyActivity.java
boolean mbOrientacionLandscape = false;
int nOrientation = getResources().getConfiguration().orientation;
if(mbOrientacionLandscape==true){
getResources().getConfiguration();
if(nOrientation != Configuration.ORIENTATION_LANDSCAPE)
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
else{
if(nOrientation != Configuration.ORIENTATION_PORTRAIT)
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
396LW NO topic_id
AD
Další témata ....(Topics)
For some graphics you can use Paint.NET editor.
//www.getpaint.net/
How create Snow Effects on Text by 1 minute show this video:
//www.getpaint.net/
How create Snow Effects on Text by 1 minute show this video:
While cycle Java basic example with array of strings.
MainClass.java
MainClass.java
public class MainClass {
public static void main(String[] arg) {
String[] arrayOfString = { "Hello", "people", "hello", "world!" };
int i = 0;
while ( i < arrayOfString.length ){
System.out.println(arrayOfString[i]);
i++;
}
}
}
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcz/okhelp/MyMathClass;
First try this solution!!!!!
Select your project in project tree and go to the Eclipse menu Project » Clean » Clean projects selected below » select your project and click OK.
If you create *.apk package with proguard sometimes you must back up the project, delete project, and create new project if you are unable to create *.apk file.
Check your AndroidManifest.xml if all Activity is correctly inserted. If you add a library project to Main project you have to insert Activity from library to Main project AndroidManifest.xml
Problem with the library.
I deleted library project from project tree and again put the _library project into the main project. This problem was resolved.
1.)Go to Project » Properties » Java Build Path » Libraries and remove (your projects) click OK.
2.)Go to Project » Clean » Clean projects selected below » select your project and click OK.
3.)Add again your LIBRARY project to your MAIN project Project » Properties » Java Build Path » Libraries.
See image below.
Problem with a *.apk file
If you create signed *.apk, you have to delete previous *.apk from your PC folder.
java.lang.IllegalArgumentException: already added: Lcz/okhelp/MyMathClass;
First try this solution!!!!!
Select your project in project tree and go to the Eclipse menu Project » Clean » Clean projects selected below » select your project and click OK.
If you create *.apk package with proguard sometimes you must back up the project, delete project, and create new project if you are unable to create *.apk file.
Check your AndroidManifest.xml if all Activity is correctly inserted. If you add a library project to Main project you have to insert Activity from library to Main project AndroidManifest.xml
Problem with the library.
I deleted library project from project tree and again put the _library project into the main project. This problem was resolved.
1.)Go to Project » Properties » Java Build Path » Libraries and remove (your projects) click OK.
2.)Go to Project » Clean » Clean projects selected below » select your project and click OK.
3.)Add again your LIBRARY project to your MAIN project Project » Properties » Java Build Path » Libraries.
See image below.
Problem with a *.apk file
If you create signed *.apk, you have to delete previous *.apk from your PC folder.
Issue:
When using New Activity wizard, ADT 20 asked to install Android Support library version 8 even though version 9 has been installed.
Pressing "Install/Update" then ADT popup a window downloading Support library, when finished nothing happen.
Pressing "Check Again" does nothing.
If i restarting Eclipse again this problem.
Notice: If you install new version ADT or update via SDK Manager, open SDK Manager standalone and close Eclipse.
Workaround:
- Close Eclipse
- Open SDK Manager standalone (c:\Program Files\Android\android-sdk-windows\SDK Manager.exe)
- Check the checkbox and uninstall Extras -> Android Support Library.
- Check again Extras -> Android Support Library and install it
- Restart Eclipse
- Try to create new project
When using New Activity wizard, ADT 20 asked to install Android Support library version 8 even though version 9 has been installed.
Pressing "Install/Update" then ADT popup a window downloading Support library, when finished nothing happen.
Pressing "Check Again" does nothing.
If i restarting Eclipse again this problem.
Notice: If you install new version ADT or update via SDK Manager, open SDK Manager standalone and close Eclipse.
Workaround:
- Close Eclipse
- Open SDK Manager standalone (c:\Program Files\Android\android-sdk-windows\SDK Manager.exe)
- Check the checkbox and uninstall Extras -> Android Support Library.
- Check again Extras -> Android Support Library and install it
- Restart Eclipse
- Try to create new project
Close one project:¨
-right click on project
- select Close project
Close more projects:
- right click on project
- select Close Unrelated Projects
Hide closed projects:
- package explorer
- view menu
- select Closed projects
-right click on project
- select Close project
Close more projects:
- right click on project
- select Close Unrelated Projects
Hide closed projects:
- package explorer
- view menu
- select Closed projects
Editace: 2013-07-27 11:15:02
Počet článků v kategorii: 396
Url:get-set-screen-orientation-android-code