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.

toLowerCase Locale toUperCase Locale Java Android



String s = "AbcČ";
String s2 = s.toLowerCase(new Locale("cs_CZ")); // Czech Republic
String s3 = s.toLowerCase(new Locale("de_DE")); // Germany

//
en_US
en_GB
ar_EG
be_BY
bg_BG
ca_ES
cs_CZ
da_DK
de_DE

397LW NO topic_id



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


191

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
335

SimpleCursorAdapter deprecated | simplecursoradapter-deprecated


Constructor SimpleCursorAdapter is deprecated.
If using api 11 and above, you can try add last parameter 0.


Cursor cursor = managedQuery(...........,,,,);
// Specify the columns we want to display in the result
            String[] from = new String[] { KEY_WORD,
                                           KEY_DEFINITION };

            // Specify the corresponding layout elements where we want the columns to go
            int[] to = new int[] { R.id.word,
                                   R.id.definition };
// deprecated 
 SimpleCursorAdapter words =
            new SimpleCursorAdapter(this,
                    R.layout.result, cursor, from, to);
// working
 SimpleCursorAdapter words =
            new SimpleCursorAdapter(this,
                    R.layout.result, cursor, from, to, 0); // to, 0!!!!


//working in Fragment
SimpleCursorAdapter  mAdapter = new SimpleCursorAdapter(getActivity(),
                android.R.layout.simple_list_item_2, null,
                new String[] { "name", "age" }, // cursor parameters
                new int[] { android.R.id.text1, android.R.id.text2 }, 0);


392

Android runtime change switch Activity theme | android-runtime-change-switch-activity-theme



static boolean mbThemeLight = false;

 @Override
    public void onCreate(Bundle savedInstanceState) {
         if(mbThemeLight)
        setTheme(android.R.style.Theme_Light);
        super.onCreate(savedInstanceState);
        // bla bla bla..........
    }

private void switchTheme(){
 mbThemeLight = true;
 this.recreate();
}
105

How to make a horizontal line in Android application example code | how-to-make-a-horizontal-line-in-android-application-example-code


In html is horizontal line a tag br. In Android source code you can use a View as xml example bellow.

<View
android:layout_width="fill_parent"
android:layout_height="4dip"
android:background="#ffffff"
android:paddingBottom="10dip"
/>
137

Draw drawARGB() Android basic example | draw-drawargb-android-basic-example



public class MainActivity extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(new SampleView(this));
	}

	private static class SampleView extends View {

		// CONSTRUCTOR
		public SampleView(Context context) {
			super(context);
			setFocusable(true);

		}
		@Override
		protected void onDraw(Canvas canvas) {
			//drawARGB (int a, int r, int g, int b)
//			a  alpha component (0..255) of the color to draw onto the canvas 
//			r  red component (0..255) 
//			g  green component (0..255)  
//			b  blue component (0..255)  

			canvas.drawARGB(255, 0, 255, 10); 
		}

	}
}




Editace: 2013-11-10 22:00:41
Počet článků v kategorii: 397
Url:tolowercase-locale-toupercase-locale-java-android
Share
Share
Tweet