Android MyActivity is different from documentation
See original GitHub issueMy MyActivity.java looks like this.
package com.myapp;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "myapp";
}
}
if I add
import android.os.Bundle; // here
import com.facebook.react.ReactActivity;
// react-native-splash-screen >= 0.3.1
import org.devio.rn.splashscreen.SplashScreen; // here
// react-native-splash-screen < 0.3.1
import com.cboy.rn.splashscreen.SplashScreen; // here
...
@Override
protected void onCreate(Bundle savedInstanceState) {
SplashScreen.show(this, true); //https://github.com/crazycodeboy/react-native-splash-screen/issues/167
super.onCreate(savedInstanceState);
}
app will crash
Issue Analytics
- State:
- Created 5 years ago
- Comments:13
Top Results From Across the Web
Activity - Android Developers
It is possible if a new non-full-sized or transparent activity has focus on top of your activity, another activity has higher position in...
Read more >Difference between document activities and regular activities
Document activities allow multiple instances of the same Activity to exist in different tasks, and therefore there will be multiple ...
Read more >Maps SDK for Android Quickstart - Google Developers
The maps activity file is the main activity for the app, and contains the code to manage and display the map. By default,...
Read more >Activity vs Fragment in Android - Medium
According to the Android Developer's official documentation, ... Fragments cannot live on their own--they must be hosted by an activity or another fragment....
Read more >View activity & file versions - Android - Google Drive Help
To restore recent versions of PDF files, images, and other files, go to drive.google.com on a computer. Version history. Version history for Google...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
So the key is to add also
import android.os.Bundle;
as shown bellow 😉I agree docs could be a bit more clear.
Instead of:
Something like: