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.

Open url with browser if button clicked Android example.

Button, setOnClickListener, Intent.ACTION_VIEW, startActivity Android example.


Button mIdButtonHome = (Button)findViewById(R.id.idButtonHome);
	mIdButtonHome.setOnClickListener(new View.OnClickListener() {
		public void onClick(View v) {
			Intent browserIntent = new Intent(
					Intent.ACTION_VIEW,
					Uri.parse("//android.okhelp.cz/category/software/"));
			startActivity(browserIntent);
		}
	});



396LW NO topic_id




AD

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


282

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);
}

262

Eclipse failed to create the java virtual machine - Android | eclipse-failed-to-create-the-java-virtual-machine-android


Eclipse: failed to create the java virtual machine - message box

  1. Open folder with Eclipse.exe and find eclipse.ini file

  2. Replace -vmargs
    by your current real path of javaw.exe:
    -vm "c:\Program Files\Java\jdk1.7.0_07\bin\javaw.exe"




-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120522-1813
-product
com.android.ide.eclipse.adt.package.product
--launcher.XXMaxPermSize
256M
-showsplash
com.android.ide.eclipse.adt.package.product
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vm "c:\Program Files\Java\jdk1.7.0_07\bin\javaw.exe” 
-Dosgi.requiredJavaVersion=1.6
-Xms40m
-Xmx768m
-Declipse.buildId=v21.1.0-569685
249

Drawable Bitmap get width height Android | 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();


21

How to install mount SD card for Eclipse Android Emulator | how-install-sd-card-on-android-eclipse-emulator


If you want download some *.apk file from internet and try on your emulator you get error than you have to install SD card. You have to closing Android emulator.
Mount Android emulator SD card instruction

  1. In Eclipse go in menu Window - Android SDK and Avg Manager

  2. Select Virtual devices

  3. Select AVD Name where you need install SD card

  4. Click on Edit button

  5. In open dialog go to SD card - Size: and write 500

  6. Press button Edit AVD

  7. Run AVD emulator


Image how install SD card on Android emulator in Eclipse.