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.

Android Api level - SDK version - how get Api level on device - sample


AD MOB


import android.os.Build.VERSION;
//
int nSdkVersion = Integer.parseInt(Build.VERSION.SDK);
int nApiVersion = VERSION.SDK;






















Platform Version API Level
Android 4.0 14
Android 3.2 13
Android 3.1.x 12
Android 3.0.x 11
Android 2.3.4 10
Android 2.3.3 10
Android 2.3.2 9
Android 2.3.1 9
Android 2.3 9
Android 2.2.x 8
Android 2.1.x 7
Android 2.0.1 6
Android 2.0 5
Android 1.6 4
Android 1.5 3
Android 1.1 2
Android 1.0 1

397LW NO topic_id




AD

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


380

Android Studio Browse Files Data Device Emulator | android-studio-browse-data-device-emulator


1.) Open DDMS via Menu Tools > Android > Android Device Monitor
2.) Select Device
3.) In DDMS click Menu Window > Show View > File Exlporer
4.) Device > Storage folder
5.) Emulator > data > data folder
265

Whittled superscript sup tag TextView Android issue | whittled-superscript-sup-tag-textview-android-issue


Issue: Cropped superscript index between tags sup /sup is not correctly visible in TextView or View as Button.

String s = "10<sup>12 </sup>";
textView.setText(Html.fromHtml(s)); // 12 will cropped 
// solution:
s = "10<sup>12 </sup>\t	"; // add behind ending of sup tag the tabulator \t, 
// but not char \t but only press to TAB key!!! in source code
textView.setText(Html.fromHtml(s)); // 12 is visible correctly


textview-superscript-issue
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();
            }
        });	
 	}

}

367

View getId is null Android | view-getid-is-null-android


If you create a button or view programmatically with OnClickListener you can set a tag key before button in parent layout is added.
And get correct button by this tag getTag() instead getId() in OnClickListener etc.

Button button = new Button(getApplicationContext());
int idOfButton = button.getId(); // return -1

button.setTag("my_button");
String sTag = (String) button.getTag(); // return "my_button"

350

fragment Binary XML file line Must specify unique android:id, android:tag, or have a parent with an id for | fragment-binary-xml-file-line-must-specify-unique-androidid-androidtag-or-have-a-parent-with-an-id-for


FrameLayou, fragment have to unique id android:id="@+id/your_id_unique"

<FrameLayout xmlns:android="//schemas.android.com/apk/res/android"
    xmlns:tools="//schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <fragment
        android:id="@+id/your_id_unique"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        class="cz.okhelp.notepad.AddNoteFragment"
        tools:layout="@layout/add_note" />

</FrameLayout>


Editace: 2011-10-29 08:52:36
Počet článků v kategorii: 397
Url:android-api-level-sdk-version-how-get-api-level-on-device-sample

AD
11 Share
Share
Tweet