Note that there are some explanatory texts on larger screens.

plurals
  1. PObackground strobeing code doesnt work
    primarykey
    data
    text
    <p>i found this <a href="https://stackoverflow.com/questions/12810705/how-do-i-make-a-layout-background-flashing-in-android">post</a> and im trying to make this code work me but im having issues. </p> <pre><code>package com.example.converter; import android.app.Activity; import android.graphics.drawable.AnimationDrawable; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.view.Menu; import android.view.MotionEvent; import android.view.View; import android.widget.RelativeLayout; public class Savannah extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_savannah); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_savannah, menu); return true; } public boolean onTouch(View v, MotionEvent event) { final int DELAY = 100; if(event.getAction() == MotionEvent.ACTION_UP) { RelativeLayout savannah = (RelativeLayout) findViewById(R.layout.activity_savannah); ColorDrawable f = new ColorDrawable(0xff00ff00); ColorDrawable f2 = new ColorDrawable(0xffff0000); ColorDrawable f3 = new ColorDrawable(0xff0000ff); ColorDrawable f4 = new ColorDrawable(0xff0000ff); AnimationDrawable a = new AnimationDrawable(); a.addFrame(f, DELAY); a.addFrame(f2, DELAY); a.addFrame(f3, DELAY); a.addFrame(f4, DELAY); a.setOneShot(false); savannah.setBackgroundDrawable(a); // This method is deprecated in API 16 // savannah.setBackground(a); // Use this method if you're using API 16 a.start(); } return true; } } </code></pre> <p>so here is my non working code, it doesnt flag errors but it doesnt strobe like it should. can anyone tell me whats wrong with this?</p> <pre><code>12-19 10:43:00.239: D/dalvikvm(15327): GC_EXTERNAL_ALLOC freed 351K, 47% free 3735K/6983K, external 1818K/1848K, paused 43ms 12-19 10:43:00.289: D/dalvikvm(1735): GC_FOR_MALLOC freed 159K, 49% free 3427K/6663K, external 0K/0K, paused 31ms 12-19 10:43:02.139: I/ActivityManager(1109): Starting: Intent { cmp=com.example.converter/.Savannah } from pid 20056 12-19 10:43:02.399: I/ActivityManager(1109): Displayed com.example.converter/.Savannah: +254ms 12-19 10:43:02.709: D/dalvikvm(1735): GC_FOR_MALLOC freed 140K, 49% free 3416K/6663K, external 0K/0K, paused 54ms 12-19 10:43:02.759: D/dalvikvm(1735): GC_FOR_MALLOC freed 145K, 49% free 3419K/6663K, external 0K/0K, paused 17ms 12-19 10:43:05.429: D/dalvikvm(1735): GC_FOR_MALLOC freed 167K, 49% free 3428K/6663K, external 0K/0K, paused 28ms 12-19 10:43:08.589: D/dalvikvm(15327): GC_EXPLICIT freed 113K, 47% free 3728K/6983K, external 1336K/1848K, paused 76ms 12-19 10:43:10.529: D/dalvikvm(1735): GC_FOR_MALLOC freed 160K, 49% free 3428K/6663K, external 0K/0K, paused 32ms 12-19 10:43:12.709: D/dalvikvm(1735): GC_FOR_MALLOC freed 126K, 49% free 3416K/6663K, external 0K/0K, paused 57ms 12-19 10:43:12.749: D/dalvikvm(1735): GC_FOR_MALLOC freed 146K, 49% free 3419K/6663K, external 0K/0K, paused 19ms 12-19 10:43:12.969: I/ActivityManager(1109): Starting: Intent { cmp=com.example.converter/.Savannah } from pid 20056 12-19 10:43:13.209: I/ActivityManager(1109): Displayed com.example.converter/.Savannah: +233ms 12-19 10:43:16.229: D/dalvikvm(1735): GC_FOR_MALLOC freed 165K, 49% free 3426K/6663K, external 0K/0K, paused 50ms 12-19 10:43:21.849: D/dalvikvm(1735): GC_FOR_MALLOC freed 160K, 49% free 3427K/6663K, external 0K/0K, paused 47ms 12-19 10:43:21.879: D/dalvikvm(1735): GC_FOR_MALLOC freed 129K, 49% free 3427K/6663K, external 0K/0K, paused 18ms 12-19 10:43:22.739: D/dalvikvm(1735): GC_FOR_MALLOC freed 156K, 49% free 3419K/6663K, external 0K/0K, paused 35ms </code></pre>
    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