Found 2041 Articles for Mobile Development

How to pass an image from one activity another activity in Android?

Azhar
Updated on 22-Nov-2019 09:15:35

4K+ Views

This example demonstrates how to do I pass an image from one Activity 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; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);    }    public void SendImage(View view) {   ... Read More

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 do I delete SharedPreferences data for my Android App?

Azhar
Updated on 22-Nov-2019 09:10:49

197 Views

This example demonstrates how do I delete SharedPreferences data for my 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.Step 2 − Add the following code to res/layout/activity_main.xml.             Step 3 − Add the following code to res/strings.xml    Sample    player_name    country_name Step 4 − 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.Button; import android.widget.TextView; public class MainActivity extends AppCompatActivity {    TextView textView, tvAfterDelete; ... 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

Advertisements