Android 开始另一项活动
也许你能帮我解决我的问题 我有一个单击侦听器的线性布局,现在我想开始另一个活动。 但我在打开应用程序时总是出错 失败是在我的onClick中还是在播放活动中 它在具有相同活动类的其他项目中工作。是的,我已经在清单中声明了活动 非常感谢Android 开始另一项活动,android,eclipse,Android,Eclipse,也许你能帮我解决我的问题 我有一个单击侦听器的线性布局,现在我想开始另一个活动。 但我在打开应用程序时总是出错 失败是在我的onClick中还是在播放活动中 它在具有相同活动类的其他项目中工作。是的,我已经在清单中声明了活动 非常感谢 public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.browse);
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.browse);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
viewFlipper = (ViewFlipper) findViewById(R.id.view_flipper);
in_from_left = AnimationUtils.loadAnimation(this, R.anim.in_from_left);
in_from_right = AnimationUtils.loadAnimation(this, R.anim.in_from_right);
out_to_left = AnimationUtils.loadAnimation(this, R.anim.out_to_left);
out_to_right = AnimationUtils.loadAnimation(this, R.anim.out_to_right);
LinearLayoutTitel = (LinearLayout) findViewById(R.id.LinearLayoutTitelID);
LinearLayoutAlben = (LinearLayout) findViewById(R.id.LinearLayoutAlbenID);
LinearLayoutOrdner = (LinearLayout) findViewById(R.id.LinearLayoutOrdnerID);
LinearLayoutInterpreten = (LinearLayout) findViewById(R.id.LinearLayoutInterpretenID);
//get reference to the view flipper
final ViewFlipper myViewFlipper = (ViewFlipper) findViewById(R.id.view_flipper);
//set the animation for the view that enters the screen
myViewFlipper.setInAnimation(in_from_right);
//set the animation for the view leaving th screen
myViewFlipper.setOutAnimation(out_to_right);
myViewFlipper.showNext();
LinearLayoutTitel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
Intent i = new Intent(getApplicationContext(), PlayListActivity.class);
startActivityForResult(i, 100);
myViewFlipper.showPrevious();
}
});}}
以及错误:
12-19 20:25:58.299: W/asset(21248): Copying FileAsset 0x50c81038 (zip:/data/app/de.vinzzenzz.musicplayeralpha-2.apk:/resources.arsc) to buffer size 10872 to make it aligned.
12-19 20:25:58.649: I/Adreno200-EGL(21248): <qeglDrvAPI_eglInitialize:265>: EGL 1.4 QUALCOMM build: (CL3449569)
12-19 20:25:58.649: I/Adreno200-EGL(21248): Build Date: 05/14/13 Tue
12-19 20:25:58.649: I/Adreno200-EGL(21248): Local Branch: htc2
12-19 20:25:58.649: I/Adreno200-EGL(21248): Remote Branch:
12-19 20:25:58.649: I/Adreno200-EGL(21248): Local Patches:
12-19 20:25:58.649: I/Adreno200-EGL(21248): Reconstruct Branch:
12-19 20:25:58.789: D/qdmemalloc(21248): ion: Mapped buffer base:0x54019000 size:2088960 offset:0 fd:57
12-19 20:25:58.789: D/qdmemalloc(21248): ion: Mapped buffer base:0x40010000 size:4096 offset:0 fd:58
12-19 20:25:59.290: D/qdmemalloc(21248): ion: Mapped buffer base:0x5434d000 size:2088960 offset:0 fd:60
12-19 20:25:59.290: D/qdmemalloc(21248): ion: Mapped buffer base:0x40038000 size:4096 offset:0 fd:61
12-19 20:25:59.310: D/qdmemalloc(21248): ion: Mapped buffer base:0x5454b000 size:2088960 offset:0 fd:62
12-19 20:25:59.310: D/qdmemalloc(21248): ion: Mapped buffer base:0x4004f000 size:4096 offset:0 fd:63
12-19 20:26:00.321: D/qdmemalloc(21248): ion: Mapped buffer base:0x54879000 size:2088960 offset:0 fd:65
12-19 20:26:00.321: D/qdmemalloc(21248): ion: Mapped buffer base:0x40d3e000 size:4096 offset:0 fd:66
12-19 20:26:00.341: D/qdmemalloc(21248): ion: Mapped buffer base:0x54a77000 size:2088960 offset:0 fd:67
12-19 20:26:00.341: D/qdmemalloc(21248): ion: Mapped buffer base:0x40ec2000 size:4096 offset:0 fd:68
12-19 20:26:00.351: D/qdmemalloc(21248): ion: Mapped buffer base:0x54c75000 size:2088960 offset:0 fd:69
12-19 20:26:00.351: D/qdmemalloc(21248): ion: Mapped buffer base:0x411f2000 size:4096 offset:0 fd:70
12-19 20:26:00.361: D/qdmemalloc(21248): ion: Unmapping buffer base:0x54019000 size:2088960
12-19 20:26:00.361: D/qdmemalloc(21248): ion: Unmapping buffer base:0x40010000 size:4096
12-19 20:26:00.361: D/qdmemalloc(21248): ion: Unmapping buffer base:0x5434d000 size:2088960
12-19 20:26:00.361: D/qdmemalloc(21248): ion: Unmapping buffer base:0x40038000 size:4096
12-19 20:26:00.361: D/qdmemalloc(21248): ion: Unmapping buffer base:0x5454b000 size:2088960
12-19 20:26:00.361: D/qdmemalloc(21248): ion: Unmapping buffer base:0x4004f000 size:4096
12-19 20:26:01.282: W/dalvikvm(21248): threadid=1: thread exiting with uncaught exception (group=0x417a0ba0)
12-19 20:26:01.282: E/AndroidRuntime(21248): FATAL EXCEPTION: main
12-19 20:26:01.282: E/AndroidRuntime(21248): android.content.ActivityNotFoundException: Unable to find explicit activity class {de.vinzzenzz.musicplayeralpha/de.vinzzenzz.musicplayeralpha.PlayListActivity}; have you declared this activity in your AndroidManifest.xml?
12-19 20:26:01.282: E/AndroidRuntime(21248): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java)
12-19 20:26:01.282: E/AndroidRuntime(21248): at android.app.Instrumentation.execStartActivity(Instrumentation.java)
12-19 20:26:01.282: E/AndroidRuntime(21248): at android.app.Activity.startActivityForResult(Activity.java)
12-19 20:26:01.282: E/AndroidRuntime(21248): at android.app.Activity.startActivityForResult(Activity.java)
12-19 20:26:01.282: E/AndroidRuntime(21248): at de.vinzzenzz.musicplayeralpha.BrowseActivity$1.onClick(BrowseActivity.java:58)
12-19 20:26:01.282: E/AndroidRuntime(21248): at android.view.View.performClick(View.java)
12-19 20:26:01.282: E/AndroidRuntime(21248): at android.view.View$PerformClick.run(View.java)
12-19 20:26:01.282: E/AndroidRuntime(21248): at android.os.Handler.handleCallback(Handler.java)
12-19 20:26:01.282: E/AndroidRuntime(21248): at android.os.Handler.dispatchMessage(Handler.java)
12-19 20:26:01.282: E/AndroidRuntime(21248): at android.os.Looper.loop(Looper.java)
12-19 20:26:01.282: E/AndroidRuntime(21248): at android.app.ActivityThread.main(ActivityThread.java)
12-19 20:26:01.282: E/AndroidRuntime(21248): at java.lang.reflect.Method.invokeNative(Native Method)
12-19 20:26:01.282: E/AndroidRuntime(21248): at java.lang.reflect.Method.invoke(Method.java)
12-19 20:26:01.282: E/AndroidRuntime(21248): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
12-19 20:26:01.282: E/AndroidRuntime(21248): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
12-19 20:26:01.282: E/AndroidRuntime(21248): at dalvik.system.NativeStart.main(Native Method)
您是否在清单文件中声明了播放列表活动?这是您的错误,它会告诉您一切,包括如何解决问题: android.content.ActivityNotFoundException:找不到显式活动类{de.vinzzenz.MusicLayeralpha/de.vinzzenz.MusicLayeralpha.playlActivity};您是否在AndroidManifest.xml中声明了此活动 在AndroidManifest中添加播放列表活动声明:
<activity android:name=".PlayListActivity"></activity>
我认为Klaus66是对的,您可能没有在清单文件中声明您的活动
<activity android:name="PlayListActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="com.example.app.PLAYLISTACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
12-19 20:09:45.160:E/AndroidRuntime18951:at dalvik.system.NativeStart.main本地方法12-19 20:09:45.160:E/AndroidRuntime18951:at com.android.internal.os.ZygoteInit.mainygoteinit.java 12-19 20:09:45.160:E/AndroidRuntime18951:at com.android.internal.os.zgoteinit.mainygoteinit.java 12-19 20:09:45.160:E/AndroidRuntime18951:atcom.android.internal.os.ZygoteInit$methodAndArgscaler.runZygoteInit.java请不要在这里-编辑您的问题并将其放在那里logcat中有更多内容,请发布,请也发布你的onCreate方法代码…可能你还没有在你的清单中声明playlayActivity活动回答问题。完全是android.content.ActivityNotFoundException right!:
Intent i = new Intent("com.example.app.PLAYLISTACTIVITY");
startActivity(i);