Click here to Skip to main content
11,411,494 members (61,427 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Android
I am new in android. I am using web service in android and i want to display data in gridview.plz help me.
Posted 4-Apr-11 1:10am
drenu483
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

have you taken a look at this?

Android GridView[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

First create the Class with necessary properties which the web service gives you.

Ex. if web service giving you dataset of employee the create class like below with getter and setter methods.


public class Employee {
 
	private String EmployeeID;
	private String Name;
	private String Genre;
	private String Email;
	
 
	public String getEmployeeID() {
		return EmployeeID;
	}
 
	public void setEmployeeID(String EmployeeID) {
		this.EmployeeID = EmployeeID;
	}
 
	
 
	public String getEmail() {
		return Email;
	}
 
	public void setEmail(String Email) {
		this.Email = Email;
	}
 
	
	public String getName() {
		return Name;
	}
 
	public void setName(String Name) {
		this.Name = Name;
	}
 
}


Then make a Arraylist of "Employee" class like

ArrayList<employee> emplist=new ArrayList<employee>();</employee></employee>

Extract data from your web service responce to new object of "Employee" and then add that object to ArrayList

Then make the BaseAdapter and bind it to gridview like

MyGrid.setAdapter("...");
  Permalink  
Comments
AArjun24 at 5-Apr-12 0:42am
   
I can create a class with getter and setter method.but i dont understand how can i
Extract data from my web service responce to new object my Class.plz give me steps to extract data into my class and how can i bind it to gridview
beniv at 22-Oct-13 4:37am
   
did you resolve this i have the same problem

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 223
1 Sergey Alexandrovich Kryukov 195
2 Sascha Lefévre 155
3 ProgramFOX 90
4 Dave Kreskowiak 90
0 Sergey Alexandrovich Kryukov 8,920
1 OriginalGriff 7,128
2 Maciej Los 3,440
3 Abhinav S 3,248
4 Peter Leow 3,059


Advertise | Privacy | Mobile
Web02 | 2.8.150414.5 | Last Updated 25 Nov 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100