Saturday, April 2, 2011

Android UI Components


public class ListView extends ListActivity
{


        private ArrayList<FeildSetterGetterClass> m_feildsettergetter = null;
private FeildSetterGetterAdapter m_adapter;

public void onCreate(Bundle bundle)
{
super.onCreate(bundle);
this.setContentView(R.layout.listview);

m_InboxItemDetailss = new ArrayList<InboxItemDetails>();

this.m_adapter = new FeildSetterGetterAdapter (this, R.layout.inboxrows,
m_feildsettergetter );
setListAdapter(this.m_adapter);
getItemDetails();
ListView listView = getListView();



}


private void getItemDetails() 
{

try {
m_InboxItemDetailss = new ArrayList<FeildSetterGetterClass>();

for (int i = 0; i < nextPageInboxVideos.size(); i++)
                      {

Hashtable hashtable = (Hashtable) nextPageInboxVideos
.elementAt(i);
String time = (String) hashtable.get("time");
String targetleaf = (String) hashtable.get("targetleaf");
String summary = (String) hashtable.get("summary");
String imageName = (String) hashtable.get("image");
String name = (String) hashtable.get("name");
String title = (String) hashtable.get("title");
InboxItemDetails o1 = new InboxItemDetails();
o1.setDate(time);
o1.setIcon(imageName);
o1.setMailSummary(summary);
o1.setMailTitle(title);
o1.setName(name);
o1.setTargetLeaf(targetleaf);
m_InboxItemDetailss.add(o1);

}


} catch (Exception e) {
Log.e("BACKGROUND_PROC", e.getMessage());
}
returnRes();
}



private void returnRes() {

if (m_feildsettergetter != null && m_feildsettergetter .size() > 0) {
m_adapter.notifyDataSetChanged();
for (int i = 0; i < m_feildsettergetter .size(); i++)
m_adapter.add(m_feildsettergetter .get(i));
}

m_adapter.notifyDataSetChanged();


}





No comments:

Post a Comment