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.

Drawable Bitmap get width height Android

		Drawable dr = getResources().getDrawable(R.drawable.algebra);
		int h = dr.getIntrinsicHeight();
		int w = dr.getIntrinsicWidth();

		Bitmap ball = BitmapFactory.decodeResource(getResources(), R.drawable.algebra);
		int _nWidth = ball.getWidth();
		int _nHeight = ball.getHeight();

396LW NO topic_id


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


ADT Bundle 22.6.2 have memory leak. | adt-bundle-22-6-2-have-memory-leak

If I trying
and open xml layout graphic editor and xml layout file
memory continues to grow to crashes Eclipse


I have to install old version adt-bundle-windows-x86-20131030.zip
what working fine.
I had to delete .metadata folder in workspace if I want open old version ADT

Round number float - double to int - long Java example | round-number-float-to-int-java-example

int nf = Math.round(5.789f);
System.out.print(nf); // 6

float f = 28.611f; 
int n3 = Math.round(f);
System.out.println(n3); // 29

double d = 1234.56;
long lon = Math.round(d);
System.out.println(lon); // 1235

int diff = 90 - 40;
// float fDeleni = diff / 10; // error code
float fDeleni = (float)diff / 10.f; // ok
int nRound = Math.round(fDeleni);

// Caution:
int n2 = (int) 8.999f;
System.out.println(n2); // 8


Eclipse - Workspace in use or cannot be created chose a different one | eclipse-workspace-in-use-or-cannot-be-created-chose-a-different-one

Open your workspace folder and subfolder .metadata:

Delete .lock file

Android Studio Delete Hide Module | android-studio-delete-hide-module

To hide a module File->Project Structure Ctrl+Alt+Shift+S
In left panel click on Module which want to hide.
Click on minus symbol (-) on upper left corner of window.
Click Yes.

To delete module from disk click on module in project tree (to select) and press Delete on keyboard.

Disable enable internet connection in Android Emulator | disable-enable-internet-connection-in-android-emulator

If you try function for checking internet connection you can disable internet on the emulator:
Settings - Wireless and networks - Mobile networks - Data enabled (checked - unchecked )

 public boolean isNetworkAvailable() {
        ConnectivityManager cm = (ConnectivityManager) 
        NetworkInfo networkInfo = cm.getActiveNetworkInfo();
        if (networkInfo != null && networkInfo.isConnected()) {
            return true;
        return false;