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 going life cycle if screen orientation changed Android example


AD MOB

onSaveInstanceState, onRestoreInstanceState life cycle if screen orientation changed from log file.

// starts activity
15:27:12.801: INFO/onCreate(1828): onCreate()
15:27:12.811: INFO/onStart(1828): onStart()
15:27:12.821: INFO/onResume(1828): onResume()
// activity is running 

15:27:33.651: DEBUG/dalvikvm(307): GC_EXPLICIT freed 186K, 53% 
free 2770K/5831K, external 981K/1038K, paused 99ms

// change emulator state Ctrl+F11 landscape, portrait
15:27:40.427: INFO/ActivityManager(74): Config changed: 
{ scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/2 nav=3/1 orien=2 layout=18 uiMode=17 seq=64}

// saved all variable values if need
15:27:40.581: INFO/onSaveInstanceState(1828): onSaveInstanceState()

15:27:40.602: INFO/onPause(1828): onPause()
15:27:40.612: INFO/onStop(1828): onStop()
15:27:40.631: INFO/onDestroy(1828): onDestroy()

// activity goes back to onCreate !!!!!!!!!
15:27:40.692: INFO/onCreate(1828): onCreate()
15:27:40.701: INFO/onStart(1828): onStart()

// restore all saved values of variables 
15:27:40.711: INFO/onRestoreInstanceState(1828): onRestoreInstanceState()
// you can using saved values by onSaveInstanceState() in onResume
15:27:40.721: INFO/onResume(1828): onResume()




Diagram of life cycle onSaveInstanceState, onRestoreInstanceState

[caption id="attachment_1169" align="alignleft" width="229" caption="Life cycle onRestoreInstanceState"]life_cycle_onRestoreInstanceState[/caption]

397LW NO topic_id




AD

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


157

Get Resource ID by Resources String Name Android example | get-resource-id-by-resources-string-name-android-example



// image from res/drawable
	int resID = getResources().getIdentifier("my_image", 
			"drawable", getPackageName());
// view
	int resID = getResources().getIdentifier("my_resource", 
			"id", getPackageName());

// string
	int resID = getResources().getIdentifier("my_string", 
			"string", getPackageName());


167

INSTALL_FAILED_INSUFFICIENT_STORAGE | install_failed_insufficient_storage


1.) Try reopen the Emulaor and restart Eclipse.
OR
2.) Try to delete AVD from Eclipse menu Window - AVD manager.
OR
3.) Insert into manifest.xml this source code.

 <manifest xmlns:android="//schemas.android.com/apk/res/android"
    package="com.myweb.mypackage"
    android:installLocation="preferExternal"
155

Hue saturation, color, colored filtering Bitmap Image Android example | hue-color-colored-filter-bitmap-image-android-example


colored filtering bitmap android

/* Copyright (C) 2011 The Android Open Source Project
//www.apache.org/licenses/LICENSE-2.0
*/
public class MainActivity extends Activity {
private ImageView imageView;
private Button button1;
Drawable bitmapOrg;
private final int[] mColors =
{Color.BLUE, Color.GREEN, Color.RED, Color.LTGRAY, Color.MAGENTA, Color.CYAN,
		Color.YELLOW, Color.WHITE};
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		imageView = (ImageView)findViewById(R.id.imageView1);
		button1 = (Button)findViewById(R.id.button1);

		
		bitmapOrg = this.getResources().getDrawable(R.drawable.flower_blue);
        
        button1.setOnClickListener(new OnClickListener() {
            public void onClick(View view) {
                int mColor = (int) Math.floor(Math.random() * mColors.length);
                bitmapOrg.setColorFilter(mColors[mColor], PorterDuff.Mode.MULTIPLY);
                imageView.setImageDrawable(bitmapOrg);
                imageView.invalidate();
            }
        });	
 	}

}

198

Seznam smartphonu podle ceny | seznam-smartphonu-podle-ceny


Chytré telefony s Androidem - tabulka srovnání dle ceny:
























































































































































































































































































































































































































































































































































































































































































































































































































