I have looked and tried a lot of different things but no matter what I end up doing the screen is always blank and I'm sure it's something really dumb I'm doing and I'm hoping someone will catch it.
I'm trying to alternate background colors but before I even get to that I need to get it so that even one background color will display properly.
First, my xml layout works fine and when I got to the layout view it displays the color just as I want it to. When I go to setContentView() in the activity that calls the xml it is never displayed and I only get a blank screen.
Second, since this initial issue described above I have tried several fixes and have numbered them accordingly. As I did a fix I usually only bothered to comment it out instead of deleting it after it didn't work. After certain lines there is a number, so if three lines have 1's behind them then those were the three lines used in attempt #1.
Third, while trying these fixes I added a colors xml file while I'll display as well.
Finally, I'll show my main activity first, xml file second, and colors file last. As you can see my ultimate goal would be to change the background dynamically but I can't even to get it to work normally right now. And FYI my splash screen works fine. But that's an image.
Thanks for you help.
public class Blink extends Activity {
long startTime= System.currentTimeMillis();
long now=0;//the current time in millis
public void OnCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
//TextView backgroundColor=new TextView(this);2,3,4,5,6
//backgroundColor.setBackgroundColor(0xFFFF0000);5
//backgroundColor.setBackgroundResource(R.color.royalBlue);2,3,4
//backgroundColor.setVisibility(0);//make visible 3
setContentView(R.layout.blank);1
//setContentView(backgroundColor);4,5,6
//backgroundColor.setBackgroundColor(Color.argb(255, 255, 255, 255));6
//setContentView(R.layout.blink_blue);
//blink from royal blue to blank
/*while(true){
startTime= System.currentTimeMillis();
do{
now=System.currentTimeMillis();
setContentView(R.layout.blink_blue);
}while((-(startTime-now))>1000);
do{
now=System.currentTimeMillis();
setContentView(R.layout.blank);
}while((-(startTime-now))>1000);
}*/
}
This begins the xml file
//it is formatted properly but for some reason stack overflow doesn't like it so I'm only posting relevant lines.
//This is a Linear layout
android:id="@+id/blinkBlue"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/royalBlue"
This begins the colors file
#4169e1 //Yes I have tried #FF4169e1 instead
#ff000000
#ff000000
#00000000