Find and Edit Text Values Starting from Alphabet in Android

Ankith Reddy
Updated on 26-Jun-2020 14:45:20

382 Views

This example demonstrate about How to find edit text values start from Alphabet or Not.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.         In the above code, we have taken edit text and button view to verify edit text data is starting with Alphabet.Step 3− Add the following code to java/MainActivity.xmlpackage com.example.myapplication; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends AppCompatActivity { ... Read More

Check Activity in Portrait Mode

George John
Updated on 26-Jun-2020 14:44:22

196 Views

This example demonstrate about How to check activity In portrait mode.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken a text view to show mode name.Step 3− Add the following code to java/MainActivity.xmlpackage com.example.myapplication; import android.content.res.Configuration; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.TextView; public class MainActivity extends AppCompatActivity {    TextView conf;    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState); ... Read More

Validate IP Address in C#

Arjun Thakur
Updated on 26-Jun-2020 14:43:52

2K+ Views

An IP Address is an Internet Protocol address that is a series of numbers assigned to each device on a computer network. In C#, the class IPAddress class in the namespace System.Net deals with IP addresses.A program that is used to validate an IP address is given as follows −Example Live Demousing System; using System.Net; using System.Net.Sockets; using System.Text.RegularExpressions; namespace IPaddressDemo {    class Example {       public static void Main() {          IPAddress IP;          Console.WriteLine("Enter the IP Address: ");          string ipAddr = Console.ReadLine();         ... Read More

Return All System Properties in Java

Samual Sam
Updated on 26-Jun-2020 14:43:51

2K+ Views

To return all the system properties in Java, firstly use the System.getProperties() method.java.util.Properties prop = System.getProperties();After that, use the list() method to list all of them.prop.list(System.out);Example Live Demopublic class MainClass {     public static void main(String[] args) {        java.util.Properties prop = System.getProperties();        prop.list(System.out);     } }Outputjava.runtime.name=OpenJDK Runtime Environment sun.boot.library.path=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0... java.vm.version=25.141-b16 java.vm.vendor=Oracle Corporation java.vendor.url=http://java.oracle.com/ path.separator=: java.vm.name=OpenJDK 64-Bit Server VM file.encoding.pkg=sun.io user.country=US sun.java.launcher=SUN_STANDARD sun.os.patch.level=unknown java.vm.specification.name=Java Virtual Machine Specification user.dir=/home/cg/root/3757524 java.runtime.version=1.8.0_141-b16 java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment java.endorsed.dirs=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0... os.arch=amd64 java.io.tmpdir=/tmp line.separator= java.vm.specification.vendor=Oracle Corporation os.name=Linux sun.jnu.encoding=UTF-8 java.library.path=/home/cg/root/GNUstep/Library/Librari... java.specification.name=Java Platform API Specification java.class.version=52.0 sun.management.compiler=HotSpot 64-Bit Tiered Compilers os.version=3.10.0-862.9.1.el7.x86_64 user.home=? user.timezone= java.awt.printerjob=sun.print.PSPrinterJob file.encoding=UTF-8 java.specification.version=1.8 user.name=? java.class.path=/home/cg/root/GNUstep/Library/Librari... java.vm.specification.version=1.8 sun.arch.data.model=64 java.home=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0... sun.java.command=MainClass java.specification.vendor=Oracle Corporation user.language=en ... Read More

Check Activity in Landscape Mode

Arjun Thakur
Updated on 26-Jun-2020 14:43:16

469 Views

This example demonstrate about How to check activity In landscape mode.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken a text view to show mode name.Step 3− Add the following code to java/MainActivity.xmlpackage com.example.myapplication; import android.content.res.Configuration; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.TextView; public class MainActivity extends AppCompatActivity {    TextView conf;    @Override    protected void onCreate(Bundle savedInstanceState) {       ... Read More

Access Array Elements Using Pointer Notation in C#

Ankith Reddy
Updated on 26-Jun-2020 14:43:07

856 Views

Usage of pointers in C# require the unsafe modifier. Also array elements can be accessed using pointers using the fixed keyword. This is because the array and the pointer data type are not the same. For example: The data type int[] is not the same as int*.A program that demonstrates accessing array elements using pointers is given as follows.Exampleusing System; namespace PointerDemo {    class Example {       public unsafe static void Main() {          int[] array = {55, 23, 90, 76, 9, 57, 18, 89, 23, 5};          int n = ... Read More

Get SIM Service Information in Android

Arjun Thakur
Updated on 26-Jun-2020 14:42:03

522 Views

This example demonstrate about How to get Sim service information in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken a text view to show sim service information.Step 3 − Add the following code to java/MainActivity.xmlpackage com.example.myapplication; import android.Manifest; import android.content.Context; import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.RequiresApi; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AppCompatActivity; import android.telephony.TelephonyManager; import android.widget.TextView; import static android.Manifest.permission.ACCESS_COARSE_LOCATION; import ... Read More

C# Program to Perform Quick Sort Using Recursion

George John
Updated on 26-Jun-2020 14:41:50

5K+ Views

Quick Sort is a sorting algorithm that uses the divide and conquer method. It takes a pivot element and places it in its correct position. Then the array to the left and right of the pivot element are again sorted using Quick Sort. This is done until the whole array is sorted.A program that demonstrates Quick Sort using Recursion in C# is given as follows −Example Live Demousing System; namespace QuickSortDemo {    class Example {       static public int Partition(int[] arr, int left, int right) {          int pivot;          pivot = ... Read More

Get Signal Strength in Android

Ankith Reddy
Updated on 26-Jun-2020 14:40:41

3K+ Views

This example demonstrate about How to get signal strength in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken a text view to show signal strength information.Step 3 − Add the following code to java/MainActivity.xmlpackage com.example.myapplication; import android.Manifest; import android.content.Context; import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.RequiresApi; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AppCompatActivity; import android.telephony.TelephonyManager; import android.widget.TextView; import static android.Manifest.permission.ACCESS_COARSE_LOCATION; import static ... Read More

Replace First Occurrence of a Character in Java

karthikeya Boyini
Updated on 26-Jun-2020 14:40:01

8K+ Views

To replace the first occurrence of a character in Java, use the replaceFirst() method.Here is our string.String str = "The Haunting of Hill House!";Let us replace the first occurrence of character “H”str.replaceFirst("(?:H)+", "B");The following is the complete example.Example Live Demopublic class Demo {     public static void main(String[] args) {        String str = "The Haunting of Hill House!";        System.out.println("String: "+str);        String res = str.replaceFirst("(?:H)+",  "B");        System.out.println("String after replacing a character's first occurrence: "+res);     } }OutputString: The Haunting of Hill House! String after replacing a character's first occurance: The Baunting of Hill House!Read More

Advertisements