ProgressBar

La ProgressBar è un componente UI che indica
lo stato di avanzamento di un’operazione.
La barra di avanzamento supporta due modalità : indeterminato e determinato.
Si utilizza la modalità indeterminata per la barra di avanzamento quando non si sa quanto tempo richiederà l”operazione.
Si utilizza la modalità determinata per la barra di avanzamento quando si vuole mostrare una quantità specifica di avanzamento.
Per impostazione predefinita, una barra di avanzamento viene visualizzata come una ruota che gira.

Utilizzando il setProgress(int)metodo è possibile aggiornare la percentuale di avanzamento.La barra di avanzamento è piena quando il valore di avanzamento raggiunge 100.

<?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android&#8221; android:layout_width=”match_parent” android:layout_height=”match_parent” android:gravity=”center” android:orientation=”vertical”> <TextView android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:text=”Hello, world!” android:textAppearance=”?android:attr/textAppearanceMedium”/> <Button android:id=”@+id/btn” android:text=”Start” android:layout_width=”wrap_content” android:layout_height=”wrap_content”/>

<ProgressBar android:id=”@+id/mBar” android:layout_width=”match_parent” android:layout_height=”wrap_content” style=”?android:attr/progressBarStyleHorizontal”/></LinearLayout>

package com.exsample.progressBar.activities; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import com.exsample.progressBar.R; import android.view.*; import android.widget.*; import android.os.*; import android.app.*;

public class MainActivity extends AppCompatActivity { private ProgressBar progress; Thread thread; int mbar=0; Button button; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); progress = findViewById(R.id.mBar); button = findViewById(R.id.btn); button.setOnClickListener(new View.OnClickListener() {

public void onClick(View v) {
new Thread() {
public void run() {

for (mbar=0;mbar<100;mbar++){
try {
runOnUiThread(new Runnable() {
@Override
public void run() {
progress.setProgress(mbar);
}
});
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}.start();
}
});
}
}

Wardell

gray

Plays

Bebop &

SWING

Wardell Gray was born in Oklahoma City, the youngest of four children. His early childhood years were spent in Oklahoma, before moving with his family to Detroit in 1929.

In early 1935, Gray began attending Northeastern High School, and then transferred to Cass Technical High School, which is noted for having Donald Byrd, Lucky Thompson and Al McKibbon as alumni.