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.

Rotate Canvas with Bitmap Android example

drawPath, canvas.rotate, lineTo basic Android example for your testing.



// //www.apache.org/licenses/LICENSE-2.0
// The Android Open Source Project
public class MainActivity extends Activity {

	protected void onCreate(Bundle savedInstanceState) {
		setContentView(new SampleView(this));

	private static class SampleView extends View {
		private Paint mPaint = new Paint();
		private Path mPath = new Path();

		public SampleView(Context context) {

			// Construct a wedge-shaped path
			mPath.moveTo(0, -60);
			mPath.lineTo(-20, 80);
			mPath.lineTo(0, 60);
			mPath.lineTo(20, 80);

		protected void onDraw(Canvas canvas) {
			Paint paint = mPaint;


			Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(),
			canvas.drawBitmap(bitmapOrg, 10, 10, paint);
			int w = canvas.getWidth();
			int h = canvas.getHeight();
			int cx = w / 2;
			int cy = h / 2;

			canvas.translate(cx, cy);
         // uncomment next line 
			canvas.drawPath(mPath, mPaint);


396LW NO topic_id


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


SimpleCursorAdapter deprecated | simplecursoradapter-deprecated

Constructor SimpleCursorAdapter is deprecated.
If using api 11 and above, you can try add last parameter 0.

Cursor cursor = managedQuery(...........,,,,);
// Specify the columns we want to display in the result
            String[] from = new String[] { KEY_WORD,
                                           KEY_DEFINITION };

            // Specify the corresponding layout elements where we want the columns to go
            int[] to = new int[] { R.id.word,
                                   R.id.definition };
// deprecated 
 SimpleCursorAdapter words =
            new SimpleCursorAdapter(this,
                    R.layout.result, cursor, from, to);
// working
 SimpleCursorAdapter words =
            new SimpleCursorAdapter(this,
                    R.layout.result, cursor, from, to, 0); // to, 0!!!!

//working in Fragment
SimpleCursorAdapter  mAdapter = new SimpleCursorAdapter(getActivity(),
                android.R.layout.simple_list_item_2, null,
                new String[] { "name", "age" }, // cursor parameters
                new int[] { android.R.id.text1, android.R.id.text2 }, 0);


Android SDK Samples as a Photo Gallery | android-sdk-samples-as-photo-serial

Photo Gallery of Android SDK Samples.
For better understanding of what the source knows there is a gallery of images.
After clicking on the preview displays the actual size and Titlebar
You can read the path to the source file as: Graphics/AnimateDrawables see the project folder


How setup color coloring syntax code highlight highlighting in Eclipse editor Android example | how-setup-color-syntax-highlight-in-eclipse-android-example

How setup color coloring highlight highlighting syntax font size and family in Eclipse Java and XML editor Android example
Java editor

  1. Go to Eclipse menu Window -> Preferences

  2. Doubleclick on Java

  3. Double click on Editor

  4. Select Java, Javadocs or Comments and setup color and font

  5. Font size and family change from Window->Preferences-> General->Appearance->Colors and Fonts

  6. Press OK for saving changes

xml editor
xml editor double click in Preferences dialog on xml -> Editor -> Syntax coloring
[caption id="attachment_627" align="alignleft" width="297" caption="Eclipse editor syntax color settings"]android/eclipse-color-syntax-highlight-settings-297x300.png[/caption]

Button Android | button-android

Google Android button example source code for developers.

// get handle
Button myButton;
myButton = (Button)findViewById(R.id.idMyButton);
//set focus
// set background image
// or
myButton.setBackgroundDrawable(getResources().getDrawable( R.drawable.someImage));

// set visibility
myButton.setVisibility(View.INVISIBLE); // VISIBLE

///////// SET LISTENER
       Button myButton =(Button)findViewById(R.id.button1);
        myButton.setOnClickListener(new Button.OnClickListener() {
            public void onClick(View v) {
                Toast.makeText(getApplicationContext(), "AHOJ",

// or set onClickListener
//end onCreate .....
   private OnClickListener myListener = new OnClickListener() {
        public void onClick(View v) {



Statistics usability of mobile phones with Android – October 2011 | statistics-usability-of-mobile-phones-with-android-%e2%80%93-october-2011

Table of usability phones with Android: (Our software)

October 2011 September 2011

Samsung Galaxy S2 10,90%
Samsung Galaxy S 8,10%
Samsung Galaxy Tab 7,00%
Samsung Galaxy Mini 6,20%
HTC Desire HD 4,10%
Samsung Galaxy Ace 4,10%
Samsung Galaxy S 4,00%
Samsung Galaxy Fit 3,30%
HTC Wildfire 3,20%
SEMC Xperia X10 2,20%

Samsung Galaxy S213.8%
Samsung Galaxy S8.5%
Samsung Galaxy Tab7.4%
Samsung Galaxy Mini5.4%
Samsung Galaxy S4.0%
HTC Desire HD3.8%
Samsung Galaxy Ace3.8%
HTC Wildfire3.2%
Samsung Galaxy Fit3.1%
SEMC Xperia X102.1%

Graph of usability Smartphone with Android - October 2011:

Samsung Galaxy S2 vs iPhone4 - video

Samsung Galaxy S2 vs iPhone4 - browsing, gaming, apps, performance, browser, fast, against, navigation, Sygic, apk, Android, iOS