How to open recent activity after app reopen in android studio For Example, we create a book application Then after reopening the app, open the last page where we are Answer Create a Default activity as a launcher activity `public class Default extends AppCompatActivity { }` //In MainActivity while saving preferences use: `public class MainActivity extends AppCompatActivity { }` //In
Tag: android-activity
Activity or Fragment for a SearchView?
I´m doing my final degree project and I have chose to develop and Android app using Firebase Firestore, the idea it´s cool because I´m learning how to program on Android, but on Java. So, I have …
java.lang.IllegalArgumentException: Ilegal value, when I try to pass object via bundle
I’m trying to pass an object from the class “Transfer” (java) to the class “Limit” (Kotlin), if I try to get the values that come through the “Bundle” using data.name, the compiler does not give an error, but when I enter in the activity of this problem, how can I get an object via Bundle () in my intent? OUTPUT
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 …
Why in Android documentation Activity classes have static modifier
If we open android documentation we will see that Activity classes have static modifier: public static class MainActivity extends Activity {…} I’m used to declaring Activities without static …
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
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 protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); …
How to use interface to communicate between two activities
I am trying to make listener interface between two activities Act1 and Act2. Act1 will start Act2. If there is some event occurred in Act2, it will inform it to Act1. Problem is that I am starting new activity using Intent, so how Act1 will assign itself as listener to Act2’s interface? Act1.java Act2.java Note: Please don’t suggest me to