Okhelp.cz

Recepty, články, nápady, programování. Dříve dum-zahrada, finance, internet a know-how.okhelp.cz Pro lepší výsledky hledání používejte i diakritiku.

ADT Bundle 22.6.2 have memory leak.

If I trying
android-sdk_r22.6.2-windows.zip
adt-bundle-windows-x86_64-20140321.zip
and open xml layout graphic editor and xml layout file
memory continues to grow to crashes Eclipse

https://developer.android.com/sdk/index.html

I have to install old version adt-bundle-windows-x86-20131030.zip
what working fine.
I had to delete .metadata folder in workspace if I want open old version ADT

396LW NO topic_id




AD

Další témata ....(Topics)


77

break statement in Java Android example | break-statement-in-java-android-example


break statement in Java Android basic example

MainClass.java

public class MainClass {
	public static void main(String[] arg) {
		String[] arrayOfString = {"nothing", "Hello", "people"
				, "bye-bye", "hello", "world!", "end" };
		
		for (int i = 0; i < arrayOfString.length; i++) {
				System.out.println(arrayOfString[i]);
				if(i > 2) 
					break; // end of loop
		}
	}
}
/*
nothing
Hello
people
bye-bye
*/
26

Get package name Context-getPackageName Android example | get-package-name-context-getpackagename-android-example


If you often copy your Android project to another you have to using function for obtaining varied information about package.
This code show how get package name in Android application as string:

Context context = getContext(); // this.getContext(); getApplicationContext(); etc.
String sPackName = context.getPackageName();

354

Android Studio formatting code Ctrl + Alt + L | android-studio-formatting-code-ctrl-alt-l


Shortcut
Windows
Ctrl + Alt + L (format selection or all page)
Ctrl + Alt + Shift + L (show a dialog)
Linux
Ctrl + Windows Key + Alt + L

From menu Code
Code > Reformat Code
312

Difference between logical operators and or Java | difference-between-logical-operators-and-or-java


Basic difference remember it!!!
if(TRUE && TRUE && TRUE) return TRUE otherwise FALSE

if(FALSE || FALSE || FALSE) return FALSE otherwise TRUE

Logical operator and &&
If all conditions/operands is TRUE return TRUE, otherwise return FALSE

if( true and true and true){ 
  // return true - do something
}
int a = 6;
if(a == 6 && a == 6 ) {
 // if TRUE
 // true && true return true, do something
}

if(a == 6 && a == 5){
  // nothing, not attended
}else{
  // true && false return false, or false && false return false 
  // do something
}


Logical operator or ||
The logical OR operator (||) returns the boolean value true if either or both operands is true and returns false otherwise.
If one operands is TRUE, condition is TRUE:

if(FALSE OR FALSE OR TRUE) return TRUE
if(FALSE OR TRUE OR FALSE) return TRUE
if(FALSE OR FALSE OR FALSE) return FALSE

int a = 6;
if(a==6 || a==5){ // TRUE || FALSE return TRUE
  //if return TRUE
  //one from operadns is TRUE return true,  do something
}

if(a==5 || a==4){ // FALSE || FALSE return FALSE
 // not attended
}else{
 //if return FALSE, do something
}

rev
221

android - OnClickListener must override a superclass method | android-onclicklistener-must-override-a-superclass-method


The method onClick(DialogInterface, int) of type new DialogInterface.OnClickListener(){} must override a superclass method.

Try this:
Right click on project
Select Properties
In open dialogue select Java compiler
Set Enable project specific settings
Set Compiler compliance level to 1.6

android/project-properties-eclipse.png

android/java-compiler-settings-eclipse.png