Use Nested Array in Android ListView

Anuradha Nanda
Updated on 26-Jun-2020 14:04:26

635 Views

This example demonstrate about How to use a nested array in android listview.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 code, we have taken listview to show array values.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.ListView; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; public class MainActivity extends AppCompatActivity {    ListView list; ... Read More

Sort String Array in Android ListView

Fendadis John
Updated on 26-Jun-2020 14:03:51

636 Views

This example demonstrate about How to sort string array in android listview.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 code, we have taken listview to show a sorted arrayStep 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.ListView; import java.util.Arrays; public class MainActivity extends AppCompatActivity {    ListView list;    String[] array = {"2", "5", ... Read More

Reverse Integer Array in Android ListView

Arushi
Updated on 26-Jun-2020 14:02:53

412 Views

This example demonstrate about How to reverse of integer array in android listview.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 code, we have taken listview to show reversed arrayStep 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.ListView; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; public class MainActivity extends AppCompatActivity {    ListView list;    int[] ... Read More

Revolutionize Professions with Drones

Dev Kumar
Updated on 26-Jun-2020 14:02:31

95 Views

Drones are a next-generation technology with far-reaching implications for several industries with a large logistics footprint. As with many other innovations and inventions, drones were also developed by the military specifically for surveillance in sensitive areas. Let's consider the impact of drones on the operations of the security forces especially in a vast country like India with all the challenges that it faces from multiple sources of discord.If we take the LOC (Line of Control) which divides the state of Jammu & Kashmir from those parts of the state that are under the illegal occupation of Pakistan, we find that ... Read More

Print Number of Words in TextView in Android

Vikyath Ram
Updated on 26-Jun-2020 14:02:11

610 Views

This example demonstrate about How to print number of words in textview 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 textview to show paragraph and toast will show the information about number of words.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    TextView ... Read More

Function Level Static Variables Initialization in C/C++

George John
Updated on 26-Jun-2020 13:59:45

846 Views

Static variables can be defined using the static keyword. They are variables that remain in memory while the program is running i.e. their lifetime is the entire program run. This is different than automatic variables as they remain in memory only when their function is running and are destroyed when the function is over.Function-level static variables are created and initialized the first time that they are used although the memory for then is allocated at program load time.A program that demonstrates function-level static variables in C is given as follows −Example Live Demo#include int func() {    static int num = ... Read More

When to Use new Operator in C++

Ankith Reddy
Updated on 26-Jun-2020 13:58:34

8K+ Views

Use of the new operator signifies a request for the memory allocation on the heap. If the sufficient memory is available, it initializes the memory and returns its address to the pointer variable.The new operator should only be used if the data object should remain in memory until delete is called. Otherwise if the new operator is not used, the object is automatically destroyed when it goes out of scope. In other words, the objects using new are cleaned up manually while other objects are automatically cleaned when they go out of scope.The following is the syntax of new operator.pointer_variable ... Read More

Difference Between Pointer and Array in C

Arjun Thakur
Updated on 26-Jun-2020 13:57:26

754 Views

The details about a pointer and array that showcase their difference are given as follows.PointerA pointer is a variable that stores the address of another variable. When memory is allocated to a variable, pointer points to the memory address of the variable. Unary operator ( * ) is used to declare a pointer variable.The following is the syntax of pointer declaration.datatype *variable_name;Here, the datatype is the data type of the variable like int, char, float etc. and variable_name is the name of variable given by user.A program that demonstrates pointers is given as follows.Example Live Demo#include int main () { ... Read More

Calling Class Method Through Null Class Pointer in C++

Arjun Thakur
Updated on 26-Jun-2020 13:51:40

487 Views

A class method can be can be called using a NULL class pointer.Note − This is undefined behaviour and there is not guarantee about the execution of the program. The actual results depend on the compiler used.A program that demonstrates this is given as follows.Example Live Demo#include using namespace std; class Example {    public :    void func() {       cout func();    return 0; }OutputThe output of the above program is as follows.The function is called through Null class pointer.Now, let us understand the above program.The class Example contains a member function func(). This function displays ... Read More

Convert UTF-8 to Unicode in Java

Krantik Chavan
Updated on 26-Jun-2020 13:46:57

6K+ Views

Before moving onto their conversions, let us learn about Unicode and UTF-8.Unicode is an international standard of character encoding which has the capability of representing a majority of written languages all over the globe. Unicode uses hexadecimal to represent a character. Unicode is a 16-bit character encoding system. The lowest value is \u0000 and the highest value is \uFFFF.UTF-8 is a variable width character encoding. UTF-8 has the ability to be as condense as ASCII but can also contain any unicode characters with some increase in the size of the file. UTF stands for Unicode Transformation Format. The '8' signifies ... Read More

Advertisements