package p_v.myapplication;


import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import java.io.IOException;
import java.util.List;

public class MainActivity extends AppCompatActivity {

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

        ListView listView = (ListView) findViewById(R.id.listZoznamAut);

        XMLParser parser = new XMLParser();
        List<Auta> list_auta = parser.parse(getResources().openRawResource(R.raw.auta_data));
        //list_auta = parser.parse(getAssets().open("auta_data.xml"));
        ArrayAdapter<Auta> adapter = new ArrayAdapter<Auta>(this, R.layout.list_item, list_auta);
        listView.setAdapter(adapter);
    }
}
