在android中重置应用程序类
我有一个名为applicationGlobal的应用程序类,它有许多对象,比如字符串、整数。我想在某一点将它们全部设置为默认值。这是我的应用程序全局类:在android中重置应用程序类,android,Android,我有一个名为applicationGlobal的应用程序类,它有许多对象,比如字符串、整数。我想在某一点将它们全部设置为默认值。这是我的应用程序全局类: public class appliationGlobal extends Application { private String auth_token = ""; private String userID = ""; private String groupID = ""; private String firstVisit = "";
public class appliationGlobal extends Application {
private String auth_token = "";
private String userID = "";
private String groupID = "";
private String firstVisit = "";
private String activeSubscription = "";
private int stateSelection = 1;
private int clickUserId = 8;
private String groupType = "";
private String currentLoggedUserId = "";
private String checkIn_Id = "";
private String initial_state = "";
private String finial_state = "";
private String[] userIds = new String[8];
private String checkin_status = "insert";
private ArrayList<String> lstfeeling;
private String userProfile = null;
private boolean[] badgeCheck = new boolean[8];
SharedPreferences pref;
private String messageCounts[] = new String[8];
private String messageprofilecount = "0";
public String getMessageprofilecount() {
return messageprofilecount;
}
public void setMessageprofilecount(String messageprofilecount) {
this.messageprofilecount = messageprofilecount;
}
private Boolean checkcount = false;
public Boolean getCheckcount() {
return checkcount;
}
public void setCheckcount(Boolean checkcount) {
this.checkcount = checkcount;
}
public ArrayList<String> getLstfeeling() {
return lstfeeling;
}
public void setLstfeeling(ArrayList<String> lstfeeling) {
this.lstfeeling = lstfeeling;
}
public String getCheckIn_Id() {
return checkIn_Id;
}
public void setCheckIn_Id(String checkIn_Id) {
this.checkIn_Id = checkIn_Id;
}
public String getInitial_state() {
return initial_state;
}
public void setInitial_state(String initial_state) {
this.initial_state = initial_state;
}
public String getFinial_state() {
return finial_state;
}
public void setFinial_state(String finial_state) {
this.finial_state = finial_state;
}
public String getCheckin_status() {
return checkin_status;
}
public void setCheckin_status(String checkin_status) {
this.checkin_status = checkin_status;
}
public int getStateSelection() {
return stateSelection;
}
public void setStateSelection(int stateSelection) {
this.stateSelection = stateSelection;
}
ArrayList<String> groupNames = new ArrayList<String>();
public String getAuth_token() {
return auth_token;
}
public void setAuth_token(String auth_token) {
this.auth_token = auth_token;
}
public String getUserID() {
return userID;
}
public void setUserID(String userID) {
this.userID = userID;
}
public String getGroupID() {
return groupID;
}
public void setGroupID(String groupID) {
this.groupID = groupID;
}
public String getFirstVisit() {
return firstVisit;
}
public void setFirstVisit(String firstVisit) {
this.firstVisit = firstVisit;
}
public String getActiveSubscription() {
return activeSubscription;
}
public void setActiveSubscription(String activeSubscription) {
this.activeSubscription = activeSubscription;
}
public ArrayList<String> getGroupNames() {
return groupNames;
}
public void setGroupNames(ArrayList<String> groupNames) {
this.groupNames = groupNames;
}
public String getGroupType() {
return groupType;
}
public void setGroupType(String groupType) {
this.groupType = groupType;
}
public String getUserProfile() {
return userProfile;
}
public void setUserProfile(String userProfile) {
this.userProfile = userProfile;
}
public String getCurrentLoggedUserId() {
return currentLoggedUserId;
}
public void setCurrentLoggedUserId(String currentLoggedUserId) {
this.currentLoggedUserId = currentLoggedUserId;
}
public boolean getBadgeCheck(int x) {
return badgeCheck[x];
}
public void setBadgeCheck(int x, boolean badgeC) {
this.badgeCheck[x] = badgeC;
}
public String getUserIds(int x) {
return userIds[x];
}
public void setUserIds(int x, String userI) {
this.userIds[x] = userI;
}
public int getIdNumber(String x) {
for (int trp = 0; trp < 8; trp++) {
if (userIds[trp].equals(x))
return trp;
}
return 0;
}
public String getMessageCounts(int x) {
return messageCounts[x];
}
public void setMessageCounts(int x, String messageC) {
this.messageCounts[x] = messageC;
}
public int getClickUserId() {
return clickUserId;
}
public void setClickUserId(int x) {
this.clickUserId = x;
}
}
公共类appliationGlobal扩展应用程序{
私有字符串auth_token=“”;
私有字符串userID=“”;
私有字符串groupID=“”;
私人字符串firstVisit=“”;
私有字符串activeSubscription=“”;
私有int stateSelection=1;
private int clickUserId=8;
私有字符串groupType=“”;
私有字符串currentLoggedUserId=“”;
私有字符串签入_Id=“”;
私有字符串初始_state=“”;
私有字符串final_state=“”;
私有字符串[]userid=新字符串[8];
私有字符串签入\u status=“插入”;
私人ArrayList情感;
私有字符串userProfile=null;
私有布尔值[]badgeCheck=新布尔值[8];
共享参考优先;
私有字符串messageCounts[]=新字符串[8];
私有字符串messageprofilecount=“0”;
公共字符串getMessageprofilecount(){
返回messageprofilecount;
}
public void setMessageprofilecount(字符串messageprofilecount){
this.messageprofilecount=messageprofilecount;
}
私有布尔校验计数=false;
公共布尔getCheckcount(){
返回支票计数;
}
公共void setCheckcount(布尔值checkcount){
this.checkcount=checkcount;
}
公共数组列表getlstfeering(){
回归情感;
}
公共无效setLstfeeling(ArrayList lstfeeling){
this.lstfeering=lstfeering;
}
公共字符串getCheckIn_Id(){
返回签入Id;
}
public void setCheckIn_Id(字符串checkIn_Id){
this.checkIn_Id=checkIn_Id;
}
公共字符串getInitial_state(){
返回初始状态;
}
public void setInitial_状态(字符串初始_状态){
this.initial_state=初始_状态;
}
公共字符串getFinial_state(){
返回最终状态;
}
公共void setFinial_状态(字符串finial_状态){
this.finial_state=最终_state;
}
公共字符串getCheckin_status(){
返回签入状态;
}
公共无效设置签入状态(字符串签入状态){
this.checkin_status=签入_status;
}
public int getStateSelection(){
返回状态选择;
}
public void setStateSelection(int stateSelection){
this.stateSelection=stateSelection;
}
ArrayList groupNames=新的ArrayList();
公共字符串getAuth_令牌(){
返回auth_令牌;
}
public void setAuth_令牌(字符串auth_令牌){
this.auth\u token=auth\u token;
}
公共字符串getUserID(){
返回用户标识;
}
public void setUserID(字符串userID){
this.userID=userID;
}
公共字符串getGroupID(){
返回groupID;
}
public void setGroupID(字符串groupID){
this.groupID=groupID;
}
公共字符串getFirstVisit(){
回访;
}
公共无效setFirstVisit(字符串firstVisit){
this.firstVisit=首次访问;
}
公共字符串getActiveSubscription(){
退订;
}
public void setActiveSubscription(字符串activeSubscription){
this.activeSubscription=activeSubscription;
}
公共ArrayList getGroupNames(){
返回组名;
}
public void setGroupNames(ArrayList groupNames){
this.groupNames=组名;
}
公共字符串getGroupType(){
返回组类型;
}
公共void setGroupType(字符串groupType){
this.groupType=groupType;
}
公共字符串getUserProfile(){
返回userProfile;
}
public void setUserProfile(字符串userProfile){
this.userProfile=userProfile;
}
公共字符串getCurrentLoggedUserId(){
返回currentLoggedUserId;
}
public void setCurrentLoggedUserId(字符串currentLoggedUserId){
this.currentLoggedUserId=currentLoggedUserId;
}
公共布尔getBadgeCheck(int x){
返回卡[x];
}
公共无效setBadgeCheck(整数x,布尔标记c){
this.badgeCheck[x]=badgeC;
}
公共字符串getUserIds(intx){
返回userid[x];
}
public void setuserid(int x,String userI){
this.userIds[x]=userI;
}
公共整数getIdNumber(字符串x){
对于(int-trp=0;trp<8;trp++){
if(userIds[trp].equals(x))
返回trp;
}
返回0;
}
公共字符串getMessageCounts(int x){
返回消息计数[x];
}
公共void setMessageCounts(整数x,字符串messageC){
this.messageCounts[x]=messageC;
}
public int getClickUserId(){
返回clickUserId;
}
public void setClickUserId(int x){
this.clickUserId=x;
}
}
是否可以通过某个内置函数将它们全部设置为默认值?在需要更改时,通过调用方法将它们设置为默认值。我知道,但是没有默认函数吗?如果有很多变量,这会有点痛苦:)据我所知,没有可以将用户设置为默认值的默认函数。对不起,哈哈,没必要道歉。谢谢您的回复:)