Hello guys. i am trying to create splash screen (app startup time splash screen) in \res\drawable\icon_splash.xml
folder but i am getting error all time. Anyone can guide me to create that ?
@anon61431939 Why are you doing that you can use inbuilt splash screen option of niotron and one more thing if you are making apps then editing them using apk editor studio’s then Why won’t you make apps from android studios as you are having a good knowledge of android studios
And here the code
First you need to hide action bar during start-up
So use this
style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"
Then use the Post Delay Function just like clock in Niotron
public final boolean postDelayed(Runnable Object token, long delayMillisec)
[Be Sure to do these above changes in styles.xml]
Now
Code of MainActivity.java
package com.example.adityananda.splashscreen;
import android.content.Intent;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.WindowManager;
public class MainActivity extends AppCompatActivity {
private static int SPLASH_SCREEN_TIME_OUT=3000;
// Here in Place of 3000 you can give you time
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent i=new Intent(MainActivity.this,
SecondActivity.class);
startActivity(i);
finish();
}
}, SPLASH_SCREEN_TIME_OUT);
}
}
Now
Add the image you want in your drawables folder
The do this code in
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.hp.splashscreen.MainActivity">
<ImageView
android:id="@+id/imageView"
android:layout_width="250dp"
android:layout_height="200dp"
app:srcCompat="@drawable/your_image_name"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="8dp"
android:layout_marginRight="8dp"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginLeft="8dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="8dp"
app:layout_constraintVertical_bias="0.447" />
</android.support.constraint.ConstraintLayout>
And this is tested and working
4 Likes
Let me check after few minutes
have you checked ? @anon61431939
1 Like
No. Actually my laptop gone down
His method is correct this will work
1 Like