Android Tutorial Android Tutorial Part II

View the Project on GitHub FatFractal/hoodyoodoo

The WouldYa Class

Now, with the two Celebrity objects retrieved, we need to add the logic to create and persist the players WouldYa results to the API. This involves creating a new class, that we will call a WouldYa.

Adding the WouldYa class

Create the file WouldYa.java in the package com.fatfractal.droidapp.model. Then, add the instance variables we need:

private String m_selectedGuid = null;
private String m_rejectedGuid = null;

Adding getter and setter methods

We follow a typical object model pattern, and create getter and setter methods for the instance variables added above.

public WouldYa() {}

public String getSelectedGuid()           {return m_selectedGuid;}
public String getRejectedGuid()           {return m_rejectedGuid;}

public void setSelectedGuid(String param) {m_selectedGuid = param;}
public void setRejectedGuid(String param) {m_rejectedGuid = param;}

NEXT: Modify WouldYaActivity