Note that there are some explanatory texts on larger screens.

plurals
  1. POError in starting Android activity
    primarykey
    data
    text
    <p>In the MainActivity class within a switch statement I declared and initialised an Intent to begin another activity. Here is the snippet:</p> <pre><code>case MESSAGE_DEVICE_NAME: //save connected device name mConnectedDeviceName = msg.getData().getString(DEVICE_NAME); Toast.makeText(getApplicationContext(), "Connected to "+mConnectedDeviceName, Toast.LENGTH_SHORT).show(); Intent medPlay = new Intent(MainActivity.this, MediaPlayer.class); startActivity(medPlay); break; </code></pre> <p>Here is the MediaPlayer class:</p> <pre><code>public class MediaPlayer extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.media_player); } } </code></pre> <p>Here is the AndroidManifest.xml: </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.bt" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-permission android:name="android.permission.BLUETOOTH" /&gt; &lt;uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /&gt; &lt;uses-sdk android:minSdkVersion="6" android:targetSdkVersion="10" /&gt; &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;activity android:name="com.example.bt.MainActivity" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name=".DeviceListActivity" android:configChanges="orientation|keyboardHidden" android:label="@string/select_device" android:theme="@android:style/Theme.Light" /&gt; &lt;activity android:name=".MediaPlayer" android:configChanges="orientation|keyboardHidden" android:label="@string/media_player" android:theme="@android:style/Theme.Light" /&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <p>However I keep getting this error on LogCat Console:</p> <blockquote> <p>12-31 12:39:52.475: E/AndroidRuntime(25978): FATAL EXCEPTION: main 12-31 12:39:52.475: E/AndroidRuntime(25978): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.bt/android.media.MediaPlayer}; have you declared this activity in your AndroidManifest.xml? 12-31 12:39:52.475: E/AndroidRuntime(25978): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1405) 12-31 12:39:52.475: E/AndroidRuntime(25978): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379) 12-31 12:39:52.475: E/AndroidRuntime(25978): at android.app.Activity.startActivityForResult(Activity.java:2893) 12-31 12:39:52.475: E/AndroidRuntime(25978): at android.app.Activity.startActivity(Activity.java:3003) 12-31 12:39:52.475: E/AndroidRuntime(25978): at com.example.bt.MainActivity$1.handleMessage(MainActivity.java:147) 12-31 12:39:52.475: E/AndroidRuntime(25978): at android.os.Handler.dispatchMessage(Handler.java:99) 12-31 12:39:52.475: E/AndroidRuntime(25978): at android.os.Looper.loop(Looper.java:130) 12-31 12:39:52.475: E/AndroidRuntime(25978): at android.app.ActivityThread.main(ActivityThread.java:3806) 12-31 12:39:52.475: E/AndroidRuntime(25978): at java.lang.reflect.Method.invokeNative(Native Method) 12-31 12:39:52.475: E/AndroidRuntime(25978): at java.lang.reflect.Method.invoke(Method.java:507) 12-31 12:39:52.475: E/AndroidRuntime(25978): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 12-31 12:39:52.475: E/AndroidRuntime(25978): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 12-31 12:39:52.475: E/AndroidRuntime(25978): at dalvik.system.NativeStart.main(Native Method)</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload