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.

Check Internet connection Android example


AD MOB


public boolean isConnected() {
	 try {
		ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
		 return cm.getActiveNetworkInfo().isConnectedOrConnecting();
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
		Log.e("isConnected", e.getMessage());
		Toast.makeText(getApplicationContext(), e.getMessage(),
				Toast.LENGTH_LONG).show();
		return false;
	}



397LW NO topic_id




AD

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


366

App have transparent menu Android | app-have-transparent-menu-android


If the app have transparent menu and you do not want this,
try delete @style/AppTheme in application tag in AndroidManifest.xml
and try run module - project. If menu is not transparent , maybe it caused

 <application
        android:allowBackup="true"
        android:icon="@drawable/dicts_ico"
        android:label="@string/app_name" 
        android:theme="@style/AppTheme" // delete this row - run app - try menu
 >


Or try set values\styles.xml into basic Theme

<resources>

    <!--
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
    -->
    <style name="AppBaseTheme" parent="android:Theme.Black">
        <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
        -->
    </style>

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    </style>

</resources>

332

Lenovo A6000 smartphone pictures from camera 8mpx review | lenovo-a6000-smartphone-pictures-from-camera-8mpx


Pictures taken by front camera Lenovo A6000 smartpohone - review.
Do not take pictures against the sun.
Stay in the shade. Keep lens clean.

Night without flash

Lenovo A6000 pictures quality
Lenovo A6000 pictures quality
Lenovo A6000 pictures quality
Lenovo A6000 pictures quality




Misty - smog


Without flash in room - TV screen


lenovo-a6000-pictures-from-camera
lenovo-a6000-pictures-from-camera
lenovo-a6000-pictures-from-camera
lenovo-a6000-pictures-from-camera
lenovo-a6000-pictures-from-camera
lenovo-a6000-pictures-from-camera
lenovo-a6000-pictures-from-camera
lenovo-a6000-pictures-from-camera
138

Draw text drawText Android basic example | draw-text-drawtext-android-basic-example


drawText(), setColor(), setTextSize(), setTextAlign()

public class ApokusActivity 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();
			
            paint.setColor(Color.YELLOW);
            paint.setTextSize(60);
            //paint.setTextAlign(Paint.Align.CENTER);

            canvas.drawText("Hello world!", 0, 50, paint);
		}

	}
}

45

Adding TableRow add row with a View TextView dynamically to TableLayout Android sample example | adding-tablerow-add-row-with-a-view-textview-dynamically-to-tablelayout-android-sample-example


Adding TableRow with a View TextView (EditText Button) programmically dynamically to TableLayout Android sample basic example.
MainClass.java

public class MainClass extends Activity {
   
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        TableLayout tl = (TableLayout)findViewById(R.id.tableLayout1);
        TableRow row = new TableRow(this);
        TextView tv = new TextView(this);
        tv.setText("This is text");

        tl.addView(row);
        row.addView(tv);

    }
}



main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="//schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<TableLayout android:layout_width="fill_parent" 
    android:id="@+id/tableLayout1" android:layout_height="wrap_content">
</TableLayout>
</LinearLayout>

215

How to programmatically set the button style - Android | how-to-programmatically-set-the-button-style-android


How set rounded corners and own styles ActivityMy.java

Button btn.setBackgroundResource(R.drawable.back_button_answer);



\res\drawable\back_button_answer.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="//schemas.android.com/apk/res/android" android:shape="rectangle" >
   <corners android:radius="10dip" />
   <!-- background -->
   
   <gradient
                android:startColor="#D6D7D6"
                android:centerColor="#E2E2E2"
                android:centerY="0.75"
                android:endColor="#D6D7D6"
                android:angle="270"
        />
   
   <stroke android:width="2dip" android:color="#fff"/>
</shape>


Editace: 2011-11-19 21:15:12
Počet článků v kategorii: 397
Url:check-internet-connection-android-example

AD
11 Share
Share
Tweet