Kotlin, Launching Settings Activity is Showing Main Activity

The problem is that the code in SettingsActivity is not tied to the settings_activity.xml file. So it is using the activity_main.xml instead. It does in fact switch activities, the header at the top shows that it is in the Settings, but it shows the same information on the Main Activity. Problem showed up after copying and pasting code.

Check the following line under the initial onCreate function

override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)  // <-- Should be R.layout.settings_activity

The setContentView line should reflect the Layout XML file under res -> layout -> settings_activity.xml

You need to use a Theme.AppCompat theme (or descendant) with this activity.

https://stackoverflow.com/questions/21814825/you-need-to-use-a-theme-appcompat-theme-or-descendant-with-this-activity

You need to use a Theme.AppCompat theme (or descendant) with this activity.

Looks like you can get the above error resolved by adding the following to the Android Manifest file.

android:theme="@style/Theme.AppCompat.Light

Bash Loop Examples

For i in 1-100 do

Basically count to 100 and perform an operation each time i increases.

for ((i=1; i<=100;i++))
do 
  echo $i
done

for loop 1 liner

for ((i=1; i<=100;i++)) do echo $i ; done

While true (Execute forever)

Handy if you just want a script to run and repeat the same thing over and over again. Doesn't stop till you kill it.

while true
do
  echo "Repeat till infinity"
  sleep 1
done

While command is true

The following will execute the loop as long as the command in the () returns true. Once it returns false, it'll stop the loop

while (fping incredigeek.com | grep alive); 
do
  echo alive
  sleep 1
done