ListView Recycling Mechanism on Android Using Kotlin

Azhar
Updated on 28-Nov-2020 10:47:59

250 Views

This example demonstrates how to show the working of ListView's recycling mechanism on Android Kotlin.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.ktimport android.os.Bundle import android.view.* import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView class MainActivity : AppCompatActivity() {    private lateinit var cities:ArrayList    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)       setContentView(R.layout.activity_main)       title ... Read More

Custom Adapter for List View in Android using Kotlin

Azhar
Updated on 28-Nov-2020 08:37:42

6K+ Views

This example demonstrates how to write a custom adapter for my list view on Android using Kotlin.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.ktimport android.content.Context import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.BaseAdapter import android.widget.ListView import android.widget.TextView import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() {    lateinit var listView: ListView    var arrayList: ArrayList = ArrayList()    var adapter: MyAdapter? = ... Read More

Show Current Progress While Downloading a File in Android App Using Kotlin

Azhar
Updated on 28-Nov-2020 08:27:57

615 Views

This example demonstrates how to show current progress while downloading a file on Android App using Kotlin.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.ktimport android.os.Bundle import android.view.View import android.webkit.WebView import android.widget.ProgressBar import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() {    lateinit var webView: WebView    lateinit var progressBar: ProgressBar    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)     ... Read More

Crop Circular Area from Bitmap in Android using Kotlin

Azhar
Updated on 28-Nov-2020 08:21:49

787 Views

This example demonstrates how to crop a circular area from bitmap in Android using Kotlin.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.ktimport android.graphics.* import android.os.Bundle import android.widget.Button import android.widget.ImageView import androidx.appcompat.app.AppCompatActivity import kotlin.math.min class MainActivity : AppCompatActivity() {    lateinit var button: Button    lateinit var imageView: ImageView    lateinit var bitmap: Bitmap    override fun onCreate(savedInstanceState: Bundle?) ... Read More

Datagram Network

Moumita
Updated on 28-Nov-2020 08:16:32

33K+ Views

In a connectionless communication systems, datagram refers to the smallest unit via which data is transmitted. Datagrams are data packets which contain adequate header information so that they can be individually routed by all intermediate network switching devices to the destination. These networks are called datagram networks since communication occurs via datagrams. They exist in packet switching networks.Features of Datagram NetworksDatagram switching is done at the network layer of the communication system.In datagram networks, each data packet or datagram is routed independently from the source to the destination even if they belong to the same message. The network treats the ... Read More

Routing Within a Datagram Network

Moumita
Updated on 28-Nov-2020 08:15:34

2K+ Views

In packet switching networks using datagrams, datagrams are data packets which contain adequate header information so that they can be individually routed by all intermediate switching devices to the destination. These networks are called datagram networks since communication occurs via datagrams.Routing PrincipleIn datagram networks, each data packet is routed independently from the source to the destination even if they belong to the same message. No prior resource or channel allocation is done for the individual packets. As the datagrams are treated as independent units, no dedicated path is fixed for data transfer. Each datagram is routed by the intermediate routers ... Read More

Store and Forward Packet Switching

Moumita
Updated on 28-Nov-2020 08:14:15

19K+ Views

In telecommunications, store − and − forward packet switching is a technique where the data packets are stored in each intermediate node, before they are forwarded to the next node. The intermediate node checks whether the packet is error−free before transmitting, thus ensuring integrity of the data packets. In general, the network layer operates in an environment that uses store and forward packet switching.Working PrincipleThe node which has a packet to send, delivers it to the nearest node, i.e. router. The packet is stored in the router until it has fully arrived and its checksum is verified for error detection. ... Read More

Network Layer Design Issues

Moumita
Updated on 28-Nov-2020 08:12:16

53K+ Views

The network layer or layer 3 of the OSI (Open Systems Interconnection) model is concerned delivery of data packets from the source to the destination across multiple hops or links. It is the lowest layer that is concerned with end − to − end transmission. The designers who are concerned with designing this layer needs to cater to certain issues. These issues encompasses the services provided to the upper layers as well as internal design of the layer.The design issues can be elaborated under four heads −Store − and − Forward Packet SwitchingServices to Transport LayerProviding Connection Oriented ServiceProviding Connectionless ... Read More

Functions of the Network Layer

Moumita
Updated on 28-Nov-2020 08:11:25

22K+ Views

The main function of the network layer or layer 3 of the OSI (Open Systems Interconnection) model is delivery of data packets from the source to the destination across multiple hops or links. It also controls the operation of the subnet.The functions are elaborated as below −When data is to be sent, the network layer accepts data from the transport layer above, divides and encapsulates it into packets and sends it to the data link layer. The reverse procedure is done during receiving data.The network layer is responsible for routing packets from the source host to the destination host. The ... Read More

The Computer Network Layer

Moumita
Updated on 28-Nov-2020 08:11:02

1K+ Views

The network layer or Layer 3 of the OSI (Open Systems Interconnection) model is responsible for the source to destination delivery of data packets across multiple hops or nodes. It controls the operation of the subnet.The position of the network layer in the OSI model is depicted in the following diagram −Functions of the Network LayerThe network layer is responsible for routing packets from the source host to the destination host. The routes can be based upon static tables that are rarely changed; or they can be automatically updated depending upon network conditions.Many networks are partitioned into sub-networks or subnets. ... Read More

Advertisements