简体   繁体   English

当我关闭应用程序n重新打开它时,使用parse.com lib创建应用程序,不幸的是它停止了

[英]creating app using parse.com lib.when i close app n reopen it ,it says unfortunately stopped

I have created activities such as splash screen, login page, register page and homepage, but when I close my app and try to reopen, it shows error unfortunately stopped . 我已经创建了活动,例如初始屏幕,登录页面,注册页面和主页,但是当我关闭我的应用程序并尝试重新打开时, 不幸地显示了错误停止

Below is my splash screen activity code: 以下是我的启动画面活动代码:

import android.app.Activity;
import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import com.parse.Parse;
import com.parse.ParseUser;

public class Splash extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        Parse.enableLocalDatastore(this);

        Parse.initialize(this, "app. id.(i can't show this privacy purpose :))",
            "Clint key(same here for privecy i will not show) ");

        Thread timer=new Thread(){
            public void run(){
                try{
                    sleep(5000);
                }catch (Exception e){
                    e.printStackTrace();

                }finally {
                    ParseUser currentUser = ParseUser.getCurrentUser();
                    if (currentUser != null) {
                        // do stuff with the user
                        Intent taketohome=new Intent(Splash.this,HomepageActivity.class);
                        startActivity(taketohome);
                    } else {
                        // show the signup or login screen
                        Intent taketologinpage=new Intent(Splash.this, LoginActivity.class);
                        startActivity(taketologinpage);
                    }
                }
            }

        };timer.start();
    }

    @Override
    protected void onPause() {
        super.onPause();
        finish();
    }
}

Actually this is happening because you are doing Parse.intailize in onCreate method of activity. 实际上发生这种情况是因为您正在活动的onCreate方法中执行Parse.intailize。 Instead you can make an application class and intialize Parse there. 相反,您可以创建一个应用程序类并在那里初始化Parse。 Hope it explains well 希望它能很好地解释

Caused by: java.lang.IllegalStateException: ParsePlugins is already initialized 引起原因:java.lang.IllegalStateException:ParsePlugins已经初始化

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 启动应用程序时,我将parse.com用作后端不幸的是发生了停止的错误,请参见下面的datails - i am using parse.com as backend when i start app Unfortunately stopped error occurs ,see datails below thanks 不幸的是,使用ImageView时应用已停止 - unfortunately app has stopped when using ImageView 解析登录:“很遗憾,(应用程序)已停止。” - Parse Login: “Unfortunately, (App) has stopped.” 如何调试显示“不幸的是”的 Android 应用程序<app>停止工作”? - How to debug an Android app that says "unfortunately <app> stopped working"? 我的应用程式表示已不幸停止运作(Android应用程式) - My app says that it has unfortunately stopped working(android app) 删除actionBar会使我的应用程序崩溃(提示不幸的是,应用程序已停止) - Removing actionBar crashes my app (It says Unfortunately, app has stopped) 每当我在模拟器上运行该应用程序时,它都会说不幸的是该应用程序已停止工作并且日志读取以下行 - whenever i run the app on emulator it says unfortunately the app has stopped working and the log reads the below lines 每当我在模拟器上运行该应用程序时,它都会说不幸的是该应用程序已停止工作并且日志如下所示 - whenever i run the app on emulator it says unfortunately the app has stopped working and the log reads as below 当我要将字符串转换为Long时,“不幸的是,应用程序已停止” - “Unfortunately app has stopped” when I want to convert the string to Long 上传到parse.com时在android应用上解析通知 - Parse notification on android app when there is upload to parse.com
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM