How to check the network status for both wifi and 3g mobiles

by Kumar Bibek » Thu, 17 Jun 2010 03:33:51 GMT


Sponsored Links
 Check the ConnectivityManager API.

 http://tech-droid.blogspot.com/2010/06/checking-network-availability.html 

Thanks and Regards,
Kumar Bibek
 http://tech-droid.blogspot.com 




--



Other Threads

1. What's wrong with this code - SimpleAdapter

Hi, I can't seems to display multiple roll in listview. What is wrong
with my code?
It just display line 1 - fruit1 and fruit2-4 doesn't appear.

---
ArrayList<HashMap<String,String>> list =
new ArrayList<HashMap<String,String>>();

HashMap<String,String> map = new HashMap<String,String>();
map.put("fruit1","Apple");
map.put("fruit2", "Orange");
map.put("fruit3", "Pear");
map.put("fruit4", "Banana");
list.add(map);

SimpleAdapter adapter = new SimpleAdapter(this, list,
R.layout.fruit_list,
new String[] {"fruit1","fruit2","fruit3","fruit4"},
new int[] {R.id.fruit1,R.id.fruit2, R.id.fruit3, R.id.fruit4}
);
ListView lv=(ListView)findViewById(R.id.fruitView);
lv.setAdapter(adapter);

---
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<Spinner android:id="@+id/sort_by" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:entries="@array/
default_sorts">
</Spinner>

<ListView
android:id="@+id/fruitView"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</ListView>
</LinearLayout>

---

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/selector"
android:padding="10sp">
<TextView
android:id="@+id/fruit1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMediumInverse"/>
<TextView
android:id="@+id/fruit2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMediumInverse"/>
<TextView
android:id="@+id/fruit3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMediumInverse"/>
<TextView
android:id="@+id/fruit4"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMediumInverse"/>
</LinearLayout>

-- 

2. ACTION_AIRPLANE_MODE_CHANGED

Hi,

I have a question about airplane mode broadcast intent.

The documentation says that the "state" extra value is a boolean.

http://developer.android.com/reference/android/content/Intent.html#ACTION_AIRPLANE_MODE_CHANGED

In the source of android apps, the PhoneApp reads it as integer:

if (action.equals(Intent.ACTION_AIRPLANE_MODE_CHANGED)) {
   boolean enabled = System.getInt(getContentResolver(),
System.AIRPLANE_MODE_ON, 0) == 0;
   ...
}

In some device (custom rom) there is an error if they try to read a
boolean:

02-01 16:46:57.088: WARN/Bundle(302): java.lang.ClassCastException:
java.lang.Integer
02-01 16:46:57.088: WARN/Bundle(302):     at
android.os.Bundle.getBoolean(Bundle.java:786)
02-01 16:46:57.088: WARN/Bundle(302):     at
android.content.Intent.getBooleanExtra(Intent.java:3259)
02-01 16:46:57.088: WARN/Bundle(302):     at com.android.phone.PhoneApp
$PhoneAppBroadcastReceiver.onReceive(PhoneApp.java:1677)

Can you help me to understand it?

It should be an integer or a boolean? Where is the mistake?

Thanks, Tams

-- 

3. android plugin for eclipse slow performance

4. Render a PDF in a View

5. Motorola xoom 7.2jt

6. [isat-android] WTA : Masalah pada Angry Birds

7. Video Teaser Samsung Galaxy S2