Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am new in android. I am using web service in android and i want to display data in gridview.plz help me.
Posted

have you taken a look at this?

Android GridView[^]
 
Share this answer
 
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.


Java
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

Java
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

Java
MyGrid.setAdapter("...");
 
Share this answer
 
Comments
AArjun24 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 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900