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.

Delete Bitmap Android Example


AD MOB

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

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


//developer.android.com/reference/android/graphics/Bitmap.html
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.

397LW NO topic_id




AD

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


133

Draw Rect Android basic example | draw-rect-android-basic-example


drawRect(), Paint, setStroke(), setStyle(), Canvas example source code.

	@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) {

			canvas.drawColor(Color.CYAN);
			Paint p = new Paint();
			// smooths
			p.setAntiAlias(true);
			p.setColor(Color.RED);
			p.setStyle(Paint.Style.STROKE); 
			p.setStrokeWidth(4.5f);
			// opacity
			//p.setAlpha(0x80); //
//drawRect (float left, float top, float right, float bottom, Paint paint) 
			canvas.drawRect(10, 10, 30, 30, p);
		}

	}
}
283

Get Set Screen Orientation Android Code | get-set-screen-orientation-android-code



// in AndroidManifest.xml
<Activity
 android:screenOrientation="portrait" // or landscape

// in MyActivity.java
boolean mbOrientacionLandscape = false;
int nOrientation =	getResources().getConfiguration().orientation;
if(mbOrientacionLandscape==true){
	 getResources().getConfiguration();
	if(nOrientation != Configuration.ORIENTATION_LANDSCAPE)
	setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
	
}
else{
	if(nOrientation != Configuration.ORIENTATION_PORTRAIT)
	setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}

386

Android Studio Gradle Download Link | android-studio-gradle-download-link


I You use offline work for better building speed of project or for other purpose
https://gradle.org/releases

Offline work:
File - Settings - Gradle
- select Use local gradle distribution
- select path Gradle home:
- check Offline work
200

Samsung i9250 Galaxy Nexus | samsung-i9250-galaxy-nexus






























Brand Samsung
Model (codename) i9250 Galaxy Nexus
Cena, včetně DPH 9000
Veikost Displaye v palcích 4.65
Display-resolution 1280x720
Dotek-typ kapacitní
CPU typ
CPU MHz 1200
CPU core 2
L2 cache
RAM 1 GB
ROM 16 - 32 GB
GPU TI OMAP 4460 1,2 GHz dual-core
NenaMark2 Benchmark
GPU-GLBenchmark
Baterie mAh 1750
Foto MPx 5
Autofocus yes
Video 480p - 30 frames/s
Official Android ICS Android 4.0 Ice Cream Sandwich
CyanogenMod support
Dotek-prstů-max
Display-ppi
Display-retina
Network GSM&EDGE: 850 / 900 / 1.800 / 1.900
Connectivity
Pozn.


samsung-i9250-galaxy-nexus image
samsung-i9250-galaxy-nexus
86

Map TreeMap key value pair add put get pair by key Java Android example | map-treemap-key-value-pair-add-put-get-pair-by-key-java-android-example


Map TreeMap add key value pair get find pair by key Java Android example.

MainClass.java

import java.util.Map;
import java.util.TreeMap;

public class MainClass {
	public static void main(String[] arg) {
		
		// english;germany dictionary
		String[] arrayOfString = { "one;eine", "two;zwei", "three;drei" };

		Map<String, String> map = new TreeMap<String, String>();
	    
		for(String s: arrayOfString){
	    	String[] array = s.split(";");
	    	String sKey ="", sValue="";
	    	if(array.length > 1){
	    	sKey = array[0]; sValue = array[1];
	    		map.put(sKey, sValue);
	    	}
	    }

       // check if key exists 	    
	   if( map.containsKey("two")){
		System.out.print("two = " + map.get("two"));
	   }
	}
}
/*
two = zwei
 */



Editace: 2013-12-09 12:59:36
Počet článků v kategorii: 397
Url:delete-bitmap-android-example

AD
11 Share
Share
Tweet