Setting title for listview
<p>I have an android app that should parse data from php web page and display them into two listview, each listview to display values of a String</p>

<p>my problem is how to set titles for these listviews?  </p>

<pre><code>public class MainActivity extends Activity {

 @Override
 protected void onCreate(Bundle savedInstanceState)
 {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);
 new GetData().execute();
 }

 private class GetData extends AsyncTask&lt;Void, Void, Void&gt; 
 {
  ProgressDialog progressDialog;
  String data;
  List&lt;String&gt; r = new ArrayList&lt;String&gt;();
  List&lt;String&gt; r2 = new ArrayList&lt;String&gt;();
  ArrayAdapter&lt;String&gt;adapter=new ArrayAdapter&lt;String&gt;(getApplicationContext(), android.R.layout.simple_list_item_1,r);    
  ArrayAdapter&lt;String&gt;adapter2=new ArrayAdapter&lt;String&gt;(getApplicationContext(), android.R.layout.simple_list_item_1,r2);
  ListView list =  (ListView)findViewById(R.id.right);
  ListView list2= (ListView)findViewById(R.id.left); 

 public   GetData()
 {  }

 @Override
 protected void onPreExecute()
 {
 super.onPreExecute();
 list.setBackgroundColor(color.background_dark);
 list2.setBackgroundColor(color.background_dark);
 progressDialog = new ProgressDialog(MainActivity.this);
 progressDialog.setCancelable(false);
 if (!progressDialog.isShowing()) 
 {
 progressDialog.show();
  } 
        }

 @Override
 protected Void doInBackground(Void... params) 
 {
 try 
 {
 DefaultHttpClient client = new DefaultHttpClient();
 HttpGet request = new HttpGet("http://192.168.1.97:89/Derdeery/Zaki.php");
 HttpResponse response = client.execute(request);
 HttpEntity entity=response.getEntity();
 data=EntityUtils.toString(entity);
 JSONArray json=new JSONArray(data);
 Log.e("STRING", data);
  } 
 catch(Exception e)
 {}
 return null;
  }
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
try
{
if (progressDialog.isShowing()) 
{
progressDialog.dismiss();
}
JSONArray json=new JSONArray(data);
for(int i=0;i&lt;json.length(); i++)
{
String name=obj.getString("Part_NAME");
String id = obj.getString("Part_ID") ;
Log.e("name", name); 
r.add(id );
r2.add(name);
}
list.setAdapter(adapter);
list2.setAdapter(adapter2);
} 
catch (JSONException e)
 {
 // TODO Auto-generated catch block
 e.printStackTrace();
 }
 }}
 }
</code></pre>

<p>activity_main.xml</p>

<pre><code> &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical"&gt;

  &lt;ListView
    android:id="@+id/left"
    android:layout_width="0dp"
    android:layout_height="match_parent"
    android:layout_margin="2dp"
    android:layout_weight="0.52"/&gt;

   &lt;ListView
    android:id="@+id/right"
    android:layout_width="0dp"
    android:layout_height="match_parent"
    android:layout_margin="2dp"
    android:layout_weight=".25" /&gt;

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