GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — AndroidTutorialForBeginners/ListViewAdapter.java at master · doyoga52/AndroidTutorialForBeginners

Expand file tree

/

ListViewAdapter.java

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
81 lines (60 loc) · 2.01 KB
/

ListViewAdapter.java

Copy path

File metadata and controls

81 lines (60 loc) · 2.01 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
Adapter snaped code for Android apps that have
user id, job title and job description
*/
// adapter class
public class AdapterItems
{
public int ID;
public String JobTitle;
public String Description;
//for news details
AdapterItems( int ID, String JobTitle,String Description)
{
this. ID=ID;
this. JobTitle=JobTitle;
this. Description=Description;
}
}
//display news list
private class MyCustomAdapter extends BaseAdapter {
public ArrayList<AdapterItems> listnewsDataAdpater ;
public MyCustomAdapter(ArrayList<AdapterItems> listnewsDataAdpater) {
this.listnewsDataAdpater=listnewsDataAdpater;
}
@Override
public int getCount() {
return listnewsDataAdpater.size();
}
@Override
public String getItem(int position) {
return null;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
LayoutInflater mInflater = getLayoutInflater();
View myView = mInflater.inflate(R.layout.layout_ticket, null);
final AdapterItems s = listnewsDataAdpater.get(position);
TextView txtJobTitle=( TextView)myView.findViewById(R.id.txtJobTitle);
txtJobTitle.setText(s.JobTitle);
return myView;
}
}
//adapter class
ArrayList<AdapterItems> listnewsData = new ArrayList<AdapterItems>();
MyCustomAdapter myadapter;
//add data and view it
listnewsData.add(new AdapterItems(1,"developer"," develop apps"));
myadapter=new MyCustomAdapter(listnewsData);
ListView lsNews=(ListView)findViewById(R.id.LVNews);
lsNews.setAdapter(myadapter);//intisal with data
//update data in listview
listnewsData.add(new AdapterItems(2,"tester"," test apps"));
myadapter.notifyDataSetChanged();
//update
//set on clicklinisner
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.