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.

Titlebar title bar change text setTile Android example


AD MOB

Change the title associated with this activity. If this is a top-level activity, the title for its window will change. If it is an embedded activity, the parent can do whatever it wants with it.




 String sTitle = "My new title";
 setTitle(sTitle);




397LW NO topic_id




AD

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


189

Invalid proguard configuration file path Android Eclipse Error | invalid-proguard-configuration-file-path-android-eclipse-error


Invalid proguard configuration file path
C:\documents\my_android_projects\my_project\proguard.cfg does not exist or is not a regular file

Solution:
Check if exist file proguard.cfg in your project on the path C:\docum.........
If not exist, copy a file proguard.cfg from other project or create file proguard.cfg and insert
this source code to file and save this file.



-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService

-keepclasseswithmembernames class * {
    native <methods>;
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers class * extends android.app.Activity {
   public void *(android.view.View);
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}



From more details see:
//developer.android.com/guide/developing/tools/proguard.html
100

How evaluate any expression in Eclipse debugger editor Android example | how-evaluate-any-expression-in-eclipse-debugger-editor-android-example


Tutorial by pictures how evaluate a variable in Eclipse debugger window.

1.) Open Debug perspective in Eclipse and to start debugging a Activity.
eclipse-debug-perspective


2.) Open Display window from menu Window->Show view->Display

eclipse dislplay window

3.) Set breakpoint where you need to evaluate a variable.

eclipse-toggle-breakpoint

4.) Debug the Activity to breakpoint.

eclipse-debugger-breakpoint


5.) Into the Display window type code for evaluate your variable and execute code.

eclipse-type-evaluate-code-to-display-window


6.) Check if change of value a variable

eclipse-evaluate-a-variable

79

ArrayList Collections Add new Item Sort Find Item Java example | arraylist-collection-sort-add-java-example


How add item to ArrayList, sort ArrayList, search find index of item in ArrayList, min(), max() Java basic example.

import java.util.ArrayList;
import java.util.Collections;

public class MainClass {
	public static void main(String[] arg) {
		String[] arrayOfString = {"nothing", "Hello", "people"
				, "bye-bye", "hello", "world!", "End" };
		   ArrayList<String> arrayList = new ArrayList<String>();
            for(String s: arrayOfString)
		     arrayList.add(s);

		    Collections.sort(arrayList);
		    // foreach
		    for (String str: arrayList)
		      System.out.println(str);
		    
		    Object objMin = Collections.min(arrayList);
		    System.out.println("Min is: " + objMin);
		    
		    Object objMax = Collections.max(arrayList);
		    System.out.println("Max is: " + objMax);
		    
		    int index = Collections.binarySearch(arrayList, "people");
		    System.out.println("Index of people is: " + index);
		    
		  }

		
	
}
/*
End
Hello
bye-bye
hello
nothing
people
world!
Min is: End
Max is: world!
Index of people is: 5
*/
360

No executable code found at line - omits breakpoints | no-executable-code-found-at-line-omits-breakpoints


No executable code found at line ....
Try one from this solution:
1.) uninstall app from test device, try to debugg app
or
2.) open module gradle file and set minifyEnabled to false in debug condition

debug {
minifyEnabled false
}
10

Screen Android Landscape Portrait programmatically | screen-android


Screen Android example source code for developers.
Get orientation of screen.

 public int getScreenOrientation() {
  if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT)                {
       return 1; // Portrait Mode
   
  }else if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
       return 2;   // Landscape mode
  }
  return 0;
 }


Editace: 2011-09-17 12:34:02
Počet článků v kategorii: 397
Url:titlebar-title-bar-change-text-android-example

AD
11 Share
Share
Tweet