Stack Exchange
Populating ListView with custom Adapter
I want to populate a ListView with multiple elements from a custom ListView Adapter.
I tried this tutorial.
No exception is thrown, but it doesn't display anything in my ListView.
Here's the code:
Lyrics.java:
   package de.lichtenberger.gottschalk.android;

import static de.lichtenberger.gottschalk.android.Constant.DAUER;
import static de.lichtenberger.gottschalk.android.Constant.INTERPRET;
import static de.lichtenberger.gottschalk.android.Constant.TITEL;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.TextView;

import com.parse.FindCallback;
import com.parse.Parse;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;

public class Lyrics extends Activity {



    ImageButton back;
    ListView songList;
    TextView textAnzeige;
    private ArrayList<String> Titelliste = new ArrayList<String>();
    private ArrayList<String> Interpretliste = new ArrayList<String>();
    private ArrayList<String> Dauerliste = new ArrayList<String>();
    private ArrayAdapter<String> aa;
    private SAdapter sA;
    ProgressDialog dialog;
    private ArrayList<HashMap> list;



     @Override
       public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_lyrics);

            Parse.initialize(this, "hGxasGU6e0WQAOh5JIOGDfvFBKrYyBJKXIzxBfAG", "WsOPsXerpsFjsjekKKbZnnjAHvXy5PQHVQEB8Cqu");

            setupUI();
            setupOnClickListeners();
            new getData().execute();

            populateList();
            sA = new SAdapter(this, list);
            songList.setAdapter(sA);
            sA.notifyDataSetChanged();

        }


    private void populateList() {

        list = new ArrayList<HashMap>();
        HashMap temp = new HashMap();


        for(int i=1; i<= Titelliste.size(); i++){

            temp.put(TITEL, Titelliste.get(i).toString());
            temp.put(INTERPRET, Interpretliste.get(i).toString());
            temp.put(DAUER, Dauerliste.get(i).toString());
            list.add(temp);         

        }



    }


    private class getData extends AsyncTask<Void, Void, SAdapter>{

        ProgressDialog dialog;
        @Override
        protected void onPreExecute() {
            dialog = new ProgressDialog(Lyrics.this);
            dialog.setMessage("Please wait, while loading!");
            dialog.setIndeterminate(true);
            dialog.setCancelable(false);
            dialog.show();
        }

        @Override
        protected SAdapter doInBackground(Void... params) {
            ParseQuery pq = new ParseQuery("SongDatenbank");
            pq.whereExists("Titel");
            pq.findInBackground(new FindCallback() {

                @Override
                public void done(List<ParseObject> liederListe, ParseException e) {
                    if(e==null){
                        Log.d("Parse", "Objektliste empfangen");

                            ParseObject x;

                        for(int i=0;i<liederListe.size();i++){
                            x = liederListe.get(i);
                            Titelliste.add(x.getString("Titel"));
                            Dauerliste.add(x.getString("Dauer"));
                            Interpretliste.add(x.getString("Interpret"));
                        }


                        x = liederListe.get(0);

                        Log.d("Parse", x.getString("Titel"));


                    }else{

                        Log.d("Parse", "Objektliste nicht empfangen");
                    }
                }
            });
            return null;
        }

        protected void onPostExecute(SAdapter result) {

                    dialog.dismiss();
                    populateList();
                    sA = new SAdapter(Lyrics.this, list);
                    songList.setAdapter(sA);
                    sA.notifyDataSetChanged();
        }


    }



    private void setupOnClickListeners() {

        back.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {

                Intent back = new Intent(Lyrics.this, Lagerfeuer_Lieder.class);
                startActivity(back);

            }
        });
    }

    private void setupUI() {


        back = (ImageButton)findViewById(R.id.back);
        songList = (ListView)findViewById(R.id.list);
        textAnzeige = (TextView)findViewById(R.id.lyricsView);

    }   

}

My Adapter:
package de.lichtenberger.gottschalk.android;

import java.util.ArrayList;
import java.util.HashMap;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import static de.lichtenberger.gottschalk.android.Constant.DAUER;
import static de.lichtenberger.gottschalk.android.Constant.TITEL;
import static de.lichtenberger.gottschalk.android.Constant.INTERPRET;







public class SAdapter extends BaseAdapter
{
    public ArrayList<HashMap> list;
    Activity activity;

