-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Android Application Development Cookbook
By :

This is a simple recipe, but one that is very common and will probably be included in every Internet application you build: checking online status. While checking online status, we can also check the connection type: WIFI or MOBILE.
Create a new project in Android Studio and call it isOnline
. Use the default Phone & Tablet option and select Empty Activity when prompted for Activity Type.
First, we need to add the necessary permissions to access the network. Then, we'll create a simple layout with a Button
and TextView
. To get started, open the Android Manifest and follow these steps:
Add the following permissions:
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Open the activity_main.xml
file and replace the existing TextView
with the following views:
<TextView android:id="@+id/textView" android:layout_width=...
Change the font size
Change margin width
Change background colour