Found 1626 Articles for Android

How do I get the dialer to open with phone number displayed in Android?

Azhar
Updated on 07-Jul-2020 13:49:13

2K+ Views

This example demonstrates how do I get the dialer to open with the open number displayed 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.net.Uri; 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 ShowDialer(View ... Read More

How to convert Image into base64 String in Android?

Azhar
Updated on 07-Jul-2020 13:15:14

2K+ 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.annotation.SuppressLint; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.util.Base64; import android.widget.TextView; import java.io.ByteArrayOutputStream; public class MainActivity extends AppCompatActivity {    TextView textView;    @SuppressLint("WrongThread")    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);       textView = ... Read More

How to clear an ImageView in Android?

Azhar
Updated on 07-Jul-2020 13:16:01

1K+ Views

This example demonstrates how do I clear an imageview 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.

How to set dialog to show with full screen in Android?

Azhar
Updated on 07-Jul-2020 13:16:44

1K+ Views

This example demonstrates how do I set the dialog to show with full screen 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.app.Dialog; 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 ClickHere(View view) {     ... Read More

How do I get the height and width of the Android Navigation Bar programmatically?

Azhar
Updated on 07-Jul-2020 13:17:19

1K+ Views

This example demonstrates how do I get the height and width of the android navigation bar 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.javaimport androidx.appcompat.app.AppCompatActivity; import android.content.res.Resources; import android.os.Bundle; import android.widget.TextView; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);       TextView textView = findViewById(R.id.textView);     ... Read More

How to check whether a headset is plugged into an Android device?

Azhar
Updated on 07-Jul-2020 13:04:53

1K+ Views

This example demonstrates how do I check whether a headset is plugged into an android device.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.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    BroadcastReceiver broadcastReceiver;    boolean Microphone_Plugged_in = false;    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);   ... Read More

How to run a method every 10 seconds in Android?

Azhar
Updated on 07-Jul-2020 13:07:01

9K+ Views

This example demonstrates how do I run a method every 10 seconds 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.os.Handler; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    Handler handler = new Handler();    Runnable runnable;    int delay = 10000;    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main); ... Read More

How to bring an activity to foreground i.e. top of stack in Android?

Azhar
Updated on 07-Jul-2020 13:08:06

3K+ Views

This example demonstrates how do I bring an activity to the foreground (top of stack) 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; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);       Intent i = new Intent(this, MyActivity.class);       i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); ... Read More

BareCode scanning in Android?

Azhar
Updated on 07-Jul-2020 13:08:51

1K+ Views

This example demonstrates how do I use barcode scanning 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 dependency in Gradleimplementation 'com.google.zxing:core:3.2.1' implementation 'com.journeyapps:zxing-android-embedded:3.2.0@aar'Step 4 − Add the following code to src/MainActivity.javaimport androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import com.google.zxing.integration.android.IntentIntegrator; import com.google.zxing.integration.android.IntentResult; public class MainActivity extends AppCompatActivity {    Button btnBarcode;    TextView textView; ... Read More

How to determine if network type (2G, 3G or 4G) in Android?

Azhar
Updated on 25-Oct-2019 08:58:41

855 Views

This example demonstrates how do I determine if network type (2G, 3G, 4G) 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.os.Bundle; import android.telephony.TelephonyManager; import android.widget.Toast; import java.util.Objects; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);       getNetworkClass(getApplicationContext());    }    public ... Read More

Advertisements