    public SAdapter(Activity activity, ArrayList<HashMap> list) {
        super();
        this.activity = activity;
        this.list = list;
    }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        // TODO Auto-generated method stub
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        // TODO Auto-generated method stub
        return 0;
    }

    private class ViewHolder {
           TextView titel;
           TextView artist;
           TextView duration;

      }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

                ViewHolder holder;
                LayoutInflater inflater =  activity.getLayoutInflater();

                if (convertView == null)
                {
                    convertView = inflater.inflate(R.layout.list_row, null);
                    holder = new ViewHolder();
                    holder.titel = (TextView) convertView.findViewById(R.id.title);
                    holder.artist = (TextView) convertView.findViewById(R.id.artist);
                    holder.duration = (TextView) convertView.findViewById(R.id.duration);
                    convertView.setTag(holder);
                }
                else
                {
                    holder = (ViewHolder) convertView.getTag();
                }

                HashMap map = list.get(position);
                holder.titel.setText(map.get(TITEL).toString());
                holder.artist.setText(map.get(INTERPRET).toString());
                holder.duration.setText(map.get(DAUER).toString());


            return convertView;
    }

}

Here my activity_lyrics.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/background" >

    <ImageButton 
        android:layout_width="150dp"
        android:layout_height="40dp"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_marginRight="0dp"
        android:contentDescription="back"
        android:id="@+id/back"
        android:background="@drawable/back"
        android:text="@string/Lagerfeuer"/>

    <ImageView 
        android:layout_width="fill_parent"
        android:layout_height="40dp"
        android:layout_alignTop="@id/back"
        android:layout_toRightOf="@id/back"
        android:background="@drawable/back2"

        android:contentDescription="back2"/>



   <ListView
        android:layout_below="@id/back"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:divider="#b5b5b5"
        android:dividerHeight="1dp"
        android:listSelector="@drawable/list_selector"
        android:id="@+id/list"
        />
</RelativeLayout>

And my list_row.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/list_selector"
    android:orientation="horizontal"
    android:padding="5dip" >

    <!--  ListRow Left sied Thumbnail image -->
    <LinearLayout android:id="@+id/thumbnail"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="3dip"
        android:layout_alignParentLeft="true"
        android:background="@drawable/image_bg"
        android:layout_marginRight="5dip">

        <ImageView
            android:id="@+id/list_image"
            android:layout_width="50dip"
            android:layout_height="50dip"
            android:src="@drawable/guitar_1"/>

    </LinearLayout>

    <!-- Title Of Song-->
    <TextView
        android:id="@+id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/thumbnail"
        android:layout_toRightOf="@+id/thumbnail"
        android:text="Rihanna Love the way lie"
        android:textColor="#040404"
        android:typeface="sans"
        android:textSize="15sp"
        android:textStyle="bold"/>

    <!-- Artist Name -->
    <TextView
        android:id="@+id/artist"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/title"
        android:textColor="#343434"
        android:textSize="10sp"
        android:layout_marginTop="1dip"
        android:layout_toRightOf="@+id/thumbnail"
        android:text="Just gona stand there and ..." />

    <!-- Rightend Duration -->
    <TextView
        android:id="@+id/duration"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignTop="@id/title"
        android:gravity="right"
        android:text="5:45"
        android:layout_marginRight="5dip"
        android:textSize="10sp"
        android:textColor="#10bcc9"
        android:textStyle="bold"/>


     </RelativeLayout>

I would really appreciate it if anyone could look through that code and can give me some advice how to solve my problem.

use onPostExecute for setting Adapter for ListView after AsyncTask's doInBackground method execution complete instead of calling it just after executing AsyncTask as:
 @Override
 protected void onPostExecute(SAdapter result) {

            dialog.dismiss();

            // populate Listview here...
            populateList();
            sA = new SAdapter(Lyrics.this, list);
            songList.setAdapter(sA);
            sA.notifyDataSetChanged();
        }


doesn't work...maybe its something with my xml files...I add them to my question

@PaulLich : u will need to also comment or remove code from onCreate method of Activity after new getData().execute(); line

You could use something like this:
@Override
protected void onPostExecute(List<Contact> result) {            
    super.onPostExecute(result);
    dialog.dismiss();
    adpt.setItemList(result);
    adpt.notifyDataSetChanged();
}

@Override
protected void onPreExecute() {        
    super.onPreExecute();
    dialog.setMessage("Downloading contacts...");
    dialog.show();            
}

You can give a look here (Android Async ListView–JEE And RestFul)

listview= (ListView)findViewById(R.id.listview);
listview.setOnItemSelectedListener(this);
String days[] = {"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
ArrayAdapter<String> newAdpt= new ArrayAdapter<String>(this,android.R.layout.simple_listview_item,days);
newAdpt.setDropDownViewResource(android.R.layout.select_dialog_singlechoice);
listview.setAdapter(newAdpt);


Might be a stupid answer, but 

HashMap is a raw type. References to generic type HashMap should be parameterized

Try:
HashMap <String, String> map

Change it in adapter and main class body.
Same problem happened to me, but have no idea why, only difference I see is that hashmap reference.
