Found 1966 Articles for Apps/Applications

How to disable ScrollView Programmatically in Android?

Azhar
Updated on 22-Nov-2019 09:14:54

2K+ Views

This example demonstrates how to do I disable ScrollView programmatically 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.                                                                                                           ... Read More

How to check the system version of Android?

Azhar
Updated on 22-Nov-2019 09:14:14

232 Views

This example demonstrates how to do I check the system version 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.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);       double ... Read More

How to disable Home and other system buttons in Android?

Azhar
Updated on 22-Nov-2019 09:13:01

1K+ 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.View; import java.util.Timer; import java.util.TimerTask; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);    }    @Override    public void onWindowFocusChanged(boolean hasFocus) {       super.onWindowFocusChanged(hasFocus);   ... Read More

How to retrieve shared preferences of other application in Android?

Azhar
Updated on 22-Nov-2019 09:12:19

730 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.content.Context; import android.content.SharedPreferences; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    EditText etName, etEmail;    SharedPreferences sharedPreferences;    public static final String myPreference = "myPref";    public static final ... Read More

How to get the distance between two geographic locations in Android?

Azhar
Updated on 22-Nov-2019 09:11:33

1K+ Views

This example demonstrates how do I get the distance between two geographic locations 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.location.Location; 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);     ... Read More

How to read a simple text file in Android App?

Azhar
Updated on 22-Nov-2019 09:09:58

4K+ Views

This example demonstrates how do I read a simple text file in the android app.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Create a new Android Resource directory (raw.xml) and add a text file in the res/rawStep 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.View; import android.widget.TextView; import android.widget.Toast; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class MainActivity extends AppCompatActivity ... Read More

How to add calendar events in Android App?

Azhar
Updated on 22-Nov-2019 09:08:12

2K+ Views

This example demonstrates how do I add calendar events 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.content.Intent; import android.os.Bundle; import android.view.View; import java.util.Calendar; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);    }    public void AddCalendarEvent(View view) {       ... Read More

How to call an activity method from a fragment in Android App?

Azhar
Updated on 22-Nov-2019 09:07:12

5K+ Views

This example demonstrates how do I call an activity method from a fragment 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 androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentTransaction; import android.os.Bundle; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);       FragmentManager fragmentManager = getSupportFragmentManager();     ... Read More

How to iterate a JSON Array in Android?

Azhar
Updated on 22-Nov-2019 09:06:26

910 Views

This example demonstrates how do I iterate JSON Array 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 org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; public class MainActivity extends AppCompatActivity {    TextView textView;    String strJson = "{ \"Employee\" :[{\"ID\":\"01\", \"Name\":\"Sam\", \"Salary\":\"50000\"}, "       + "{\"ID\":\"02\", \"Name\":\"Shankar\", \"Salary\":\"60000\"}] }";    @Override    protected void onCreate(Bundle ... Read More

How should I validate an e-mail address in Android?

Azhar
Updated on 22-Nov-2019 09:05:43

141 Views

This example demonstrates how do I validate an email address 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.View; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    EditText editText;    String email;    String emailPattern = "[a-zA-Z0-9._-]+@[a-z]+\.+[a-z]+";    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       ... Read More

Advertisements