Open ijry opened 6 years ago
@ijry I believe you should add this yourself. Mine did not have an onCreate method either but, following the installation guide:
...
import org.devio.rn.splashscreen.SplashScreen; // import this
import android.os.Bundle; // import this
public class MainActivity extends ReactActivity {
// I added this method myself
@Override
protected void onCreate(Bundle savedInstanceState) {
SplashScreen.show(this);
super.onCreate(savedInstanceState);
}
...
I am also having this issue. I have tried adding onCreate() myself. I tried removing onNewIntent() method and keeping both but neither worked.
I dont have this code too. And app is not launching if I add this code.
Working example of MainActivity.java
package com.myapp
import android.os.Bundle;
import com.facebook.react.ReactActivity;
import org.devio.rn.splashscreen.SplashScreen;
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 void onCreate(Bundle savedInstanceState) {
SplashScreen.show(this); // here
super.onCreate(savedInstanceState);
}
@Override
protected String getMainComponentName() {
return "myapp";
}
}
So the key is to add import android.os.Bundle;
as shown above ;-)
that should be on the readme
when i added this code in mainActivity.java ==> @Override protected void onCreate(Bundle savedInstanceState) { SplashScreen.show(this); // here super.onCreate(savedInstanceState); } getting crash error and why it's giving crash error
Why My Andorid does not has a onCreate method inthe MainActivity?