Výrobce

Model (codename)

Cena, včetně DPH

CPU MHz

displej-rozlišení

Velikost displeje v palcích

ROM

RAM

Huawei

Vodafone 845 (U8120, Joy)

1979

528

240x320

2.8

512

256

ZTE

Vodafone 945 (ZTE Joe)

1999

600

240x400

3.2

512

512

Huawei

Vodafone 858 Smart (U8160)

2177

528

240x320

2.8

512

256

Alcatel

T-Mobile Move (OT 908)

2294

600

240x320

2.8

512

512

Samsung

Galaxy Y (S5360)

2495

832

240x320

3

512

256

ZTE

Racer II (Arizona)

2536

500

240x320

2.8

512

256

Huawei

Ideos X1 (U8180, Orange Stockholm)

2549

528

240x320

2.8

512

256

Huawei

U8100

2595

528

240x320

2.8

512

256

Huawei

U8500

2699

600

320x480

3.2

512

256

Samsung

Galaxy Mini (S5570)

2799

600

240x320

3.14

512

256

Samsung

Galaxy 5, 550 (i5500)

2855

600

240x320

2.8

512

256

LG

Optimus Me (P350)

2924

600

240x320

2.8

512

512

SE

Xperia X8

2977

600

320x480

3

512

256

Gigabyte

GSmart G1310 (Roy)

2990

528

320x480

3.2

512

256

MyPhone

A210

2990

624

240x400

3

256

128

ZTE

Orange San Francisco (ZTE Blade, U880, P729V)

2999

600

480x800

3.5

512

512

HTC

Explorer (Pico)

3104

600

320x480

3.2

512

512

Huawei

U8650 (Sonic)

3290

600

320x480

3.5

512

256

Huawei

Ideos X3 (U8510, Blaze)

3377

600

320x480

3.2

512

256

Samsung

Galaxy Y Pro (B5510)

3390

832

240x320

2.6



Gigabyte

GSmart G1317D (Rola)

3504

528

240x400

3.2

512

256

SE

Xperia Live Walkman (WT19i)

3554

1000

320x480

3.2

1024

512

Huawei

T-Mobile Comet (Ideos, U8150)

3600

528

240x320

2.8

512

256

SE

Xperia X10 mini pro (U20i, Mimmi)

3777

600

240x320

2.55

512

256

LG

Optimus Swift (GT540)

3800

600

320x480

3

512

256

SE

Xperia Mini (ST15)

3800

1000

320x480

3

1024

512

LG

Optimus One (P500)

3919

600

320x480

3.2

512

512

LG

Optimus Pro

3928

800

240x320

2.8

512

256

HTC

Wildfire (Buzz, Mocha, A3333)

3999

528

240x320

3.2

512

384

LG

Optimus Net (P690)

4108

800

320x480

3.2

512

512

Samsung

Galaxy Gio (S5660)

4185

800

320x480

3.2

512

384

LG

Optimus Hub (Univa)

4195

800

320x480

3.5

512

512

SE

Xperia  X10 mini (E10i, Robyn)

4195

600

240x320

2.55

512

256

Samsung

Galaxy 3, 580, Taos (i5800)

4500

667

240x400

3.2

512

256

Samsung

Galaxy Ace+ (S7500)

4550

1000

320x480

3.65

4096

512

LG

Optimus Chic (E720)

4550

600

320x480

3.2

512

512

Samsung

Galaxy 551 (i5510)

4577

667

240x400

3.2

512

512

Motrolola

Liquid Mini E310

4600

600

320x480

3.2

512

512

HTC

Wildfire S (Marvell)

4777

600

320x480

3.2

512

512

Verzo

Kinzo

4799

1000

480x800

4.3

512

512

Samsung

 Galaxy Ace (S5830)

4800

800

320x480

3.5

512

256

Motorola

Defy mini

4800

600

320x480

3.2

512

512

Samsung

Galaxy Spica, Portal, Lite (i5700)

4800

800

320x480

3.2

512

256

HTC

Gratia (A6380, Liberty, Aria)

