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.

Alert messagebox toast Android example code

Toast in Android application is equivalent of Alert in JavaScript or MessageBox in WinApi.

// Toast android.widget.Toast.makeText(Context context, CharSequence text, int duration)
// public static Toast makeText (Context context, CharSequence text, int duration) 

Toast.makeText(getApplicationContext(), "Hello world!",

397LW NO topic_id

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


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
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};
	protected void onCreate(Bundle savedInstanceState) {
		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);



Eclipse Graphical Editor does not display a xml source code - error bug | eclipse-graphical-editor-does-not-display-code-error-bug

Try this solutions:
1.) Save xml file
2.) Close tab with xml file
3.) Reopen xml file

1.) Open from menu Window->Android SDK Manager
2.) Select available updates (Tools, SDK etc.)
3.) Install updates

1.) Open from menu Help->Check for Updates
2.) Install available plugins what You need
3.) Restart Eclipse


Shuffle array int string Java Android | shuffle-array-int-string-java-android

String [] arOfStrings = {"one", "two", "three"};
List<String> mListOfStrings = new ArrayList<String>(Arrays.asList(arOfStrings));
String str = mListOfStrings.get(2);// 2 is index of pozition an element

int [] arOfInt = {1, 2, 3};
List<Integer> mListOfInt = new ArrayList<Integer>(Arrays.asList(arOfInt));

Delete Bitmap Android Example | delete-bitmap-android-example

If some memory leak - problem try release of memory used of a big Bitmap what already not to need;
Bitmpap bmp; // not null
bmp = null;

final boolean bmpIsRecycled = bmp.isRecycled()
// Returns true if this bitmap has been recycled.

Free the native object associated with this bitmap, and clear the reference to the pixel data. This will not free the pixel data synchronously; it simply allows it to be garbage collected if there are no other references. The bitmap is marked as "dead”, meaning it will throw an exception if getPixels() or setPixels() is called, and will draw nothing. This operation cannot be reversed, so it should only be called if you are sure there are no further uses for the bitmap. This is an advanced call, and normally need not be called, since the normal GC process will free up this memory when there are no more references to this bitmap.

Multiple substitutions specified in non-positional format | multiple-substitutions-specified-in-non-positional-format

Multiple substitutions specified in non-positional format;did you mean to add the formatted="false" attribute?
Wiktionary, WiktionarySimple
location C:\documents\WiktionarySimple\res\values\strings.xml

    <string name="template_user_agent">"%s/%s (Linux; Android)"</string>
    <string name="template_wotd_title">"Wiktionary:Word of the day/%s %s"</string>
    <string name="template_define_url">"//en.wiktionary.org/wiki/%s"</string>


   <string name="template_user_agent" translatable="false">"%1$s/%2$s (Linux; Android)"</string>
    <string name="template_wotd_title">"Wiktionary:Word of the day/%1$s %2$s"</string>
    <string name="template_define_url" translatable="false">"//en.wiktionary.org/wiki/%s"</string>

Editace: 2011-09-16 11:29:29
Počet článků v kategorii: 397