开始另一个活动

问题描述:

也许你可以帮我解决我的问题。开始另一个活动

我有一个linearLayout与点击侦听器,现在我想开始另一项活动。 但是,当我打开应用程序时,总是出现错误。

是否在我的onClickPlaylistActivity中失败?

它在另一个项目中使用相同的PlaylistActivity类。是的,我已经声明清单中的活动;)

非常感谢

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) 
+1

什么是错误 – Raghunandan

+0

12-19 20:09:45.160:E/AndroidRuntime(18951):\t at dalvik.system.NativeStart.main(Native Method) 12-19 20:09:45.160:E/AndroidRuntime(18951 ):\t at com.android.internal.os.ZygoteInit.main(ZygoteInit.java) 12-19 20:09:45.160:E/AndroidRuntime(18951):\t at com.android.internal.os.ZygoteInit.main (ZygoteInit.java) 12-19 20:09:45.160:E/AndroidRuntime(18951):\t at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java) – vinzzenzz

+0

请不要在这里 - 编辑您的问题并放在那里 –

你声明PlayListActivity清单文件?

+0

答案中的问题。 – Naddy

+0

完全'android.content.ActivityNotFoundException'正确! :) – Fllo

这是你的错误,它会告诉你一切,包括如何解决您的问题:)

android.content.ActivityNotFoundException:无法找到明确的活动类{de.vinzzenzz.musicplayeralpha/de.vinzzenzz .musicplayeralpha.PlayListActivity}; 你是否在你的AndroidManifest.xml中声明了这个活动?

添加PlayListActivity声明在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> 

,你可以拨打活动像这样

Intent i = new Intent("com.example.app.PLAYLISTACTIVITY"); 
startActivity(i);