Store and Read List from TXT File in Android

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:25

1K+ Views

This example demonstrates How to store list in a txt file and read list from txt file 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 editext and button. When the user clicks on the button, it will take data from edit text and store in internal storage as /data/data//files/text/sample.txt. It going to append ... Read More

Use TreeSet in Android

Nishtha Thakur
Updated on 30-Jul-2019 22:30:25

403 Views

This example demonstrates about How to use Tree set in AndroidStep 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 the name and record number as Edit text, when the user clicks on save button it will store the data into ArrayList. Click on the refresh button to get the ... Read More

Use compareTo in Android TextView

Anvi Jain
Updated on 30-Jul-2019 22:30:25

292 Views

This example demonstrate about How to use compareTo () in Android textview.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 name as Edit text, when user click on button it will take data and compare with sairam string.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.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; ... Read More

Get Day of Month, Day of Year and Day of Week in Android Using OffsetDateTime API

Nishtha Thakur
Updated on 30-Jul-2019 22:30:25

942 Views

This example demonstrate about How to get day of month, day of year and day of week in android using offset date time API class.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 day of month, day of year and day of the week.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 ... Read More

LocalTime Parse Method in Java

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25

167 Views

The LocalTime instance can be obtained from a string value using the parse() method in the LocalTime class in Java. This method requires a single parameter i.e. the string which is to be parsed. This string cannot be null. Also, it returns the LocalTime instance obtained from the string value that was passed as a parameter.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Demo {    public static void main(String[] args) {       LocalTime lt = LocalTime.parse("23:15:30");       System.out.println("The LocalTime is: " + lt);    } }OutputThe LocalTime is: 23:15:30Now ... Read More

Revert Rows to Default Column Value in MySQL

George John
Updated on 30-Jul-2019 22:30:25

230 Views

To revert rows to default column value, let us first create a demo tablemysql> create table defaultDemo    -> (    -> Id int    -> ); Query OK, 0 rows affected (0.48 sec)Insert some records in the table using insert command.The query is as followsmysql> insert into defaultDemo values(10); Query OK, 1 row affected (0.25 sec) mysql> insert into defaultDemo values(20); Query OK, 1 row affected (0.13 sec) mysql> insert into defaultDemo values(30); Query OK, 1 row affected (0.14 sec) mysql> insert into defaultDemo values(40); Query OK, 1 row affected (0.11 sec) mysql> insert into defaultDemo values(80); Query OK, ... Read More

Convert String to IntStream in Java

Nancy Den
Updated on 30-Jul-2019 22:30:25

361 Views

If you have a string and you want to convert it into IntStream with ASCII values, then it can be easily achieved using the below code.To work with IntStream class, you need to import the following package:import java.util.stream.IntStream;Let’s say the following is our string:String str = "Benz";Convert the above string to IntStream:IntStream stream = str.chars();The following is an example to convert String to IntStream in Java:Example Live Demoimport java.util.stream.IntStream; public class Demo {    public static void main(String[] args) {       String str = "Benz";       System.out.println("String to be converted = " + str);       ... Read More

Function Overloading and Return Type in C++

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25

2K+ Views

You can have multiple definitions for the same function name in the same scope. The definition of the function must differ from each other by the types and/or the number of arguments in the argument list. You cannot overload function declarations that differ only by return type.The function overloading is basically the compile time polymorphism. It checks the function signature. If the signatures are not same, then they can be overloaded. The return type of a function does not create any effect on function overloading. Same function signature with different return type will not be overloaded.Following is the example where ... Read More

Scan WiFi Networks Programmatically in Android

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25

2K+ Views

This example demonstrate about How to scan wifi networks 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.javapackage com.example.myapplication; import android.Manifest; import android.content.Context; import android.content.IntentFilter; import android.content.pm.PackageManager; import android.net.wifi.WifiManager; import android.os.Build; import android.support.annotation.NonNull; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ListView; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    private ListView wifiList; ... Read More

How to Trade Your Cryptocurrency

Prasanna Kotamraju
Updated on 30-Jul-2019 22:30:25

171 Views

When you talk about trading of Cryptocurrency, the following transactions will come under that category.Buying new cryptocurrency using your fiat currencySelling your cryptocurrency for fiat currencyExchanging one type of cryptocurrency for another digital currencyTo make these transactions, there are Cryptocurrency Exchanges.If you just want to make the occasional, straightforward trade, there are also platforms that you can use that do not require an account.Cryptocurrency ExchangeThese are the websites which allow you to buy, sell or exchange the digital currency. All you have to do is to choose an exchange, create an account and get your id verified, and you are ... Read More

Advertisements