Add Progress bar while data loading from database
<p>I use volley library to get data from database i use this code</p>

<pre><code>public class R_arabic extends AppCompatActivity {

RequestQueue requestQueue;
ListView listView;

ArrayList&lt;listitem_gib&gt; listitems = new ArrayList&lt;listitem_gib&gt;();
String name, img, url, num;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_r_arabic);

    listView = (ListView) findViewById(R.id.listView);
    TextView textView_Title = (TextView) findViewById(R.id.textView2);

    Intent intent = getIntent();
    String story_type = intent.getStringExtra("story_type");

    switch (story_type) {
        case "arabic":
            textView_Title.setText("arabic");
            break;
        case "romance":
            textView_Title.setText("romance");
            break;
        case "motrgm":
            textView_Title.setText("motrgm");
            break;
        case "ro3b":
            textView_Title.setText("ro3b");
            break;
        case "siasa":
            textView_Title.setText("siasa");
            break;

    }

    String url = "http://grassyhat.com/android/" + story_type + ".php";


    requestQueue = Volley.newRequestQueue(this);

    JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, url,
            new Response.Listener&lt;JSONObject&gt;() {
                public void onResponse(JSONObject response) {

                    try {
                        JSONArray jsonArray = response.getJSONArray("all");
                        for (int i = 0; i &lt; jsonArray.length(); i++) {
                            JSONObject respons = jsonArray.getJSONObject(i);
                            String id = respons.getString("id");
                            String name = respons.getString("name");
                            String img = respons.getString("img");
                            String url = respons.getString("url");
                            String num = respons.getString("num");
                            listitems.add(new listitem_gib(id, name, img, url, num));

                        }
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }

                    listAllItme();
                }
            }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            Log.e("VOLLEY", "ERROR");
        }
    }

    );
    requestQueue.add(jsonObjectRequest);

}


public void listAllItme() {
    ListAdapter lA = new listAdapter(listitems);
    listView.setAdapter(lA);

    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
            CheckInternetConnection cic = new CheckInternetConnection(getApplicationContext());
            Boolean Ch = cic.isConnectingToInternet();
            if (!Ch) {
                Toast.makeText(R_arabic.this, "no connection", Toast.LENGTH_LONG).show();
            } else {
                Intent open = new Intent(R_arabic.this, rewaya_show.class);
                open.putExtra("name", listitems.get(position).name);
                open.putExtra("url", listitems.get(position).url);
                open.putExtra("img", listitems.get(position).img);
                open.putExtra("num", listitems.get(position).num);

                startActivity(open);

                showad++;
                if (showad &gt;= 5) {
                    showad = 0;
                    if (mInterstitialAd.isLoaded()) {
                        mInterstitialAd.show();
                    }
                }
            }
        }
    });

}



class listAdapter extends BaseAdapter {
    ArrayList&lt;listitem_gib&gt; lista = new ArrayList&lt;listitem_gib&gt;();

    public listAdapter(ArrayList&lt;listitem_gib&gt; lista) {
        this.lista = lista;
    }

    @Override
    public int getCount() {
        return lista.size();
    }

    @Override
    public Object getItem(int position) {
        return lista.get(position).name;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        LayoutInflater layoutInflater = getLayoutInflater();
        View view = layoutInflater.inflate(R.layout.row_item_gib, null);

        TextView name = (TextView) view.findViewById(R.id.textView_gib);
        ImageView img = (ImageView) view.findViewById(R.id.imageView_gib);
        TextView num = (TextView) view.findViewById(R.id.textView_gib2);


        name.setText(lista.get(position).name);
        num.setText(lista.get(position).num);

        Picasso.with(R_arabic.this).load("http://grassyhat.com/android/image/" + lista.get(position).img).into(img);


        return view;
    }
}
</code></pre>

<p>i want to add progress bar while data loading to avoid blank page </p>

<p>sorry i'm new in android and i google for that and don't get useful answer</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.kamal.ahmed.rewaya.R_arabic"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    android:background="@drawable/bg"
    tools:showIn="@layout/app_bar_r_arabic"&gt;

&lt;LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/adView"&gt;

        &lt;TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textSize="40sp"
            android:textStyle="bold"
            android:textColor="#e873400c"
            android:layout_gravity="center"
            android:id="@+id/textView2" /&gt;

        &lt;ListView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/listView"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:paddingRight="@dimen/activity_horizontal_margin"
            android:divider="@drawable/div1"
            android:dividerHeight="35dp" /&gt;

    &lt;/LinearLayout&gt;

&lt;LinearLayout
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/progress_layout"
    android:visibility="gone"&gt;

    &lt;ProgressBar
        android:id="@+id/progress_bar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginLeft="100dp"
        android:layout_marginBottom="60dp"
        android:layout_weight="1"/&gt;

    &lt;TextView
        android:text="Download"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/progress_txt"
        android:textSize="30sp"
        android:textStyle="bold"
        android:textColor="#e873400c"
        android:layout_gravity="center"
        android:layout_marginRight="90dp"
        android:layout_marginBottom="60dp"
        android:layout_weight="1" /&gt;

&lt;/LinearLayout&gt;
</code></pre>

<p></p>