在 Android Studio 中创建 android 模型 class
Create an android model class in Android Studio
我正在尝试创建一个模型 class,就像我们在 Eclipse ADT 中所做的那样,只需创建一个文件夹并引用它,但在 Android Studio 中我有点困惑。
如何在 Android Studio 中创建模型 class,如果我右键单击 package->New-> 哪个文件夹是合适的?
你可以这样做
right click on any package like com.example.setu
and then
New->package
.Here just give the name like model
.Then it will create a
folder under that package.You can add POJO classes here by just right clicking New->Java class
您可以通过简单的步骤创建模型class
创建一个 java class 名称
public class Wallet_Model
{ String date,amount,storeid,storename,description,type;
public Wallet_Model(String date, String amount, String storeid, String storename, String description, String type) {
this.date = date;
this.amount = amount;
this.storeid = storeid;
this.storename = storename;
this.description = description;
this.type = type;
}
public Wallet_Model() {
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getAmount() {
return amount;
}
public void setAmount(String amount) {
this.amount = amount;
}
public String getStoreid() {
return storeid;
}
public void setStoreid(String storeid) {
this.storeid = storeid;
}
public String getStorename() {
return storename;
}
public void setStorename(String storename) {
this.storename = storename;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
我正在尝试创建一个模型 class,就像我们在 Eclipse ADT 中所做的那样,只需创建一个文件夹并引用它,但在 Android Studio 中我有点困惑。
如何在 Android Studio 中创建模型 class,如果我右键单击 package->New-> 哪个文件夹是合适的?
你可以这样做
right click on any package like
com.example.setu
and thenNew->package
.Here just give the name likemodel
.Then it will create a folder under that package.You can add POJO classes here by just right clicking New->Java class
您可以通过简单的步骤创建模型class
创建一个 java class 名称
public class Wallet_Model
{ String date,amount,storeid,storename,description,type;
public Wallet_Model(String date, String amount, String storeid, String storename, String description, String type) {
this.date = date;
this.amount = amount;
this.storeid = storeid;
this.storename = storename;
this.description = description;
this.type = type;
}
public Wallet_Model() {
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getAmount() {
return amount;
}
public void setAmount(String amount) {
this.amount = amount;
}
public String getStoreid() {
return storeid;
}
public void setStoreid(String storeid) {
this.storeid = storeid;
}
public String getStorename() {
return storename;
}
public void setStorename(String storename) {
this.storename = storename;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}