-1
I have a crosswalk webview application. as my site takes about 5 seconds to open on screen, I thought about inserting a splashscreen or imagemview ( I don’t know if there’s a difference between the two - I’m starting yet ) and letting it appear for 5 seconds on the screen.
I have also seen people entering the splashscreen or imagemview on the home screen and it disappears when the page is loaded.
both solutions would be great , but I can’t do it.
below I’ll leave my code.
Maindactivity.java
package com.ovortex.myapplication;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import org.xwalk.core.XWalkActivity;
import org.xwalk.core.XWalkView;
public class MainActivity extends XWalkActivity {
private XWalkView xWalkWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
xWalkWebView=(XWalkView)findViewById(R.id.xwalkWebView);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {//<----verifica se o dipositivo é api 19 / Android 4.4
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LOW_PROFILE
| View.SYSTEM_UI_FLAG_FULLSCREEN // esconde a barra de status
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
}
@Override
protected void onXWalkReady() {
// carregar uma url local
xWalkWebView.loadUrl("http://xxxxxx.com");
}
}
Activity.main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.ovortex.myapplication.MainActivity">
<org.xwalk.core.XWalkView
android:id="@+id/xwalkWebView"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#fff"
/>
</RelativeLayout>
Androidmanifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ovortex.myapplication">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
And that in order to ask an android app question the question will give credits? Chestnut part, if you want help put the code, Stackoverflow in Portuguese is different from Stackoverflow in English.
– Pedro Ferreira
@Pedroferreira I edited the question and put the code inside.
– jhonatan santos
It is necessary to rewrite enough, should not try to start two Activity at the same time, a possible solution would be to use Fragments, It is simple to start two Fragments simultaneously and only Splashfragment will be visible with a Handle.Delayed calling an Activity method that will close Splashfragment and make Fragment visible with Crosswalk Webview. But we’re not talking about solving a bug, but rewriting almost from scratch hence my -1 the question.
– Pedro Ferreira
As a side note, with so many API’s and technology available, thinking of a mobile app as just a browser for a heavy site is crazy and do not take into account the user’s data plan.
– Pedro Ferreira
I believe the solution to your problem is to leave everything on an Activity only, and hide the splashscreen view when the site is loaded. It’s not the best solution, by the way, but use a Framelayout with a view hiding all of Activity last. When you finish loading, hide that view and you’re done. But even giving this solution, take a look at the concepts of Fragment and hybrid applications designed in another way, can help you in another situation. I even had one that the customer just wanted a layer over the site as app and had to be just like his.
– Grupo CDS Informática
@group computer Cds can give me a north how to do ? You know where I can find a tutorial ?
– jhonatan santos
I’ll comment as an answer to you ;)
– Grupo CDS Informática
@Grupocdsinformática I edited the question for better understanding.
– jhonatan santos
@Pedroferreira I edited the question more clearly, about your opinion about user data - my audience will be people who listen to music on Youtube by mobile. then it will be trading six for half a dozen say, but my app will have a bigger and clean organization. vlw man
– jhonatan santos