使用解析库在Android之前,必须先调用Parse.initialize() [英] You must call Parse.initialize() before using Parse library on Android

查看:204
本文介绍了使用解析库在Android之前,必须先调用Parse.initialize()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个照片共享应用程序为Android使用的Parse.com平台的后端。

我有一个主要活动在那里我从解析服务器获取的照片,并在这里这次活动我有开始捕捉照片的活动按钮!

当我要上传的解析服务器上的照片将出现问题 - 我得到这个消息:

 您必须使用解析库之前调用Parse.initialize(....)
 

但我已经初始化解析库在我的开机画面的活动 - 在onCreate方法

我也想提一提,该应用程序的工作,但是当我改变了我的主要活动类此问题开始发生!

你有任何想法是什么问题?

解决方案

 进口com.parse.Parse;
    进口android.app.Application;

    公共类应用程序扩展应用{
      @覆盖
      公共无效的onCreate(){
        super.onCreate();

        Parse.enableLocalDatastore(本);
        Parse.initialize(这一点,PARSE_APPLICATION_ID,PARSE_CLIENT_KEY);
      }
    }
 

AndroidManifest.xml中

 <应用
        机器人:名称=yourpackagename.App
。
。
。
< /用途>
 

I'm developing a photo sharing app for Android that uses the Parse.com platform for the backend.

I have a Main Activity where I'm fetching the photos from the Parse server and also here in this activity I have a button that starts a capture photo activity!

The problem occurs when I want to upload the photo on the Parse server - I get this message:

You must call Parse.initialize(....) before using Parse library 

but I'm already initializing Parse library in my Splash Screen activity - in the onCreate method!

I also wanted to mention that the app worked but when I've changed the Main Activity class this problems started to occur!

Do you have any idea what is the problem?

解决方案

import com.parse.Parse;
    import android.app.Application;

    public class App extends Application {
      @Override
      public void onCreate() {
        super.onCreate();

        Parse.enableLocalDatastore(this);
        Parse.initialize(this, PARSE_APPLICATION_ID, PARSE_CLIENT_KEY);
      }
    }

AndroidManifest.xml

<application
        android:name="yourpackagename.App"
.
.
.
</application>

这篇关于使用解析库在Android之前,必须先调用Parse.initialize()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