android webview app, second life for your mobile website

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    But now its working like app name, icon,splash screen but now new problem URL not open try with my handset also in android studio.

    Comment


    • #17
      Originally posted by mrjustin View Post
      But now its working like app name, icon,splash screen but now new problem URL not open try with my handset also in android studio.
      Hello, you should test it in the android emulator in the android studio, and before you emulate, you can delete the existing apk files.

      Comment


      • mrjustin
        mrjustin commented
        Editing a comment
        you can delete the existing apk file which one reply about that file location and details...

      • GumSlone
        GumSlone commented
        Editing a comment
        in the /Flirty94/app/build/outputs/apk folder

    • #18
      URL not open always showing ss type error how to fix it

      Comment


      • GumSlone
        GumSlone commented
        Editing a comment
        looks like it cant open the url or the emulator cant connect to the internet, hmmmm.

    • #19
      Gums The Tut Is Excellent I Done It,But Only One Problem Iv Got...I See You Built Your App Using Android 6.0 Marshmellow SDK...Now The App Only Works On Android 6...I Tried Changing The SDK To 2.2 (Api level But When I Sign The App To Release Mode,It Just Changes Back To 6.0...
      Even You App Wont Work On Other Android Os,I mean The Lower OS like KItKat OR Jellybean And So On...
      Release Another App With A Lower OS Please,Thank You...

      I even tried editing the build.cradle fill to change the minSkd and targetSdk but still no luck...
      Last edited by sky2kv; 05.12.15, 20:53.

      Comment


      • #20
        download this file and chack webview code its ok run

        Comment


        • #21
          Good Work......It works fine ..But now mp3 files are not downloading ...it plays online...How can i fix it?

          Comment


          • #22
            Originally posted by GumSlone View Post
            im a newbie in android app development, this is what ive got so far, if any issues, just ask me here, will try to help.
            It's excellent!!!!You got anything else?Some more complex browser?

            Comment


            • #23
              cant open the splash.xml says failed to load platform rendering library

              Comment


              • #24
                Originally posted by mrjustin View Post
                URL not open always showing ss type error how to fix it
                Internet Permission in the Manifest is missing:

                <uses-permission android:name="android.permission.INTERNET" / >

                Code:
                <?xml version="1.0" encoding="utf-8"?>
                <manifest xmlns:android="http://schemas.android.com/apk/res/android"
                    package="media.twowap.flirty9" >
                
                    <uses-permission android:name="android.permission.INTERNET" />
                
                    <application
                        android:allowBackup="true"
                        android:icon="@mipmap/ic_launcher"
                        android:label="@string/app_name"
                        android:theme="@style/AppTheme">
                        <activity
                            android:name=".SplashActivity">
                            <intent-filter>
                                <action android:name="android.intent.action.MAIN" />
                                <category android:name="android.intent.category.LAUNCHER" />
                            </intent-filter>
                        </activity>
                        <activity
                            android:name=".MainActivity"
                            android:label="@string/app_name" >
                            <intent-filter>
                                <action android:name="android.intent.action.MAIN" />
                                <category android:name="android.intent.category.DEFAULT" />
                            </intent-filter>
                        </activity>
                    </application>
                
                    <uses-permission android:name="android.permission.INTERNET" />
                </manifest>
                Here is an up to date version of the MainActivity.java:
                Code:
                package media.twowap.flirty9;
                
                import android.graphics.Bitmap;
                import android.support.v7.app.AppCompatActivity;
                import android.os.Bundle;
                import android.view.View;
                import android.webkit.WebSettings;
                import android.webkit.WebView;
                import android.webkit.WebViewClient;
                import android.content.Intent;
                import android.net.Uri;
                import android.webkit.DownloadListener;
                import android.widget.ProgressBar;
                import android.os.Handler;
                
                
                public class MainActivity extends Activity {
                
                    public int splashLoaded = 0;
                    public int splashVisible = 0;
                    private WebView webview;
                    /** Called when the activity is first created. */
                    @Override
                    public void onCreate(Bundle savedInstanceState) {
                        super.onCreate(savedInstanceState);
                        setContentView(R.layout.activity_main);
                
                        webview = (WebView) findViewById(R.id.webView1);
                
                        WebSettings websettings = webview.getSettings();
                
                        websettings.setJavaScriptEnabled(true);
                        websettings.setSaveFormData(false);
                
                        webview.loadUrl("http://flirty9.com/");
                        webview.setHorizontalScrollBarEnabled(false);
                        webview.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
                        webview.setBackgroundColor(128);
                
                        webview.setWebViewClient(new myWebViewClient());
                
                        webview.setDownloadListener(new DownloadListener() {
                            public void onDownloadStart(String url, String userAgent,
                                                        String contentDisposition, String mimetype,
                                                        long contentLength) {
                                Intent intent = new Intent(Intent.ACTION_VIEW);
                                intent.setData(Uri.parse(url));
                                startActivity(intent);
                
                
                            }
                        });
                
                        new Handler().postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                splashLoaded = 1;
                                //finish();
                            }
                        }, 3000);
                
                
                    }
                
                    @Override
                    public void onBackPressed() {
                        if(webview.canGoBack()) {
                            webview.goBack();
                        } else {
                            super.onBackPressed();
                        }
                    }
                
                    public void visible(){
                
                        WebView webview = findViewById(R.id.webView1);
                
                        ProgressBar bar =  findViewById(R.id.progressBar1);
                
                        webview.setVisibility(View.INVISIBLE);
                
                        bar.setVisibility(View.VISIBLE);
                
                    }
                
                    public void unvisible(){
                
                        WebView webview = findViewById(R.id.webView1);
                
                        ProgressBar bar = findViewById(R.id.progressBar1);
                
                        webview.setVisibility(View.VISIBLE);
                
                        bar.setVisibility(View.INVISIBLE);
                
                    }
                
                
                    private class myWebViewClient extends WebViewClient {
                
                        @Override
                        public boolean shouldOverrideUrlLoading(WebView webview, String url){
                            webview.loadUrl(url);
                            return true;
                        }
                
                        //@Override
                        //public boolean shouldOverrideUrlLoading(WebView view, String url) {
                        //load all links matching the domain in webview
                        //    if(Uri.parse(url).getHost().endsWith("flirty9.com")) {
                        //        return false;
                        //    }
                        //for local files to be loaded in webview
                        //    else if(Uri.parse(url).getHost().length() == 0) {
                        //        return false;
                        //    }
                
                        //    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
                        //    view.getContext().startActivity(intent);
                        //view.loadUrl(url);
                        //    return true;
                        //}
                
                
                
                        @Override
                        public void onReceivedError(WebView view, int errorCode,
                                                    String description, String failingUrl) {
                            // TODO Auto-generated method stub
                            view.loadUrl("file:///android_asset/noconnection.html");
                        }
                
                        @Override
                        public void onPageStarted(WebView view, String url, Bitmap favicon) {
                
                            if(splashLoaded==0)
                            {
                                visible();
                                splashVisible = 1;
                
                            }
                
                        }
                
                        @Override
                        public void onPageFinished(WebView view, String url) {
                
                            if(splashVisible==1)
                            {
                                unvisible();
                                splashVisible = 0;
                            }
                        }
                
                
                    }
                
                }

                Comment

                Working...
                X