- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 34486 Articles for Programming
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
220 Views
Before getting into listview example, we should know about listview, Listview is a collection of items pulled from arraylist, list or any databases. Most uses of listview is a collection of items in vertical format, we can scroll up/down and click on any item. Here is the simple solution to avoid Background ListView becomes black when scrolling. 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. ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
13K+ Views
An intent is to perform an action on the screen. It is mostly used to start activity, send broadcast receiver, start services and send message between two activities. There are two intents available in android as Implicit Intents and Explicit Intents. Here is a sample example to start new activity with old activity.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. (First Activity layout) Step 3 − Create a new ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
16K+ Views
Before getting into types of intent, we should know what is an intent?. Intent is to perform an action. It is mostly used to start activity, send broadcast receiver, start services and send message between two activities. There are two intents available in android as Implicit Intents and Explicit Intents.Explicit Intent − It going to connect the internal world of an application such as start activity or send data between two activities. To start new activity we have to create Intent object and pass source activity and destination activity as shown below −Intent send = new Intent(MainActivity.this, SecondActivity.class); startActivity(send);And we ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
7K+ Views
Spinner is just like a drop down button, using this button we can select a item from set of items. This example demonstrate about how to add items to a spinner 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.java.import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.MotionEvent; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Spinner; import android.widget.Toast; import java.util.ArrayList; public class MainActivity ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
2K+ Views
Using serialization, we can pass object's state or array between two activities. Before getting into the code, we should know about serialization and how does it work with intent in android.Serialization is a marker interface. Using serialization, we can convert state of an object into a byte stream. The byte stream is a platform independent, so it's going to work on the JVM and other platforms. Here is the example to send an object between two activities.Step 1 − Create a new project in Android Studio, Go to File ⇒ New Project and fill all required details to create a ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
38 Views
The usleep() function delays execution of the current script for few microseconds.Syntaxusleep(msec)Parametersmsec − The number of microseconds to delay the script.ReturnThe usleep() function returns nothing.Example Live DemoOutputThe following is the output.03:06:08 03:06:10 03:06:15
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
391 Views
The unpack() function unpacks data from a binary string.Syntaxunpack(format, data)Parametersformat − The format to use. Here are the possible valuesa −NUL-padded stringA − SPACE-padded stringh − Hex string, low nibble firstH − Hex string, high nibble firstc − signed charC −unsigned chars − signed short (always 16 bit, machine byte order)S − unsigned short (always 16 bit, machine byte order)n − unsigned short (always 16 bit, big endian byte order)v − unsigned short (always 16 bit, little endian byte order)i − signed integer (machine dependent size and byte order)I − unsigned integer (machine dependent size and byte order)l − signed ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
237 Views
The uniqid() function generates a unique ID based on the current time in microseconds.Syntaxuniqid(prefix, more_entropy)Parametersprefix − The prefix to the unique ID.more_entropy − The more entropy at the end of the return value.ReturnThe uniqid() function returns unique identifiers as string.Example Live DemoOutputThe following is the output.5bfd5bd045faa
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
84 Views
The time_sleep_until() function delays execution of the current script until the specified time. Syntax time_sleep_until(time) Parameters time − The time until execution will delay. Return The time_sleep_until() function returns true on success. Example The execution of the above script is now delayed for 15 seconds.
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
38 Views
The time_nanosleep() function delays execution of the current script for few seconds and nanoseconds.Syntaxtime_nanosleep(sec, nsec)Parameterssec − The number of seconds to delay the script.nsec − The number of nanoseconds to delay the script.ReturnThe time_nanosleep() function returns true on success.Example Live DemoOutputThe following is the output.02:57:04 02:57:06 02:57:08