无法从android中的parse.com检索文件数据

时间:2015-09-12 02:18:25

标签: java android

我正在尝试检索parse.com中存在的文件数据。但是,我收到以下错误。

FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity  
ComponentInfo: java.lang.NullPointerException

发布的是我的Main_activity.java文件,其中包含#oncreate方法

  protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_activity);
        Parse.enableLocalDatastore(this);
        Parse.initialize(this, "", "");
        ParseObject par = new ParseObject("TestObject");
        ParseFile applicantResume = (ParseFile)par.get("file");
        applicantResume.getDataInBackground(new GetDataCallback() {
        public void done(byte[] data, ParseException e) {
            if (e == null) {
                // data has the bytes for the resume

                System.out.println(data);
            } else {
                // something went wrong
                System.out.println(e);
            }
        }
    });

这是我的Android_Manifest.xml文件

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
    android:allowBackup="true"
    android:icon="@drawable/malware_icon"
    android:label="Rishii"
    android:theme="@style/Theme.AppCompat" >

   <application
        android:name=".ToDoList"
        android:icon="@drawable/rishik"
        android:label="Parse"
        android:allowBackup="true">
    </application>


    <activity
        android:name=".Main_activity"
        android:label="@string/Malware_detector" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".ToDoList"
        android:label="@string/Malware_detector" >
    </activity>
    <activity android:name=".first_class" />
    <activity android:name=".rishi" />
    <activity android:name=".Register" />
</application>

发布的是我的Android_Manifest.xml

   E/AndroidRuntime﹕ FATAL EXCEPTION: main
   Process: com.example.rishii.introduction, PID:   
    java.lang.RuntimeException: Unable to start activity ComponentInfo:  
    java.lang.NullPointerException
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
        at android.app.ActivityThread.access$800(ActivityThread.java:135)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:5021)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:827)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:643)
        at dalvik.system.NativeStart.main(Native Method)
 Caused by: java.lang.NullPointerException
        at com.example.rishii.introduction.Main_activity.onCreate(Main_activity.java:71)
        at android.app.Activity.performCreate(Activity.java:5231)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1090)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)

0 个答案:

没有答案