本文整理汇总了Java中com.parse.ParseException类的典型用法代码示例。如果您正苦于以下问题:Java ParseException类的具体用法?Java ParseException怎么用?Java ParseException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ParseException类属于com.parse包,在下文中一共展示了ParseException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cadastrarUsuario
import com.parse.ParseException; //导入依赖的package包/类
private void cadastrarUsuario() {
//Cria objeto usuario
ParseUser usuario = new ParseUser();
usuario.setUsername(textoUsuario.getText().toString());
usuario.setEmail(textoEmail.getText().toString());
usuario.setPassword(textoSenha.getText().toString());
//salva dados do usuario
usuario.signUpInBackground(new SignUpCallback() {
@Override
public void done(ParseException e) {
if (e == null) {//sucesso ao salvar
Toast.makeText(CadastroActivity.this, "Cadastro feito com sucesso!",
Toast.LENGTH_LONG).show();
abrirLoginUsuario();
} else {//erro ao salvar
ParseErros parseErros = new ParseErros();
String erro = parseErros.getErro(e.getCode());
Toast.makeText(CadastroActivity.this, erro, Toast.LENGTH_LONG).show();
}
}
});
}
示例2: verificarLogin
import com.parse.ParseException; //导入依赖的package包/类
private void verificarLogin(String usuario, String senha) {
ParseUser.logInInBackground(usuario, senha, new LogInCallback() {
@Override
public void done(ParseUser user, ParseException e) {
if (e == null) {//sucesso no login
Toast.makeText(LoginActivity.this, "Login realizado com sucesso!!", Toast.LENGTH_LONG).show();
abrirAreaPrincipal();
} else {//erro ao logar
ParseErros parseErros = new ParseErros();
String erro = parseErros.getErro(e.getCode());
Toast.makeText(LoginActivity.this, erro, Toast.LENGTH_LONG).show();
}
}
});
}
示例3: localQuery
import com.parse.ParseException; //导入依赖的package包/类
private void localQuery(){
ParseQuery<Kid> lQuery = ParseQuery.getQuery(Kid.class).fromLocalDatastore();
lQuery.orderByAscending("createdAt");
lQuery.findInBackground(new FindCallback<Kid>() {
@Override
public void done(List<Kid> list, ParseException e) {
if (e == null) {
kidArrayList.clear();
kidArrayList.addAll(list);
fillHashMap();
adapter = new AddAttendanceAdapter(AddAttendance.this,kidArrayList,activityMap);
listView.setAdapter(adapter);
listView.invalidate();
}
}
});
}
示例4: saveMethod
import com.parse.ParseException; //导入依赖的package包/类
private void saveMethod(){
//will save the data
if(dateText.getText().toString().equals("") || dateText.getText().toString().equals(" ") || dateText.getText() == null){ //but before saving we will make sure that date is there
Toast.makeText(getApplicationContext(), "Attendance date is required",Toast.LENGTH_SHORT).show();
// Snackbar.make(findViewById(R.id.activity_add_attendance),
// "Attendance date is required", Snackbar.LENGTH_SHORT).show();
}else{
List<String> kidsIds = new ArrayList<>();
for (int i = 0; i < adapter.map.size() ; i++) {
if (adapter.map.get(kidArrayList.get(i))){
kidsIds.add(kidArrayList.get(i).getObjectId());
}
}
attendance.setDate(dateText.getText().toString());
attendance.setKidsIds(kidsIds);
attendance.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
if (e == null){
Toast.makeText(getApplicationContext(),"Saved successfully.",Toast.LENGTH_LONG).show();
end();
}
}
});
}
}
示例5: logIn
import com.parse.ParseException; //导入依赖的package包/类
private void logIn() {
prefs = getSharedPreferences("prefFile", 0);
String userName = prefs.getString("userName",null);
String password = prefs.getString("password",null);
user.logInInBackground(userName, password, new LogInCallback() {
@Override
public void done(ParseUser parseUser, @Nullable ParseException e) {
if (e == null){
toaster("Login successful!","l");
}else {
toaster("Failed to connect!","l");
}
}
});
}
示例6: localQuery
import com.parse.ParseException; //导入依赖的package包/类
private void localQuery(){
ParseQuery<Kid> query = ParseQuery.getQuery(Kid.class).fromLocalDatastore();
query.orderByAscending("createdAt");
query.findInBackground(new FindCallback<Kid>() {
@Override
public void done(List<Kid> list, @Nullable ParseException e) {
if (e == null && list.size()!=0) {
kidArrayList.clear();
kidArrayList.addAll(list);
applyAttendanceToKids();
adapter.notifyDataSetChanged();
listView.invalidate();
}
}
});
}
示例7: serverQuery
import com.parse.ParseException; //导入依赖的package包/类
private void serverQuery() {
ParseQuery<Kid> query = ParseQuery.getQuery(Kid.class);
query.orderByAscending("createdAt");
query.findInBackground(new FindCallback<Kid>() {
@Override
public void done(List<Kid> list, @Nullable ParseException e) {
if (e == null){
kidArrayList.clear();
kidArrayList.addAll(list);
Kid.pinAllInBackground(kidArrayList);
applyAttendanceToKids();
adapter.notifyDataSetChanged();
listView.invalidate();
}else if(checkConnection()){
toaster("Error getting data from Server\nWorking offline!","l");
}
}
});
}
示例8: autoLogin
import com.parse.ParseException; //导入依赖的package包/类
public void autoLogin(){
if (checkConnection()){
String userName = prefs.getString("userName",null);
String password = prefs.getString("password",null);
user.logInInBackground(userName, password, new LogInCallback() {
@Override
public void done(ParseUser parseUser, @Nullable ParseException e) {
if (e == null){
isLoggedIn = true;
splash(1500);
Snackbar.make(findViewById(R.id.activity_splash),"Login successful..",Snackbar.LENGTH_LONG).show();
}
}
});
}else {
isLoggedIn = false;
splash(4000);
Snackbar.make(findViewById(R.id.activity_splash),"You are offline, Working on local data",Snackbar.LENGTH_LONG).show();}
}
示例9: incrementNumberOfVisits
import com.parse.ParseException; //导入依赖的package包/类
private void incrementNumberOfVisits(){
int i;
if(myKid.getNumberOfVisits() == null){
i = 0;
}else{
i = Integer.parseInt(myKid.getNumberOfVisits());}
i++;
myKid.setNumberOfVisits(String.valueOf(i));
myKid.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
if (e == null){
Toast.makeText(getApplicationContext(),"Saved successfully",Toast.LENGTH_LONG).show();
}else {
Toast.makeText(getApplicationContext(),"Error calculating the number of visits!",Toast.LENGTH_LONG).show();
}
}
});
}
示例10: start
import com.parse.ParseException; //导入依赖的package包/类
@Kroll.method
public void start()
{
setState(STATE_RUNNING);
// App opens analytics
ParseAnalytics.trackAppOpenedInBackground(TiApplication.getAppRootOrCurrentActivity().getIntent());
ParseInstallation.getCurrentInstallation().put("androidId", getAndroidId());
ParseInstallation.getCurrentInstallation().saveInBackground(new SaveCallback() {
public void done(ParseException e) {
if (e != null) {
Log.e(TAG, "Installation initialization failed: " + e.getMessage());
}
// fire event
try {
JSONObject pnData = new JSONObject();
pnData.put("objectId", getObjectId());
pnData.put("installationId", getCurrentInstallationId());
KrollDict data = new KrollDict(pnData);
module.fireEvent("installationId", data);
} catch (JSONException e1) {
Log.e(TAG, "InstallationId event failed: " + e1.getMessage());
}
}
});
}
示例11: getAnimeListByUrl
import com.parse.ParseException; //导入依赖的package包/类
@Override
public List<Anime> getAnimeListByUrl(String url) {
ArrayList<Anime> animeList = new ArrayList<>();
ParseQuery<AnimeRecord> query = AnimeRecord.getQuery();
try {
List<AnimeRecord> animeRecords = query.whereContains("url", url).find();
for (AnimeRecord record : animeRecords) {
Anime anime = AnimeRecord.toAnime(record);
if (anime != null)
animeList.add(anime);
}
} catch (ParseException e) {
WriteLog.appendLogException(TAG, "getAnimeListByUrl(" + url + ") failed", e);
}
return animeList;
}
示例12: getAnimeListByTitle
import com.parse.ParseException; //导入依赖的package包/类
@Override
public List<Anime> getAnimeListByTitle(String title) {
ArrayList<Anime> animeList = new ArrayList<>();
ParseQuery<AnimeRecord> query = AnimeRecord.getQuery();
try {
List<AnimeRecord> animeRecords = query.whereContains("title", title).find();
for (AnimeRecord record : animeRecords) {
Anime anime = AnimeRecord.toAnime(record);
if (anime != null)
animeList.add(anime);
}
} catch (ParseException e) {
WriteLog.appendLogException(TAG, "getAnimeListByTitle(" + title + ") failed", e);
}
return animeList;
}
示例13: getContactInfos
import com.parse.ParseException; //导入依赖的package包/类
public void getContactInfos(List<String> usernames, final EMValueCallBack<List<EaseUser>> callback) {
ParseQuery<ParseObject> pQuery = ParseQuery.getQuery(CONFIG_TABLE_NAME);
pQuery.whereContainedIn(CONFIG_USERNAME, usernames);
pQuery.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> arg0, ParseException arg1) {
if (arg0 != null) {
List<EaseUser> mList = new ArrayList<EaseUser>();
for (ParseObject pObject : arg0) {
EaseUser user = new EaseUser(pObject.getString(CONFIG_USERNAME));
ParseFile parseFile = pObject.getParseFile(CONFIG_AVATAR);
if (parseFile != null) {
user.setAvatar(parseFile.getUrl());
}
user.setNick(pObject.getString(CONFIG_NICK));
EaseCommonUtils.setUserInitialLetter(user);
mList.add(user);
}
callback.onSuccess(mList);
} else {
callback.onError(arg1.getCode(), arg1.getMessage());
}
}
});
}
示例14: signUp
import com.parse.ParseException; //导入依赖的package包/类
private void signUp(){
ParseUser user = new ParseUser();
user.setUsername(USER_NAME);
user.setPassword(PASSWORD);
user.setEmail(EMAIL);
user.signUpInBackground(new SignUpCallback() {
public void done(ParseException e) {
if (e == null) {
login();
Toast.makeText(getApplicationContext(), "Login cadastrado com sucesso", Toast.LENGTH_SHORT).show();
}else{
Toast.makeText(getApplicationContext(), "Erro ao cadastrar login", Toast.LENGTH_SHORT).show();
}
}
});
}
示例15: setUpParse
import com.parse.ParseException; //导入依赖的package包/类
public static void setUpParse(Context context) {
Parse.enableLocalDatastore(context);
Parse.initialize(context, "SUA_APPLICATION_ID", "SUA CLIENT_KEY");
ParseInstallation.getCurrentInstallation().saveInBackground();
ParseUser.enableAutomaticUser();
ParseACL defaultACL = new ParseACL();
defaultACL.setPublicReadAccess(true);
defaultACL.setPublicWriteAccess(true);
ParsePush.subscribeInBackground(Constants.CHANNEL, new SaveCallback() {
@Override
public void done(ParseException error) {
if (error == null) {
Log.i(Constants.TAG, "Successfully subscribed to Parse!");
}else{
Log.i(Constants.TAG, "Error subscribed to Parse!");
}
}
});
}