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.

How to set different locales in android


AD MOB

- create new folder with values in resources folder in project with extension your language code
For example:
My language is Czech (cs)
I have to create the folder values-cs in res folder

// for locale English is default
/MyProject/res/values 
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">App English default</string>
    <string name="action_settings">Settings English default</string>
    <string name="hello_world">Hello world</string>

</resources>

// for locale Czech (cs)
/MyProject/res/values-cs
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">Aplikace česky cs</string>
    <string name="action_settings">Nastavení česky</string>
    <string name="hello_world">Ahoj světe!</string>

</resources>

// for locale English US (r is region)
/MyProject/res/values-en-rUS

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">App English Us locale</string>
    <string name="action_settings">Settings English Us locale</string>
    <string name="hello_world">Hello world from USA :)</string>

</resources>


Into every values folder put strings.xml file
Translate every string from values folder into your locale.
If user selected your locale in device settings, application selects a string from the correct (proper) folder.

397LW NO topic_id




AD

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


175

Statistics usability of mobile phones with Android – February 2012 | statistics-usability-of-mobile-phones-with-android-%e2%80%93-february-2012


Table of usability of mobile phones with Android – February 2012 - (application Sky Map)















1 Samsung Galaxy S2 6.3%
2 HTC Desire HD 3.5%
3 HTC Evo 4G 3.4%
4 Samsung Galaxy Ace 2.1%
5 Samsung Galaxy S (SCH-I500) 2.1%
6 Samsung Galaxy S (GT-I9000) 2.1%
7 HTC Incredible 2 2.0%
8 Motorola Droid X 1.9%
9 Motorola Droid RAZR 1.9%
10 HTC Sensation 4G 1.7%

197

Nejlepší mobil s Androidem - jak nakupovat | nejlepsi-mobil-s-androidem-jak-nakupovat


Kvalitní mobilní telefon pro rok 2012 by měl mít tyto, nebo ještě lepší parametry.
Značka Samsung , HTC, LG, Motorola, Sony Ericsson, ZTE Blade
Verze operačního systému Android 2.2 a vyšší.
Procesor a jeho frekvence Qualcomm 800MHz a vyšší.
Paměť RAM 512MB a více.
Paměť ROM 512MB.
Displej a jeho rozlišení 4,3 palce rozlišení 480x800 pixelů pro snadné ovládání a čtení a schopnost zobrazit 16 milionů barev.
Technologie 3G data, WiFi, BlueTooth, GPS přijímač, fotoaparát 3 Mpix, autofokus, diodový blesk.
Výdrž baterie minimálně 1 den a více.
3G internet.

samsung-s6102-galaxy-y-duos
364

Center View in RelativeLayout Android | center-view-in-relativelayout-android


RelativeLayout like parent, child Srollview is centered horizontal.
Second RelativeLayout in SrollView have gravity center, every child will centered horizontally and vertically.


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="//schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="match_parent"
    android:gravity="center_horizontal">

    <ScrollView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/scrollView2" >

        <RelativeLayout
            android:layout_width="320dp"
            android:layout_height="wrap_content"
            android:background="#e6f825"
            android:gravity="center">

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="New Button"
                android:id="@+id/button" />
        </RelativeLayout>
    </ScrollView>

</RelativeLayout>
127

Force Screen On - dont use WakeLock - use getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) - Android sample | force-screen-on-dont-use-wakelock-use-getwindow-addflagswindowmanager-layoutparams-flag_keep_screen_on-android-sample


FLAG_KEEP_SCREEN_ON saving energy. Protects the battery if a user closing applications using the Return button on device. The device will returned to user screen mode settings.

@Override
    protected void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        //..........
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    }
172

Android Samples | android-samples











