Note that there are some explanatory texts on larger screens.

plurals
  1. POWebView vanishes for a second after opening another activity
    primarykey
    data
    text
    <p>I have a <code>WebView</code> I add to an <code>Activity</code> with <code>setContentView()</code>. In this <code>WebView</code> I have a button that opens another <code>Activity</code> on top of the current one (using <code>startActivityForResult()</code>), this <code>Activity</code> dismisses itself after finishing its task, and we return to the first <code>Activity</code> (The one with the <code>WebView</code>). When returning to the <code>Activity</code> the <code>WebView</code> vanishes for a moment and we see the <code>Activity</code>'s background (it comes back after a second). This is annoying and looks glitchy. I'm not really sure why it happens, but it has something to do with invalidation of the <code>WebView</code> and it being <code>INVISIBLE</code> for a second (This is probably the way android renders its views or something...). Is there a fix for this?</p> <p>This behavior only happens when hardware acceleration is enabled, disabling it fixes the issue, but I need hardware acceleration for the <code>WebView</code>.</p> <p><strong>EDIT</strong>: Some code</p> <pre><code>// A self dismissing activity public class TestActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ImageView v = new ImageView(getApplicationContext()); v.setBackgroundColor(0xFFFF0000); setContentView(v); Handler handler = new Handler(Looper.getMainLooper()); handler.postDelayed(new Runnable() { @Override public void run() { TestActivity.this.finish(); } }, 1000); } } // Code to show the WebView and then the activity, stick this somewhere in a different Activity WebView wv = new WebView(getApplicationContext()); wv.loadUrl("www.google.com"); addContentView(wv, new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); (new Handler(Looper.getMainLooper())).postDelayed(new Runnable() { @Override public void run() { Intent I = new Intent(getApplicationContext(), TestActivity.class); startActivityForResult(I, 255); } }, 1000); </code></pre> <p>This is much simpler than my actual code, but it replicates the result nicely.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload