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.

How to clear or hide an ImageView in Android


AD MOB


// solution 1
ImageView imageView = (ImageView)findViewById(R.id.myimage);
imageView.setImageDrawable(null);
// or
imageView.setImageResource(0);

// solution 2  hide ImageView
imageView.setVisibility(View.INVISIBLE);

// solution 3 resize ImageView 0, 0
 hImageViewSemafor.setLayoutParams(new LinearLayout.LayoutParams(0,0));

397LW NO topic_id




AD

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


315

Importing google-play-service library project to workspace issue | importing-google-play-service-library-project-to-workspace-issue


Try two way in Eclipse IDE:

1.) Import the library project into your Eclipse workspace.
Click File > Import,
select Android > Existing Android Code into Workspace, and browse to the copy of the library project to import it.
If project not visible with checkbox try next step as see below.

2.) Click
File > New > Other
select Android > Existing Android Code into Workspace, and browse to the copy of the library project to import it.
81

Shuffle List ArrayList Collections Java example | shuffle-list-arraylist-collections-java-example


Add and shuffle elements in LinkedList or ArrayList Java basic example.


import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

public class MainClass {
	public static void main(String[] arg) {
		String[] arrayOfString = {"nothing", "Hello", "people"
				, "bye-bye", "hello", "world!", "End" };
		   List<String> arrayList = new LinkedList<String>();
            for(String s: arrayOfString)
		     arrayList.add(s);

		    Collections.shuffle(arrayList);

		    System.out.println(arrayList);
		    
		  }
}
/*
[hello, world!, bye-bye, nothing, people, End, Hello]
*/


246

Set Custom Font to View Android Example | set-custom-font-to-view-android-example


You have to put your font fonts/samplefont.ttf into assets/fonts folder in your project!

// set own custom font from assets
TextView txt = (TextView) findViewById(R.id.custom_font);
Typeface mFace = Typeface.createFromAsset(getContext().getAssets(),
                                             "fonts/samplefont.ttf");
    txt.setTypeface(mFace);
294

Get Bitmap Size Get Free Memory Exception Android | get-bitmap-size-get-free-memory-exception-android


Bitmap size calculation:
bmpHeight * bmpWidth
For example:
Resolution of image 1024x860 = 880 640 pixels
If every pixel get 4 byte of memory:
880 640x4= 3 522 560 (3.5MB)

Get bitmap size without allocation of memory:

   	BitmapFactory.Options options = new BitmapFactory.Options();
        // If set to true, the decoder will return null (no bitmap), but the out... fields will still
        // be set, allowing the caller to query the bitmap without having to allocate the memory for its pixels. 
    	options.inJustDecodeBounds = true; 
    	BitmapFactory.decodeResource(getResources(), R.drawable.my_image, options);
    	int imageHeight = options.outHeight; // 1024
    	int imageWidth = options.outWidth; // 860
    	String imageType = options.outMimeType; // .jpg .png .gif
 


Get Memory size:
Make your bitmap not bigger as maxMemory size
final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);

    float density = getResources().getDisplayMetrics().density;

    Debug.MemoryInfo memoryInfo = new Debug.MemoryInfo();
    Debug.getMemoryInfo(memoryInfo);
    final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);
    final int freeMemory = (int) (Runtime.getRuntime().freeMemory() / 1024);
    String memMessage = String.format(
        "Free=%d kB,

MaxMem=%d kB,
Memory: Pss=%.2f MB, Private=%.2f MB, Shared=%.2f MB", freeMemory, maxMemory, memoryInfo.getTotalPss() / 1024.0, memoryInfo.getTotalPrivateDirty() / 1024.0, memoryInfo.getTotalSharedDirty() / 1024.0); ((TextView)findViewById(R.id.textViewInfo)).setText(memMessage );
106

Statistics usability of mobile phones with Android - September 2011 | statistics-usability-of-mobile-phones-with-android-september-2011


(Our software)

 
1Samsung Galaxy S213.8% (1,232)
2Samsung Galaxy S8.5% (762)
3Samsung Galaxy Tab7.4% (659)
4Samsung Galaxy Mini5.4% (483)
5Samsung Galaxy S4.0% (356)
6HTC Desire HD3.8% (341)
7Samsung Galaxy Ace3.8% (339)
8HTC Wildfire3.2% (286)
9Samsung Galaxy Fit3.1% (274)
10SEMC Xperia X102.1% (190)


Editace: 2013-12-09 13:07:42
Počet článků v kategorii: 397
Url:how-to-clear-or-hide-an-imageview-in-android

AD
11 Share
Share
Tweet