Android Webview Beyaz Ekran Sorunsalı
-
Eclipsete webview kullanarak asset klasöründen site çekip uygulamada gösteriyorum. Uygulama üst model telefonlarda(s5,g4,g2,g3,z3 vs) beyaz ekran da kalıyor. Uygulama açılıyor içerik gelmiyor. Manifest dosyasında internet izni verildi. Kullanılan sdk mini 15 target 23.
package com.hasankurtay.ceviz; import android.annotation.SuppressLint; import android.app.Activity; import android.os.Bundle; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; import android.webkit.WebView; @SuppressLint("SetJavaScriptEnabled") public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); String url = "file:///android_asset/ceviz/index.html"; WebView view = (WebView) this.findViewById(R.id.webview1); view.getSettings().setJavaScriptEnabled(true); view.loadUrl(url); } ////kod buraya gelecek @Override public boolean onKeyDown(int keyCode, KeyEvent event) { WebView view = (WebView) findViewById(R.id.webview1); if ((keyCode == KeyEvent.KEYCODE_BACK) && view.canGoBack()) { view.goBack(); return true; } return super.onKeyDown(keyCode, event); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
-
-
JPriest bunu yazdı
Hocam denedim Genymotion daki sanal makinada öncedende çalışıyordu ama yine deneme yağtığım z3 ve g3 telefonlarda işe yaramadı :(
-
Hoam bazen manifest dosyasında internet izni olmayınca böyle yapıyor hocam . Hata vermez bu şekilde boş sayfa döner webview de birde olmazsa Interneti kontrol ettirip öyle load edin ilk önce WebView dinlerken internet varmı ona bakın
-
@xursi, normal bir site yazdiginda geliyor mu site? geliyorsa internet izni ile ilgisi yok
-
Hocalar uygulama 4.4 e kadar olan sürümlerde açılıyor ve sayfa geliyor zaten. Site localde hem telefonlarda hemde genymotionda çalışıyor. android 5.0-6.0 sürümlerinde beyaz ekranda kalıyor. 4.4 ten sonra android webview ile alakalı birşeyler yapmış dün epey birşeyler buldum ama daha çözüme ulaşamadım :D
Manifest dosyasında da internet iznini vermiştim zaten o konudada sorun yok yani :D
@unbalanced @MhmdAlmz
-
http://developer.android.com/about/versions/android-5.0-changes.html
WebView
Android 5.0 changes the default behavior for your app.
- If your app targets API level 21 or higher:
- The system blocks mixed content and third party cookies by default. To allow mixed content and third party cookies, use the
setMixedContentMode()
andsetAcceptThirdPartyCookies()
methods respectively. - The system now intelligently chooses portions of the HTML document to draw. This new default behavior helps to reduce memory footprint and increase performance. If you want to render the whole document at once, disable this optimization by calling
enableSlowWholeDocumentDraw()
.
- The system blocks mixed content and third party cookies by default. To allow mixed content and third party cookies, use the
- If your app targets API levels lower than 21: The system allows mixed content and third party cookies, and always renders the whole document at once.
- If your app targets API level 21 or higher:
-
Enteresan. Hocam ben kullanıyorum ama pek bi sorun yok. Web view dinleyip url ekrana yazdırsan? Yüklenirken mi kalıyor herhangi. Bi hata da yok :/
-
ozgunlu bunu yazdı
http://developer.android.com/about/versions/android-5.0-changes.html
WebView
Android 5.0 changes the default behavior for your app.
- If your app targets API level 21 or higher:
- The system blocks mixed content and third party cookies by default. To allow mixed content and third party cookies, use the
setMixedContentMode()
andsetAcceptThirdPartyCookies()
methods respectively. - The system now intelligently chooses portions of the HTML document to draw. This new default behavior helps to reduce memory footprint and increase performance. If you want to render the whole document at once, disable this optimization by calling
enableSlowWholeDocumentDraw()
.
- The system blocks mixed content and third party cookies by default. To allow mixed content and third party cookies, use the
- If your app targets API levels lower than 21: The system allows mixed content and third party cookies, and always renders the whole document at once.
Yöntem işe yaradı hocam çok teşekkür ediyorum. Ayrıca yardımcı olan herkesede teşekkür ediyorum :)
- If your app targets API level 21 or higher: