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.

Eclipse custom skin GUI color theme

Eclipse make own color of toolbars, windows, status bar etc.
https://github.com/jeeeyul/eclipse-themes/wiki/Alternative-Install

android/eclipse-custom-skin-gui-2.jpg

android/eclipse-custom-skin-gui.png

396LW NO topic_id




AD

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


264

Whittled superscript sup tag TextView Android issue | whittled-superscript-sup-tag-textview-android-issue


Issue: Cropped superscript index between tags sup /sup is not correctly visible in TextView or View as Button.

String s = "10<sup>12 </sup>";
textView.setText(Html.fromHtml(s)); // 12 will cropped 
// solution:
s = "10<sup>12 </sup>\t	"; // add behind ending of sup tag the tabulator \t, 
// but not char \t but only press to TAB key!!! in source code
textView.setText(Html.fromHtml(s)); // 12 is visible correctly


android/textview-superscript-issue.jpg
323

Set Default Start Up Activity Class Java AndroidManifest xml | set-default-start-up-activity-class-java-androidmanifest-xml


Insert into your default start up activity tag inten-filter tag with action MAIN and category LAUNCHER

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>


AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="//schemas.android.com/apk/res/android"
    package="com.example.blabol"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="19" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
15

int java android example | int-java-android-example


int occupy 4 bytes (32 bits) in memory

int in Java example of using Integer and Array of Integer and Iteger to String

        // get max end min values of int in Java example 4 bytes (32 bits) PC architecture
	System.out.println(Integer.MAX_VALUE); // 2147483647
	System.out.println(Integer.MIN_VALUE); // -2147483648


// members variable
private int mProgress = 10;

//integer to string java
int myInteger = 8;
String myString = Integer.toString(myInteger);

// a final variable can only be initialized once
static final int NUM_PARTICLES = 15;

 for (int i = 0; i < NUM_PARTICLES ; i++) { 
// do something
}

// int as return value of function
public int getCount() {
return 5;
}

// int as a parametr of function
public float getFloatFromInt(int i) {
float fRet = (float) i;
 return fRet;
}

//array of int
int[] anArray;              // declares an array of integers
          anArray = new int[2];      // allocates memory for 2 integers
          anArray[0] = 100; // initialize first element
          anArray[1] = 200; // initialize second element

for (int i = 0; i < anArray.length; i++) {
// print out values from anArray
System.out.println("Index: " + i);
System.out.println("Value: " + anArray[i]); 
}


143

Rounded rect RectF Android example | rounded-rect-rectf-android-example


RectF, drawRoundRect(),

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) {
			Paint paint = new Paint();
			
			canvas.drawColor(Color.GREEN);
            
           Bitmap b = Bitmap.createBitmap(200, 200, Bitmap.Config.ALPHA_8);
           Canvas c = new Canvas(b);
           RectF rectF = new RectF();
           rectF.set(5,5,150,150);
           c.drawRoundRect(rectF, 10, 10, paint);
           
            paint.setColor(Color.RED);
           
           canvas.drawBitmap(b, 10,10, paint);
		}

	}
}


android/draw-rounded-rect-android.png
222

Disable enable internet connection in Android Emulator | disable-enable-internet-connection-in-android-emulator


If you try function for checking internet connection you can disable internet on the emulator:
Settings - Wireless and networks - Mobile networks - Data enabled (checked - unchecked )


 public boolean isNetworkAvailable() {
        ConnectivityManager cm = (ConnectivityManager) 
          getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo networkInfo = cm.getActiveNetworkInfo();
        if (networkInfo != null && networkInfo.isConnected()) {
            return true;
        }
        return false;
    }