I'm working on an Android project and I'm trying to make use of an ArrayList which is of type MyClass. I am trying to store data in the ArrayList to each of the variables within MyClass. Below is the code I am using.
Below is the Class with the variables that will be used.
class SearchData
{
public int id;
public String category;
public String company;
public String loginAction;
public String username;
public String password;
public String type;
public String appName;
}
Below is how I am initialising the ArrayList
ArrayList<SearchData> passwords = new ArrayList<SearchData>();
And below is how I am trying to add new data to the ArrayList
passwords.add(new SearchData()
{
});
I can't figure out how to then set the variables from within the class with the data that I need them to be set to. In C#, which I know more about than Java, I can do the following:
passwords.add(new SearchData()
{
id = 0,
category = "hello"
});
However, I'm not seeing any of the variables that are within the class being shown in the Intellisense help.
What am I doing wrong?