I am a PHP developer, who is new to Android development and Java so please bear with me.
I am developing an extremely simple app for testing and learning purposes.
when the user clicks my app icon, they are presented with a loading screen. I have a TextView with a progress bar underneath.
TextView XML code:
<TextView
android:id="@+id/loadingMessage1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/progressBar1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="22dp"
android:text="@string/loading1" />
The value is set to the string loading1 in strings.xml
<string name="loading1">Loading Message 1</string>
In my loadingscreen.java i have:
package com.example.myfirstapp;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.widget.TextView;
public class LoadingScreen extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_loading_screen);
TextView loadingMessage1 = (TextView)this.findViewById(R.id.loadingMessage1);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_loading_screen, menu);
return true;
}
}
Notice I have the code:
TextView loadingMessage1 = (TextView)this.findViewById(R.id.loadingMessage1);
Which I think references the text view.
What I want to happen is that every 3 seconds a different message appears.
So loading message 1… (3 secs) loading message 2… (3 secs) loading message 3..
after loading message 3 i would like a button to replace the progress bar.
You can use the
Handlerclass: