[Java for Android App Development] xcesco89:
i need to update the ListView part because i managed to get the listView exactly as the Htc made it ( i mean with bouncing overscroll , with black background and with white items :) )

so let's start :D

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<com.htc.widget.HtcListView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/lv"
android:layout_width="match_parent"
android:layout_height="match_parent" />

list_item.xml

<?xml version="1.0" encoding="utf-8"?>
<com.htc.widget.HtcListItem xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:orientation="vertical" >

<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>

</com.htc.widget.HtcListItem>

yourActivity.java

public class yourActivity extends Fragment implements OnItemClickListener {

public ArrayList<HashMap<String, String>> fileList = new ArrayList<HashMap<String, String>>();
public HtcListView lv;
public Activity mActivity;
static final String KEY_NAME = "name";

[MENTION=439709]override[/MENTION]
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
}

[MENTION=439709]override[/MENTION]
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);

}
[MENTION=439709]override[/MENTION]
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
ViewGroup view = (ViewGroup) inflater.inflate(R.layout.activity_main, container, false);
mActivity = getActivity();
lv = (HtcListView) view.findViewById(R.id.lv);
lv.setOnItemClickListener(this);

File root = new File(Environment.getExternalStorageDirectory().getAbsolutePath());
//ListDir() method explained below
ListDir(root);

ListAdapter adapter = new SimpleAdapter(mActivity, fileList,
R.layout.list_item,
new String[] { KEY_NAME}, new int[] {R.id.name});
lv.setAdapter(adapter);

return view
}

ListDir() function

void ListDir(File f){
File[] files = f.listFiles();
for (File file : files){
if(file.getName().endsWith(".zip")){
HashMap<String, String> map = new HashMap<String, String>();
map.put(KEY_NAME, file.getName());
fileList.add(map);
}
}

so, with the function ListDir() i'm getting all the files located on the SDcard and i'm filtering the results to get only zip files.

the for loop will add only the zip files to the Hashmap then it will add these items to our ArrayList called fileList.

Explanation for the ListAdapter:

ListAdapter adapter = new SimpleAdapter(mActivity, fileList,
R.layout.list_item,
new String[] { KEY_NAME}, new int[] {R.id.name});
lv.setAdapter(adapter);

as you can see i'm creating a new listadapter and inside this we need to declare:

mActivity => The activity

fileList => our arraylist where we have imported values/items

R.layout.list_item => the "row" layout of our listview

new String[]{KEY_NAME} => the values/items we want to set in the listview

new int{R.id.name} => the textview inside list_item.xml

lv.setAdapter(adapter) => set the adapter

with this adapter you can also set multiple textviews or whatever you want , you just need to add the "KEY_YOURKEY" string and the "R.layout.yourtextview" you have set inside "list_item.xml" and the adapter will do the dirty job

a simple example with multiple textviews:

ListAdapter adapter = new SimpleAdapter(act, menuItems,
R.layout.list_item,
new String[] { KEY_DESC, KEY_NAME, KEY_LINK},
new int[] { R.id.desc, R.id.name, R.id.link});
lv.setAdapter(adapter);

and this will be the result:

Single TextView (overscroll effect):

multiple TextViews:

To retrieve data from the listView when item is clicked:

[MENTION=439709]override[/MENTION]
public void onItemClick(HtcAdapterView<?> arg0, View v, int pos, long id) {
// TODO Auto-generated method stub
TextView link = (TextView) v.findViewById(R.id.link);
String text = link.getText().toString();
Uri uri = Uri.parse(text);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}

you just need to find the View and do what you want with that ( see TextView link = (TextView) v.findViewById(R.id.link); )