I am using a third party library for splash screen. I got it from https://github.com/ViksaaSkool/AwesomeSplash. I have followed the whole tutorial but i am getting error while setting string path. It has a line "configSplash.setPathSplash(SyncStateContract.Constants.DROID_LOGO); //set path String". Android studio is unable to resolve DROID_LOGO and i am getting error. I replaced DROID_LOGO with DATA and got this error. As suggested on the post i have written this code.
public class splashex extends AwesomeSplash {
//DO NOT OVERRIDE onCreate()!
//if you need to start some services do it in initSplash()!
@Override
public void initSplash(ConfigSplash configSplash) {
/* you don't have to override every property */
//Customize Circular Reveal
configSplash.setBackgroundColor(R.color.colorPrimary); //any color you want form colors.xml
configSplash.setAnimCircularRevealDuration(2000); //int ms
configSplash.setRevealFlagX(Flags.REVEAL_RIGHT); //or Flags.REVEAL_LEFT
configSplash.setRevealFlagY(Flags.REVEAL_BOTTOM); //or Flags.REVEAL_TOP
//Choose LOGO OR PATH; if you don't provide String value for path it's logo by default
//Customize Logo
configSplash.setLogoSplash(R.mipmap.ic_launcher); //or any other drawable
configSplash.setAnimLogoSplashDuration(2000); //int ms
configSplash.setAnimLogoSplashTechnique(Techniques.Bounce); //choose one form Techniques (ref: https://github.com/daimajia/AndroidViewAnimations)
//Customize Path
configSplash.setPathSplash(SyncStateContract.Constants.DROID_LOGO); //set path String(**I am getting error here**)
// configSplash.setOriginalHeight(400); //in relation to your svg (path) resource
configSplash.setOriginalWidth(400); //in relation to your svg (path) resource
configSplash.setAnimPathStrokeDrawingDuration(3000);
configSplash.setPathSplashStrokeSize(3); //I advise value be <5
configSplash.setPathSplashStrokeColor(R.color.colorPrimaryDark); //any color you want form colors.xml
configSplash.setAnimPathFillingDuration(3000);
configSplash.setPathSplashFillColor(R.color.colorPrimaryDark); //path object filling color
//Customize Title
configSplash.setTitleSplash("My Awesome App");
configSplash.setTitleTextColor(R.color.colorAccent);
configSplash.setTitleTextSize(30f); //float value
configSplash.setAnimTitleDuration(3000);
configSplash.setAnimTitleTechnique(Techniques.FlipInX);
configSplash.setTitleFont("fonts/myfont.ttf"); //provide string to your font located in assets/fonts/
}
@Override
public void animationsFinished() {
//transit to another activity here
//or do whatever you want
}
}
The error i am getting is
java.lang.RuntimeException: Font asset not found fonts/myfont.ttf
at android.graphics.Typeface.createFromAsset(Typeface.java:190)
I searched various links and all suggested to add assets folder but i dont know where to make assets folder and what to store in that. please help me with all the details about assets and fonts.
Still i am getting this.
You have to create folder named fonts according to the following path:
your_android_project_folder > app > src > main > assets > fonts
Now within your fonts folder,you need to store your myfont.ttf file.