Android Error: Converting to string: TypedValue{t=0x10/d=0xe a=-1}
Converting to string: TypedValue{t=0x10/d=0xe a=-1}
- 14
// error
- "18"
// ok
396LW NO topic_id
AD
Další témata ....(Topics)
Very very quick start of Android Emulator from Eclipse.
If will closed Android Emulator all data will saved on disk.
If will reopen Android Emulator, configuration and data will read from disk.
[caption id="attachment_768" align="alignleft" width="300" caption="android-emulator-enable-quick-start"][/caption]
- Go to Eclipse s menu Window -> Android SDK and AVD Manager
- Select Virtual devices
- Select check box Snapshot: Enabled
- Press Edit AVD button.
If will closed Android Emulator all data will saved on disk.
If will reopen Android Emulator, configuration and data will read from disk.
[caption id="attachment_768" align="alignleft" width="300" caption="android-emulator-enable-quick-start"][/caption]
xml example source code with image.
<TableLayout android:layout_width="match_parent" android:id="@+id/idTableInRadioGroup" android:layout_height="wrap_content">
<TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_height="wrap_content">
<RadioGroup android:id="@+id/idRadio_group_1_column"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:orientation="vertical">
<RadioButton android:id="@+id/idRadio_1"
android:text="@string/textLabel_1"/>
<RadioButton android:id="@+id/idRadio_2"
android:text="@string/textLabel_2"/>
<RadioButton android:id="@+id/idRadio_3"
android:text="@string/textLabel_3"/>
</RadioGroup>
<RadioGroup android:id="@+id/idRadio_group_2_column"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:orientation="vertical">
<RadioButton android:id="@+id/idRadio_4"
android:text="@string/textLabel_4"/>
<RadioButton android:id="@+id/idRadio_5"
android:text="@string/textLabel_5"/>
<RadioButton android:id="@+id/idRadio_6"
android:text="@string/textLabel_6"/>
</RadioGroup>
</TableRow>
</TableLayout>
RectF, drawRoundRect(),
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) {
Paint paint = new Paint();
canvas.drawColor(Color.GREEN);
Bitmap b = Bitmap.createBitmap(200, 200, Bitmap.Config.ALPHA_8);
Canvas c = new Canvas(b);
RectF rectF = new RectF();
rectF.set(5,5,150,150);
c.drawRoundRect(rectF, 10, 10, paint);
paint.setColor(Color.RED);
canvas.drawBitmap(b, 10,10, paint);
}
}
}
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 |
// in strings.xml
<string name="myStringWithTags"><![CDATA[<b>some text..</b> other tags ...]]></string>
<string name="myStringWithPattern"><![CDATA[<b>%s</b> other tags ...]]></string>
// in Activity.class
String sHtmlText = this.getApplicationContext().getString(R.string.myStringTags);
sHtmlText = this.getApplicationContext().getString(R.string.myStringWithPattern,"replace %s with this text");
Editace: 2014-02-15 20:15:44
Počet článků v kategorii: 396
Url:android-error-converting-to-string-typedvaluet0x10d0xe-a-1