Snippets tagged “android”
21 snippets use this tag.
- Android changing Floating Action Button colorJava
To change the color of a Floating Action Button (FAB) in Android, you can use the setBackgroundTintList() method and pass it a color state list.
- android on Text Change ListenerJava
In Android, you can use a TextWatcher to listen for changes to the text in a TextView or EditText view.
- Download a file with Android, and showing the progress in a ProgressDialogJava
To download a file with Android and show the progress in a ProgressDialog, you can use the following steps:
- Getting java.net.SocketTimeoutException: Connection timed out in androidJava
The java.net.SocketTimeoutException: Connection timed out error usually occurs when a client is trying to connect to a server, but the connection request is taking too long to complete.
- How can I fix 'android.os.NetworkOnMainThreadException'?Java
The android.os.NetworkOnMainThreadException is a runtime exception that is thrown when an application attempts to perform a networking operation on the main thread.
- How set background drawable programmatically in AndroidJava
To set a background drawable programmatically in Android, you can use the setBackgroundDrawable method of the View class.
- how to add button click event in android studioJava
To add a button click event in Android Studio, follow these steps:
- How to call a method after a delay in AndroidJava
To call a method after a delay in Android, you can use the Handler class and the postDelayed() method. The postDelayed() method takes a Runnable and a delay in milliseconds as arguments, and it runs the Runnable after the specified delay.
- How to call a SOAP web service on AndroidJava
To call a SOAP web service on Android, you can use the HttpURLConnection class to send an HTTP request to the web service and receive the response.
- How to check internet access on Android? InetAddress never times outJava
To check for internet access on Android, you can use the isReachable() method of the InetAddress class.
- How to create RecyclerView with multiple view typesJava
To create a RecyclerView with multiple view types in Android, you will need to use a RecyclerView.Adapter that supports multiple view types.
- How to get current location in AndroidJava
To get the current location in Android, you can use the LocationManager class and the LocationProvider interface.
- How to launch an Activity from another Application in AndroidJava
To launch an activity from another application in Android, you can use an Intent with the FLAG_ACTIVITY_NEW_TASK flag set.
- How to pass an object from one activity to another on AndroidJava
There are several ways you can pass an object from one activity to another on Android:
- How to print to the console in Android Studio?Java
To print to the console in Android Studio, you can use the Log class from the android.util package.
- How to set selected item of Spinner by value, not by position?Java
To set the selected item of a Spinner by value (not by position) in Android, you can use the setSelection() method of the Spinner class and pass it the index of the item that you want to select.
- Is there a way to run Python on Android?Python
Yes, there are several ways to run Python on Android:
- Read/Write String from/to a File in AndroidJava
To read and write a string from and to a file in Android, you can use the FileInputStream and FileOutputStream classes along with the InputStreamReader and OutputStreamWriter classes.
- Sending Email in Android using JavaMail API without using the default/built-in appJava
To send an email in Android using the JavaMail API without using the default/built-in app, you can use the following steps:
- Unfortunately MyApp has stopped. How can I solve this?Java
If you are seeing the error "Unfortunately, MyApp has stopped," it means that your Android app has crashed. This can be caused by a number of factors, including:
- Using context in a fragmentJava
To use context in a fragment, you will need to provide enough information within the fragment itself for the reader to understand the context.