How to hide status bar in Android?

Azhar
Updated on 15-Nov-2019 09:46:35

2K+ Views

This example demonstrates how to do I 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.     Step 3 − Add the following code to src/MainActivity.javaimport androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.Window; import android.view.WindowManager; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       requestWindowFeature(Window.FEATURE_NO_TITLE);       getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);       setContentView(R.layout.activity_main);    } }Step 4 − Add the following ... Read More

How to permanently hide Navigation Bar in an Android Activity?

Azhar
Updated on 15-Nov-2019 09:41:31

2K+ Views

This example demonstrates how do I permanently hide Navigation Bar in an Android Activity 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.     Step 3 − Add the following code to src/MainActivity.javaimport androidx.appcompat.app.AppCompatActivity; import android.annotation.SuppressLint; import android.os.Build; import android.os.Bundle; import android.view.View; public class MainActivity extends AppCompatActivity {    private int currentApiVersion;    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);       currentApiVersion ... Read More

How can I get the current Android SDK version programmatically?

Azhar
Updated on 15-Nov-2019 09:36:01

553 Views

This example demonstrates how do I get the current SDK version programmatically.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.     Step 3 − Add the following code to src/MainActivity.javaimport android.os.Build; import android.os.Bundle; import android.widget.TextView; public class MainActivity extends AppCompatActivity {    TextView textView;    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);       textView = findViewById(R.id.textView);       int versionAPI = Build.VERSION.SDK_INT; ... Read More

How to display progress dialog before starting an activity in Android?

Azhar
Updated on 15-Nov-2019 07:16:31

722 Views

This example demonstrates how do I to display progress dialog before starting an activity 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.     Step 3 − Add the following code to src/MainActivity.javaimport androidx.appcompat.app.AppCompatActivity; import android.app.ProgressDialog; import android.os.AsyncTask; import android.os.Bundle; public class MainActivity extends AppCompatActivity {    ProgressDialog progressDialog;    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);       progressDialog = new ProgressDialog(this); ... Read More

How to convert milliseconds to date format in Android?

Azhar
Updated on 15-Nov-2019 07:14:40

2K+ Views

This example demonstrates how do I convert milliseconds to date format 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.     Step 3 − Add the following code to src/MainActivity.javaimport androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.widget.TextView; import java.text.SimpleDateFormat; public class MainActivity extends AppCompatActivity {    TextView textView;    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);       textView = findViewById(R.id.textView);       getDate(); ... Read More

Uri.HexEscape(Char) Method in C#

AmitDiwan
Updated on 14-Nov-2019 06:57:07

90 Views

The Uri.HexEscape() method in C# is used to convert a specified character into its hexadecimal equivalent.SyntaxFollowing is the syntax −public static string HexEscape (char ch);Above, the parameter ch is the character to convert to hexadecimal representation.ExampleLet us now see an example to implement the Uri.HexEscape() method −using System; public class Demo {    public static void Main(){       char ch = 'k';       string res = Uri.HexEscape(ch);       Console.WriteLine("Hexadecimal Equivalent = "+res);    } }OutputThis will produce the following output −Hexadecimal Equivalent = %6BExampleLet us now see another example to implement the Uri.HexEscape() method ... Read More

UInt32.GetHashCode() Method in C# with Examples

AmitDiwan
Updated on 14-Nov-2019 06:56:00

65 Views

The UInt32.GetHashCode() method in C# is used to get the HashCode for the current UInt32 instance.SyntaxFollowing is the syntax −public override int GetHashCode ();ExampleLet us now see an example to implement the UInt32.GetHashCode() method −using System; public class Demo {    public static void Main(){       uint val1 = 100;       uint val2 = UInt16.MinValue;       Console.WriteLine("HashCode for val1 = "+val1.GetHashCode());       Console.WriteLine("HashCode for val2 = "+val2.GetHashCode());    } }OutputThis will produce the following output −HashCode for val1 = 100 HashCode for val2 = 0ExampleLet us now see another example to implement ... Read More

How to change the WindowWidth of the Console in C#?

AmitDiwan
Updated on 14-Nov-2019 06:53:59

68 Views

Use the Console.WindowWidth Property to change the WindowWidth of the Console.ExampleLet us now see an example −using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Demo {    public static void Main (string[] args) {       Console.InputEncoding = Encoding.ASCII;       Console.WriteLine("Input Encoding Scheme = "+Console.InputEncoding);       Console.OutputEncoding = Encoding.ASCII;       Console.WriteLine("Output Encoding Scheme = "+Console.OutputEncoding);       Console.CursorVisible = false;       Console.Write("Cursor is Visible? "+ Console.CursorVisible);       Console.WindowWidth = 30;       Console.Write("WindowWidth = "+Console.WindowWidth);    } } OutputThis will produce the following ... Read More

How to change the WindowTop of the Console in C#?

AmitDiwan
Updated on 14-Nov-2019 06:52:56

63 Views

Use the Console.WindowTop Property to change the WindowTop of the Console in C#.ExampleLet us now see an example −using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Demo {    public static void Main (string[] args) {       Console.InputEncoding = Encoding.ASCII;       Console.WriteLine("Input Encoding Scheme = "+Console.InputEncoding);       Console.OutputEncoding = Encoding.ASCII;       Console.WriteLine("Output Encoding Scheme = "+Console.OutputEncoding);       Console.CursorVisible = false;       Console.Write("Cursor is Visible? "+ Console.CursorVisible);       Console.WindowTop = 40;       Console.Write("WindowTop = "+Console.WindowTop);    } }OutputThis will produce the following ... Read More

UInt32.Equals() Method in C# with Examples

AmitDiwan
Updated on 14-Nov-2019 06:51:30

66 Views

The UInt32.Equals() method in C# returns a value indicating whether this instance is equal to a specified object or UInt32.SyntaxFollowing is the syntax −public override bool Equals (object ob); public bool Equals (uint ob);Above, the parameter ob for the 1st syntax is an object to compare to this instance and the parameter ob for the 2nd syntax is the 32-bit unsigned integer to compare to this instance.ExampleLet us now see an example to implement the UInt32.Equals() method −using System; public class Demo {    public static void Main(){       uint val1 = 52;       uint val2 ... Read More

Advertisements