本文整理匯總了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!");
}
}
});
}