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.

Motorola Droid RAZR


AD MOB

Motorola Droid RAZR cena od 12 000 KCZ Kč (únor.2012)
Spokojenost uživatelů nadprůměrná.
Motorola Droid RAZR je chytrý telefon s operačním systémem Android.
Motorola Droid RAZR je (22.února2012) 9. nejpoužívanějším chytrým telefonem u programu Sky Map viz tabulka.



Motorola Droid RAZR photo pic image
Motorola Droid RAZR
Zdroj obrázku: wikipedia

397LW NO topic_id




AD

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


134

Draw Oval Android basic example | draw-oval-android-basic-example


drawOval(), setStrokeWidth(), setStyle()


public class MainActivity extends Activity {
	@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); //
 
			canvas.drawOval(new RectF(50, 50, 20, 40), p);;
		}

	}
}
9

Button Android | button-android


Google Android button example source code for developers.

// get handle
Button myButton;
myButton = (Button)findViewById(R.id.idMyButton);
//set focus
myButton.requestFocus();
// set background image
myButton.setBackgroundResource(R.drawable.backImage);
// 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",
                    Toast.LENGTH_LONG).show();
            }
        });	

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

        }
   }



72

While cycle loop in Java example | while-cycle-loop-in-java-example


While cycle Java basic example with array of strings.

MainClass.java

public class MainClass {
	public static void main(String[] arg) {
		String[] arrayOfString = { "Hello", "people", "hello", "world!" };
                int i = 0;
		while ( i < arrayOfString.length ){
			System.out.println(arrayOfString[i]);
			i++;
		}
	}
}
41

Preferences settings save open read write application Android example | preferences-settings-save-open-red-application-android-example


Android app setup preferences, settings, open, read, write, onStop(), onPause(), getSharedPreferences(), SharedPreferences.Editor getInt(), getBoolean(), getString() , putInt(), putString(), putBoolean() example source code.



import android.content.SharedPreferences;

public class MainClass extends Activity {
  public static final String PREFERENCES_NAME = "MyPrefsFile";
  String myNewString;
  int myNewInt;
  Boolean myNewBool;


   @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // read old settings if exist
      SharedPreferences settings = getSharedPreferences(PREFERENCES_NAME, 0);
			
     String sDefault = "Hello!";
      String sStringFromPrefFile = settings.getString("myString", sDefault); // new text  or default Hello!
          
      int nDefaultIndex = 2; //
      int nIndexFromPrefFile = settings.getInt("myInt", nDefaultIndex); // 4 or default 2
			
      Boolean bDefault = false;
      Boolean bFromPrefFile = settings.getBoolean("silentMode", bDefault); // true or default false
        
        
        // new settings will saved in onStop or onPause
        myNewString = "new text";
        myNewInt = 4;
        myNewBool = true;
     }   

    @Override
    protected void onPause() {
    	super.onPause();
        Toast.makeText(getApplicationContext(), "onPause "
        		, Toast.LENGTH_SHORT).show();

    	savePreferences();
    }
    
    @Override
    protected void onStop() {
    	super.onStop();
    	savePreferences();
    }
    /**save settings*/	
    public void savePreferences(){
    	try {
    		SharedPreferences settings = getSharedPreferences(PREFERENCES_NAME, 0);
    		SharedPreferences.Editor editor = settings.edit();
 
    		editor.putString("myString", myNewString);
     		editor.putInt("nMyInt", myNewInt);
    		editor.putBoolean("silentMode", myNewBool); // 
    		
    		editor.commit();
    	} catch (Exception e) {
    		// TODO Auto-generated catch block
    		e.printStackTrace();
    	}
    	
    }	
}
105

How to make a horizontal line in Android application example code | how-to-make-a-horizontal-line-in-android-application-example-code


In html is horizontal line a tag br. In Android source code you can use a View as xml example bellow.

<View
android:layout_width="fill_parent"
android:layout_height="4dip"
android:background="#ffffff"
android:paddingBottom="10dip"
/>


Editace: 2012-02-22 13:35:33
Počet článků v kategorii: 397
Url:motorola-droid-razr

AD
11 Share
Share
Tweet