0

我正在使用 eclipse 进行 android 应用程序开发。我想将我的 android 应用程序连接到 mysql 数据库。

我从http://www.androidhive.info/2012/05/how-to-connect-android-with-php-mysql/搜索代码

日志说

11-13 01:08:49.439: E/AndroidRuntime(1037): FATAL EXCEPTION: main
11-13 01:08:49.439: E/AndroidRuntime(1037): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.bhaapapp3/com.bhaapapp3.AllProductsActivity}; have you declared this activity in your AndroidManifest.xml?
11-13 01:08:49.439: E/AndroidRuntime(1037):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1628)
11-13 01:08:49.439: E/AndroidRuntime(1037):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
11-13 01:08:49.439: E/AndroidRuntime(1037):     at android.app.Activity.startActivityForResult(Activity.java:3390)
11-13 01:08:49.439: E/AndroidRuntime(1037):     at android.app.Activity.startActivityForResult(Activity.java:3351)
11-13 01:08:49.439: E/AndroidRuntime(1037):     at android.app.Activity.startActivity(Activity.java:3587)
11-13 01:08:49.439: E/AndroidRuntime(1037):     at android.app.Activity.startActivity(Activity.java:3555)
11-13 01:08:49.439: E/AndroidRuntime(1037):     at com.bhaapapp3.MainActivity$1.onClick(MainActivity.java:34)
11-13 01:08:49.439: E/AndroidRuntime(1037):     at android.view.View.performClick(View.java:4240)
11-13 01:08:49.439: E/AndroidRuntime(1037):     at android.view.View$PerformClick.run(View.java:17721)
11-13 01:08:49.439: E/AndroidRuntime(1037):     at android.os.Handler.handleCallback(Handler.java:730)
11-13 01:08:49.439: E/AndroidRuntime(1037):     at android.os.Handler.dispatchMessage(Handler.java:92)
11-13 01:08:49.439: E/AndroidRuntime(1037):     at android.os.Looper.loop(Looper.java:137)
11-13 01:08:49.439: E/AndroidRuntime(1037):     at android.app.ActivityThread.main(ActivityThread.java:5103)
11-13 01:08:49.439: E/AndroidRuntime(1037):     at java.lang.reflect.Method.invokeNative(Native Method)
11-13 01:08:49.439: E/AndroidRuntime(1037):     at java.lang.reflect.Method.invoke(Method.java:525)
11-13 01:08:49.439: E/AndroidRuntime(1037):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
11-13 01:08:49.439: E/AndroidRuntime(1037):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11-13 01:08:49.439: E/AndroidRuntime(1037):     at dalvik.system.NativeStart.main(Native Method)
11-13 01:08:52.879: I/Process(1037): Sending signal. PID: 1037 SIG: 9

请帮帮我

和清单文件:

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

               <uses-sdk
                     android:minSdkVersion="8"
                       android:targetSdkVersion="18" />
                         <uses-permission android:name="android.permission.INTERNET"/>

             <application
                         android:allowBackup="true"
                  android:icon="@drawable/ic_launcher"
                  android:label="@string/app_name"
                  android:theme="@style/AppTheme" >
                    <activity
                     android:name="com.bhaapapp3.MainActivity"
                   android:label="@string/app_name" >
                    <intent-filter>
                         <action android:name="android.intent.action.MAIN" />

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

                               <!-- All Product Activity -->
                         <activity
                        android:name=".AllProductsActivity"
                       android:label="All Products" >
                                </activity>

                           <!-- Add Product Activity -->
                          <activity
                         android:name=".NewProductActivity"
                            android:label="Add New Product" >
                            </activity>

                      <!-- Edit Product Activity -->
                         <activity
                            android:name=".EditProductActivity"
                            android:label="Edit Product" >
                                 </activity>

                             </activity>
                             </application>

                           </manifest>
4

1 回答 1

0

假设您没有从LogCat错误描述中设置权限,这是我的 AndroidMainfest.xml 文件的内容,该文件可以访问互联网:

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

除此之外,您应该可以从Internet 下载文件。

如果这仍然对您不起作用,那么我建议您在 AndroidHive.info 上查看 Ravi Tamada 提供的视频

于 2013-11-13T06:25:19.943 回答