To start Quiz click on Java Quiz 1
Posts
Custom Buttons in Android
- Get link
- X
- Other Apps
Android applications make use of so many UI components, out of those some can be customized as per our need. In this tutorial, we will learn about custom Buttons in very few steps. Two shapes we will see in this Tutorial. 1. Rounded Corner Button 2. Circle Shape Button. First of all, we will see how to create rounded corner Button Step 1: After creating Android Project create XML file under res => drawable folder and give a name rounded_corner_bg.xml and paste below code. <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" android:padding="10dp"> <!-- you can use any color you want --> <solid android:color="#00BCD4"/> <corners android:radius="40dp"/> </shape> Step 2: Open activity_main.xml file and paste below code <?xml version="1.0" encoding="utf-8"?> ...
Time Picker in Android.
- Get link
- X
- Other Apps
Welcome to AndroidEasy. Today we will see how to create TimePicker in android application in easiest way. Step 1: Create a new project in Android Studio.( Select File ⇒ New ⇒ Android Project and give activity name as Time Picker . ) Step 2: Open timePicker_activity.xml file and Paste below code into it. <? xml version="1.0" encoding="utf-8" ?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".MainActivity"> <TimePicker ...
Create an android app that demonstrates Activity Lifecycle and Instance State.
- Get link
- X
- Other Apps
In this tutorial we will see the working of Activity lifecycle step by step. Activity life cycle consists of 7 methods as below. onCreate() - Invoked when Activity is created. onStart() - Invoked when Activity is becoming visible. onResume() - Invoked when Activity starts Interacting with user. onPause() - Invoked when Activity is invisible to user onStop() - Invoked when activity is no longer visible. onRestart() - Invoked after your activity is stopped, prior to start. onDestroy() - Invoked before Activity is killed. Let's begin coding .... 💻💻 Step 1: After creating Android project, open activity_main.xml file and paste below code as it is. activity_main.xml <?xml version="1.0" encoding="utf-8" ?> <android.support.constraint.ConstraintLayout xmlns:andr...
Create android app that demonstrates working with TextView elements.
- Get link
- X
- Other Apps
In this tutorial we will see some TextView properties to create custom TextViews in android. We are going to use three TextViews and will apply different styles to them in this project. Step 1:create new project in android studio == >new ==>new project ==>select EmptyActivity ==>click next ==>finish Step 2: Open activity_main.xml file and paste below code. <? xml version= "1.0" encoding= "utf-8" ?> < LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" xmlns: app = "http://schemas.android.com/apk/res-auto" xmlns: tools = "http://schemas.android.com/tools" android :layout_width= "match_parent" android :layout_height= "match_parent" android :gravity= "center" android :orientation= "vertical" ...
Check Internet connectivity in android
- Get link
- X
- Other Apps
Many applications connect to Internet to perform certain tasks, so in this tutorial we will see how to create a java class to check the internet connection of mobile. So lets begin. Step 1- we nee d to provide permission in manifest file. < manifest > < uses-permission android :name= "android.permission.INTERNET" /> < uses-permission android :name= "android.permission.ACCESS_NETWORK_STATE" /> < application... ............... </ activity > </ manifest > Step 2- create below function after onCreate() method to check Internet connection. protected boolean isOnline() { ConnectivityManager cm = (ConnectivityManager) getSystemService (Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = cm.getActiveNetworkInfo(); if (netInfo != null && netInfo.isConnectedOrConnecting()) ...