AbsListView
AbstractAccountAuthenticator
AbstractThreadedSyncAdapter
AccelerateInterpolator
AccessibilityEvent
AccessibilityService
AccessibilityServiceInfo
Account
AccountAuthenticatorActivity
AccountAuthenticatorResponse
AccountManager
Activity
ActivityInfo
ActivityInstrumentationTestCase2
ActivityManager
ActivityUnitTestCase
AdapterContextMenuInfo
AdapterView
AlarmManager
AlertDialog
AlphaAnimation
AndroidTestCase
Animation
AnimationSet
AnimationUtils
Application
ApplicationTestCase
AppWidgetManager
AppWidgetProvider
ArrayAdapter
AssetFileDescriptor
AsyncTask
AttributeSet
AudioManager
AuthenticatorDescription
AuthenticatorException
AutoCompleteTextView
BackupAgent
BackupAgentHelper
BackupDataInput
BackupDataOutput
BackupManager
BaseAdapter
BaseColumns
BaseExpandableListAdapter
Binder
Bitmap
BitmapDrawable
BitmapFactory
BitmapShader
BluetoothAdapter
BluetoothDevice
BluetoothServerSocket
BluetoothSocket
BroadcastReceiver
Build
Bundle
Button
Callback
Camera
CameraInfo
Canvas
Color
ColorFilter
CompletionInfo
ComponentName
CompoundButton
ConditionVariable
Config
ConfigurationInfo
Contacts
ContactsContract
ContentProvider
ContentProviderClient
ContentProviderOperation
ContentResolver
ContentUris
ContentValues
Context
ContextMenu
ContextMenuInfo
Cursor
CursorAdapter
Data
DatePicker
DatePickerDialog
DecelerateInterpolator
DeviceAdminReceiver
DevicePolicyManager
Dialog
DialogInterface
Display
DisplayMetrics
Drawable
Editable
EditorInfo
EditText
EditTextPreference
Email
Environment
Equalizer
ETC1Util
ExpandableListActivity
ExpandableListAdapter
ExpandableListContextMenuInfo
ExpandableListView
FileBackupHelper
FillType
Filterable
FloatMath
FocusFinder
FormatException
Gallery
Gesture
GestureDetector
GestureLibraries
GestureLibrary
GestureOverlayView
GLES10
GLES20
GLSurfaceView
GLU
GLUtils
Gravity
GridView
Handler
HandlerThread
Html
CharArrayBuffer
CheckBox
CheckBoxPreference
Chronometer
IBinder
Im
ImageButton
ImageSwitcher
ImageView
InputConnection
InputMethodManager
InputMethodService
Instrumentation
Intent
IntentFilter
JetPlayer
Key
Keyboard
KeyboardView
KeyEvent
KeyCharacterMap
LayoutAnimationController
LayoutInflater
LayoutParams
LinearLayout
LinkMovementMethod
ListActivity

ListAdapter
ListPreference
ListView
LiveFolders
Log
Looper
Matrix
MediaController
MediaPlayer
MediaScannerConnection
MediumTest
Menu
MenuInflater
MenuItem
Message
Messenger
MetaKeyKeyListener
MoreAsserts
MotionEvent
MovementMethod
MultiAutoCompleteTextView
NameNotFoundException
NdefMessage
NdefRecord
NfcAdapter
Notification
NotificationManager
OnAccountsUpdateListener
OnBufferingUpdateListener
OnClickListener
OnCompletionListener
OnCheckedChangeListener
OnInitListener
OnItemClickListener
OnItemSelectedListener
OnJetEventListener
OnKeyListener
OnPreparedListener
OnScrollListener
OnSharedPreferenceChangeListener
OnTouchListener
OnVideoSizeChangedListener
OperationApplicationException
OperationCanceledException
Options
PackageInfo
PackageManager
Paint
PaintDrawable
PaintFlagsDrawFilter
Parcel
Parcelable
ParcelFileDescriptor
Path
PendingIntent
People
Phone
Phones
Picture
PictureDrawable
PixelFormat
PorterDuff
PorterDuffXfermode
PowerManager
Preference
PreferenceActivity
PreferenceCategory
PreferenceManager
PreferenceScreen
Process
ProgressBar
ProgressDialog
QuickContactBadge
RadioButton
RadioGroup
RatingBar
RawContacts
RecognitionService
RecognizerIntent
Rect
RectF
RelativeLayout
RemoteCallbackList
RemoteException
RemoteViews
ResolveInfo
ResourceCursorAdapter
Resources
Row
ScaleGestureDetector
ScrollingMovementMethod
ScrollView
SearchManager
SearchRecentSuggestions
SearchRecentSuggestionsProvider
SeekBar
Sensor
SensorEvent
SensorEventListener
SensorManager
Service
ServiceConnection
ServiceTestCase
Shader
ShapeDrawable
SharedPreferences
SimpleAdapter
SimpleCursorAdapter
SimpleCursorTreeAdapter
SimpleExpandableListAdapter
Size
SmallTest
SmsManager
SmsMessage
SpannableString
Spanned
SparseArray
SpeechRecognizer
Spinner
SpinnerAdapter
SQLException
SQLiteDatabase
SQLiteOpenHelper
SQLiteQueryBuilder
StatusUpdates
StructuredName
Style
StyleSpan
Surface
SurfaceHolder
SurfaceView
SyncResult
SystemClock
TabActivity
TabHost
TableLayout
TableRow
TabSpec
TestSuiteBuilder
TextSwitcher
TextToSpeech
TextUtils
TextView
TextWatcher
Time
TimePicker
TimePickerDialog
Toast
ToggleButton
Transformation
TranslateAnimation
TypedArray
Typeface
UiThreadTest
Uri
UriMatcher
URLSpan
Vibrator
VideoView
View
ViewFlipper
ViewGroup
ViewParent
ViewSwitcher
Visualizer
WakeLock
WallpaperManager
WallpaperService
WebView
Window
WindowManager
Xfermode
Xml
XmlResourceParser



Editace: 2014-02-12 19:52:37
Počet článků v kategorii: 397
Url:how-to-set-different-locales-in-android

AD
11 Share
Share
Tweet