This is my first time asking for help here. Basically the problem is that I want to show an AlertDialog and then start an activity with an intent. The problem is that the intent starts without showing the AlertDialog and I don’t get why. But if I delete the intent code the alert shows up. Please anyone help me. Thanks.
Tag: android-intent
Android: pass data from initial activity (launching Zxing scanner) to onActivityResult callback
I use the library zxing-android-embedded in my Android App. Before calling initiateScan() method to start the scanner from my activity, I set a class variable scanedItemId to know on which item I clicked to scan: Then I get the result via onActivityResult method. It works well but my class variable scanedItemId is null because the activity is relaunched. Is it
Using Intent.createChooser and getting error: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag
I want to open the share via option from the service class. It is working fine in Android 7, but in 8+ OS it starts showing android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? I have also included this flag to my Intent, but it’s still showing the same
Android Studio mailto Intent doesn’t show subject and mail body
I’m trying to send an e-mail from my Android App. With the click on a button, gmail should open and show a new email with my previously defined recipient, subject and email body. So far I’ve tried sending the Intent.ACTION_VIEW as well as Intent.ACTION_SENDTO. Both show my draft with the recipient only. Both subject and message are being opressed. Weird
android error when select one image not multiple
I am trying to get images from my Gallery and upload them to the server. I want to allow the user to select multiple images from gallery. when I select two or more images it works very well. But when I select one image only it ignore it and return nothing. Here is my code and I am printing message
How to show Heads up notifications android
How to get a heads up notification.With below code i can only see three dots on status bar and a notification in notification bar. Answer I was having the same problem, but I was using the newer NotificationCompat.Builder() call which requires a channel ID from a NotificationChannel. The notification will only appear as a heads-up notification if the NotificationChannel is
Android – Using Shared Preferences in separate class?
I want to save data using Shared Preferences in android. But I am looking to use separate class to do this task. I have implemented that class like below, But there is an error on getActivity(), How to solve this? Thanks Answer getActivity() is a method of Fragment not of your SavePref. In your case the simple fix is to
NullPointerException received when calling Bundle.getParcelable
I have a problem that I am trying to solve for few hours but cannot solve it and I need some help. I am trying to retrieve URL strings from a Login activity and trying to pass it to the Main activity using a parcelable object but I receive NullPointerException on getParcelable method. Following is the code that creates the
Android – How do I detect if user has chosen to share to Facebook or twitter using intent?
I’ve created an application which shares to facebook, twitter etc. But I want to perform different functions dependent on who the user is sharing to, for instance if the user is sharing to Facebook do one thing but if the user shares to twitter do another. How do I do this? My code so far is below: Further explanation of
How to make app wait and then start activity or go back?
I want my activity to show a screen for 3 seconds, then go back to previous screen. But when i use But unfortunately, this does not work. This doesent show the activity waits 3 seconds and goes back. However, i want it to show its contents before going back. How can i do it ? Answer You should remove this