4937

480

320x480

3.2

512

384

SE

Xperia mini pro (SK17i, Mango)

4944

1000

320x480

3

1024

320

Huawei

Ideos X5 (U8800)

4977

800

480x800

3.8

4096

512

HTC

Salsa (C510e)

4990

600

320x480

3.4

576

512

Huawei

Boulder

4998

528

240x320

2.6

512

256

ZTE

Orange Monte Carlo (ZTE Skate)

5177

800

480x800

4.3

512

512

Samsung

Galaxy S (i9000)

5300

1000

480x800

4

15600

512

Gigabyte

GSmart G1315

5490

528

320x480

3.5

512

256

SE

Xperia Active

5500

1000

320x480

3

1024

512

Samsung

Google Nexus One

5750

1000

480x800

3.7

512

512

HTC

Desire  (A8181, Bravo)

5999

1000

480x800

3.7

576

512

LG

Optimus Black (P970)

6000

1000

480x800

4

1908

512

SE

Xperia Play

6000

1000

480x854

4



LG

Optimus Sol (Victor, E730)

6000

1000

480x800

3.8

2048

512

Acer

Liquid Metal S120

6061

800

480x800

3.6

512

512

Samsung

Google Nexus S

6200

1000

480x800

4

15600

512

HTC

Desire Z (A7272, Vision)

6200

800

480x800

3.7

1536

512

Samsung

Galaxy W (i8150, Ancora)

6200

1400

480x800

3.7

4096

512

SE

Xperia Ray (ST18i)

6344

1000

480x854

3.3

1024

512

Motorola

Defy (MB525, Jordan)

6377

800

480x854

3.7

1908

512

Motorola

Defy + (MB526)

6377

1000

480x854

3.7

1908

512

Samsung

Galaxy XCover (S5690)

6399

800

320x480

3.65

512

512

Gigabyte

GSmart G1345

6490

800

320x480

3.5

512

512

HTC

Evo 3D

6500

1200

540x960

4.3

1024

1024

HTC

Desire HD (Ace)

6500

1000

480x800

4.3

1900

768

Huawei

Honour (U8660)

6500

1400

480x854

4

4096

512

SE

Xperia Neo

6590

1000

480x854

3.7

1024

512

HTC

Legend (A6363)

6784

600

320x480

3.2

512

384

Huawei

Vision (U8850)

6999

1000

480x800

3.7

2048

512

SE

Xperia Arc (LT15i)

7390

1000

480x854

4.2

1024

512

SE

Xperia Pro (MK16i)

7890

1000

480x854

3.7

1024

512

HTC

Hero

7975

528

320x480

3.2

288

512

SE

Xperia Arc S (LT18i)

8590

1400

480x854

4.2

1024

512

Samsung

Xperia Live Walkman (WT19i)

9700

1500

480x800

4.3

16000

1024

Motorola

Droid Razr

11800

1200

540x960

4.3

15600

1024
368

Who has higher priority build.gradle or AndroidManifest Android Studio | who-has-higher-priority-build-gradle-or-androidmanifest-android-studio


build.gradle in module have higher priority then AndrodiManifest.xml
Try this.
AndroidManifest.xml have code:

    <uses-sdk
        android:minSdkVersion="9"
        android:targetSdkVersion="23" />

build.gradle have code:

   defaultConfig {
        applicationId "cz.okhelp.words"
        minSdkVersion 9
        targetSdkVersion 19
        versionCode 107
        versionName "1.0.7"
    }


Warning in AndroidManifest.xml:
This targetSdkVersion value (23) is not used; it is always overridden by the value specified in the Gradle build script (19) less... (Ctrl+F1)
The value of (for example) minSdkVersion is only used if it is not specified in the build.gradle build scripts. When specified in the Gradle build scripts, the manifest value is ignored and can be misleading, so should be removed to avoid ambiguity.


Editace: 2011-10-08 19:24:22
Počet článků v kategorii: 397
Url:how-going-life-cycle-if-screen-orientation-changed-android-example

AD
11 Share
Share
Tweet