Emulator window was out of view and was recentred - Android emulator warning
Emulator window was out of view and was recentred
Emulator] WARNING: Data partition already in use. Changes will not persist!
Emulator] WARNING: SD Card image already in use: C:\Documents and Settings\user_name\.android\avd\hvga21_up1_7.avd/sdcard.img
Emulator] WARNING: Cache partition already in use. Changes will not persist!
Basic step
Try restart Eclipse if using from menu File->Restart
Other solutions
Solution 1: try restart ADB server
//android.okhelp.cz/how-quickly-restart-adb-exe-adb-server-android-emulator-example/
Solution 2:
//android.okhelp.cz/android-emulator-wont-run-application-started-from-eclipse/
Solution 3:
Try delete:
Try solution 4:
Eclipse menu select Window->Preferences->Android
Windows 32
FROM: C:\Program Files\Android\android-sdk
TO: C:\PROGRA~1\Android\android-sdk
Windows 64
FROM: C:\Program Files (x86)\Android\android-sdk
TO: C:\PROGRA~2\Android\android-sdk
Emulator] WARNING: Data partition already in use. Changes will not persist!
Emulator] WARNING: SD Card image already in use: C:\Documents and Settings\user_name\.android\avd\hvga21_up1_7.avd/sdcard.img
Emulator] WARNING: Cache partition already in use. Changes will not persist!
Basic step
Try restart Eclipse if using from menu File->Restart
Other solutions
Solution 1: try restart ADB server
//android.okhelp.cz/how-quickly-restart-adb-exe-adb-server-android-emulator-example/
Solution 2:
Delete Run Configuration
//android.okhelp.cz/android-emulator-wont-run-application-started-from-eclipse/
Solution 3:
Try delete:
c:\Documents and Settings\user_name\.android\avd\my_avd.avd\cache.img
c:\Documents and Settings\user_name\.android\avd\my_avd.avd\userdata-qemu.img
Try solution 4:
Eclipse menu select Window->Preferences->Android
Windows 32
FROM: C:\Program Files\Android\android-sdk
TO: C:\PROGRA~1\Android\android-sdk
Windows 64
FROM: C:\Program Files (x86)\Android\android-sdk
TO: C:\PROGRA~2\Android\android-sdk
396LW NO topic_id
AD
Další témata ....(Topics)
Use this code for example in some method or function
// public Object getSystemService (String name)
// Return the handle to a system-level service by name.
// The class of the returned object varies by the requested name.
InputMethodManager inputMethodManager = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
//public boolean hideSoftInputFromWindow (IBinder windowToken, int flags)
//EditText myEdit = (EditText)findViewById(R.id.idEditText);
inputMethodManager .hideSoftInputFromWindow(myEdit.getWindowToken(), 0);
Get display, screen resolution - dimension Android phone development example source code.
Example:
HTC Desire HD
11 (4.3) Diagonal cm (in)
480×800 Resolution
85 (217) ppcm (PPI - Pixels per inch)
480 / 217 = 2.21 inch
800 / 217 = 3.69 inch
Math.sqrt( 2.21*2.21 + 3.69 * 3.69) = 4.3 inch - diagonal
//en.wikipedia.org/wiki/Pixels_per_inch
//en.wikipedia.org/wiki/Dots_per_inch
Typical screen widths:
320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc).
480dp: a tweener tablet like the Streak (480x800 mdpi).
600dp: a 7” tablet (600x1024 mdpi).
720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc).
Emulator skins in the Android SDK
//developer.android.com/guide/practices/screens_support.html
Display display = getWindowManager().getDefaultDisplay();
int nWidth = display.getWidth();
int nHeight = display.getHeight();
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
//get density per inch for example: 120 , 160 , 240
mXDpi = metrics.xdpi; // 160 The exact physical pixels per inch of the screen in the X dimension.
mYDpi = metrics.ydpi;
// density
int nDensity = metrics.densityDpi; // 160 screen density expressed as dots-per-inch
float mMetersToPixelsX = mXDpi / 0.0254f; // 1 inch == 0.0254 metre
float mMetersToPixelsY = mYDpi / 0.0254f;
// Resolution
// The total number of physical pixels on a screen.
int wPix = metrics.widthPixels; // 320 The absolute width of the display in pixels.
int hPix = metrics.heightPixels; // 480 The absolute height of the display in pixels.
int nWidthDisplay = (wPix < hPix)? wPix : hPix;
float nWidthScreenInInch = wPix / mXDpi; //320 / 160 == 2.0 in inch.
float nHeightScreenInInch = hPix / mYDpi; //480 / 160 == 3.0 in inch.
// for example:
// density 120 per inch
//width 320 pix / 120 dpi == width 2.66 inch
//height 480 pix / 120 dpi == height 4.0 inch
// density 240 per inch
//width 320 pix / 240 dpi == width 1.33 inch
//height 480 pix / 240 dpi == height 2.0 inch
Example:
HTC Desire HD
11 (4.3) Diagonal cm (in)
480×800 Resolution
85 (217) ppcm (PPI - Pixels per inch)
480 / 217 = 2.21 inch
800 / 217 = 3.69 inch
Math.sqrt( 2.21*2.21 + 3.69 * 3.69) = 4.3 inch - diagonal
//en.wikipedia.org/wiki/Pixels_per_inch
//en.wikipedia.org/wiki/Dots_per_inch
Typical screen widths:
320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc).
480dp: a tweener tablet like the Streak (480x800 mdpi).
600dp: a 7” tablet (600x1024 mdpi).
720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc).
Emulator skins in the Android SDK
//developer.android.com/guide/practices/screens_support.html
|
|
|
|
|
---|---|---|---|---|
Small screen |
QVGA (240x320) | 480x640 | ||
Normal screen |
WQVGA400 (240x400)
WQVGA432 (240x432) |
HVGA (320x480) | WVGA800 (480x800)
WVGA854 (480x854) 600x1024 |
640x960 |
Large screen |
WVGA800** (480x800)
WVGA854** (480x854) |
WVGA800* (480x800)
WVGA854* (480x854) 600x1024 |
||
Extra Large screen |
1024x600 | WXGA (1280x800)† 1024x768 1280x768 |
1536x1152 1920x1152 1920x1200 |
2048x1536 2560x1536 2560x1600 |
* To emulate this configuration, specify a
custom density of 160 when creating an AVD that uses a WVGA800 or WVGA854 skin. ** To emulate this configuration, specify a custom density of 120 when creating an AVD that uses a WVGA800 or WVGA854 skin. † This skin is available with the Android 3.0 platform |
Cycle for in Java example
public class MainClass {
public static void main(String[] arg) {
String[] arrayOfString = { "Hello", "people", "hello", "world!" };
for (int i = 0; // start position , first cycle i == 0
i < arrayOfString.length; // if i < 4 (length of array) do loop
i++ // incrementation after cycle
){
System.out.println(arrayOfString[i]);
// i++ incrementation
}
}
}
Displej 1280 x 800, 5.3 "
Rozměry 146.85 mm x 83 mm x 9.7 mm
Rozlišení fotoaparátu 8 Mpix
HD video, natačení videosekvencí
Operační system Android
Hlasové ovládání
Přehrávání MP3
Baterie Li-Ion ,doba hovoru 1570 min
Frekvence procesoru 1.4 GHz
Uživatelská paměť 16000 MB
Datové funkce: GPS modul, WiFi, Bluetooth, GPRS, EDGE, HSCSD, Hardwarový modem, Infraport
Podporované sítě GSM&EDGE 850 / 900 / 1.800 / 1.900
Formát videosouborů 3GPP / H.263 / H.264 / MPEG4 / WMV
Rozměry 146.85 mm x 83 mm x 9.7 mm
Rozlišení fotoaparátu 8 Mpix
HD video, natačení videosekvencí
Operační system Android
Hlasové ovládání
Přehrávání MP3
Baterie Li-Ion ,doba hovoru 1570 min
Frekvence procesoru 1.4 GHz
Uživatelská paměť 16000 MB
Datové funkce: GPS modul, WiFi, Bluetooth, GPRS, EDGE, HSCSD, Hardwarový modem, Infraport
Podporované sítě GSM&EDGE 850 / 900 / 1.800 / 1.900
Formát videosouborů 3GPP / H.263 / H.264 / MPEG4 / WMV
Example from SDK C:\Program Files\Android\android-sdk-windows\samples\android-10\ApiDemos\src\com\example\android\apis\text\Link.java
Source: //developer.android.com/resources/browser.html?tag=sample
License: //www.apache.org/licenses/LICENSE-2.0
1.) Automatically linkifies using android:autoLink="all"
2.) Link text by setMovementMethod
3.) Link as html code using Html.fromHtml()
4.) Link string by SpannableString
Source: //developer.android.com/resources/browser.html?tag=sample
License: //www.apache.org/licenses/LICENSE-2.0
1.) Automatically linkifies using android:autoLink="all"
// res/values/strings.xml
<string name="link_text_auto"><b>text1:</b> This is some text. In
this text are some things that are actionable. For instance,
you can click on //www.google.com and it will launch the
web browser. You can click on google.com too. And, if you
click on (415) 555-1212 it should dial the phone.
</string>
// main.xml
<!-- text1 automatically linkifies things like URLs and phone numbers. -->
<TextView xmlns:android="//schemas.android.com/apk/res/android"
android:id="@+id/text1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoLink="all"
android:text="@string/link_text_auto"
/>
2.) Link text by setMovementMethod
// MainActivity.java onCreate
/*Be warned that if you want a TextView with a key listener or movement method not to be focusable, or if you want a TextView without a key listener or movement method to be focusable, you must call setFocusable(boolean) again after calling this to get the focusability back the way you want it. */
TextView t2 = (TextView) findViewById(R.id.text2);
t2.setMovementMethod(LinkMovementMethod.getInstance());
// main.xml
<!-- text2 uses a string resource containing explicit <a> tags to
specify links. -->
<TextView xmlns:android="//schemas.android.com/apk/res/android"
android:id="@+id/text2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/link_text_manual"
/>
//strings.xml
<string name="link_text_manual"><b>text2:</b> This is some other
text, with a <a href="//www.google.com">link</a> specified
via an <a> tag. Use a "tel:" URL
to <a href="tel:4155551212">dial a phone number</a>.
</string>
3.) Link as html code using Html.fromHtml()
// MainActivity.java onCreate
TextView t3 = (TextView) findViewById(R.id.text3);
t3.setText(
Html.fromHtml(
"<b>text3:</b> Text with a " +
"<a href="//www.google.com">link</a> " +
"created in the Java source code using HTML."));
t3.setMovementMethod(LinkMovementMethod.getInstance());
4.) Link string by SpannableString
SpannableString ss = new SpannableString(
"text4: Click here to dial the phone.");
ss.setSpan(new StyleSpan(Typeface.BOLD), 0, 6,
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
ss.setSpan(new URLSpan("tel:4155551212"), 13, 17,
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
TextView t4 = (TextView) findViewById(R.id.text4);
t4.setText(ss);
t4.setMovementMethod(LinkMovementMethod.getInstance());
Editace: 2011-10-08 07:22:22
Počet článků v kategorii: 396
Url:emulator-window-was-out-of-view-and-was-recentred-android-emulator-warning