【发布时间】:2015-01-01 17:05:16
【问题描述】:
错误:
Application cannot be resolved to a type
SharedPreferences cannot be resolved to a type`
the method override must override or implement a super type method
Multiple markers at this line
PreferenceManager cannot be resolved
程序:
package com.su.vapour;
public class Common extends Application {
public static String[] email_arr;
private static SharedPreferences prefs;
@Override
public void onCreate() {
super.onCreate();
prefs = PreferenceManager.getDefaultSharedPreferences(this);
List<String> emailList = getEmailList();
email_arr = emailList.toArray(new String[emailList.size()]);
}
private List<String> getEmailList() {
List<String> lst = new ArrayList<String>();
Account[] accounts = AccountManager.get(this).getAccounts();
for (Account account : accounts) {
if (Patterns.EMAIL_ADDRESS.matcher(account.name).matches()) {
lst.add(account.name);
}
}
return lst;
}
}
【问题讨论】:
-
好像你没有导入
android.app.Application。你懂一点Java吗? -
我只知道 java littlebit 基础