-1

我有问题。当您在设备上启动应用程序时。

图片

当我按下“返回”按钮时。

结果

安卓清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.firstgap"
    android:versionCode="1"
    android:versionName="1.0" >

    <supports-screens android:largeScreens="true" 
                    android:normalScreens="true" 
                    android:smallScreens="true" 
                    android:resizeable="true" 
                    android:anyDensity="true" />

            <uses-permission android:name="android.permission.CAMERA" /> 
            <uses-permission android:name="android.permission.VIBRATE" /> 
            <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> 
            <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 
            <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
             <uses-permission android:name="android.permission.READ_PHONE_STATE" /> 
             <uses-permission android:name="android.permission.INTERNET" /> 
             <uses-permission android:name="android.permission.RECEIVE_SMS" /> 
             <uses-permission android:name="android.permission.RECORD_AUDIO" /> 
             <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> 
             <uses-permission android:name="android.permission.READ_CONTACTS" /> 
             <uses-permission android:name="android.permission.WRITE_CONTACTS" /> 
             <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
             <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
             <uses-permission android:name="android.permission.GET_ACCOUNTS" /> 
            <uses-permission android:name="android.permission.BROADCAST_STICKY" />
    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"
        android:debuggable="true"
        android:hardwareAccelerated="true" >
        <activity
            android:name="org.apache.cordova.DroidGap"
            android:label="@string/app_name"
            android:configChanges="orientation|keyboardHidden"  >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

主要活动:

package com.example.firstgap;

import android.os.Bundle;
import org.apache.cordova.DroidGap;

public class MainActivity extends DroidGap {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.loadUrl("file:///android_asset/www/index.html");
    }
}

有什么问题?请帮忙!!!

4

1 回答 1

0

您的清单中有错误的启动器活动尝试将其更改为:

<activity
    android:name="com.example.firstgap.MainActivity"
    android:label="@string/app_name"
    android:configChanges="orientation|keyboardHidden"  >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
<activity>

你必须实例化你com.example.firstgap.MainActivity的 insthead org.apache.cordova.DroidGap

于 2013-03-08T14:57:12.317 回答