我只使用android studio一天。我必须为我的学校项目创建一个应用程序,我做了,我编程了一切都很顺利但是当我通过adb运行它获得预期的主要活动时,当我点击按钮去另一个活动它崩溃说&# 34;不幸的是,appname已停止工作"
package com.example.lenovo.shop_easy;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
public class frontpagee extends Activity
{
public void sendMessage(View view){
Intent intent = new Intent(frontpagee.this, catalog.class);
startActivity(intent);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_frontpagee, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
XML就像这样
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".frontpagee"
android:background="@drawable/back">
<ImageView
android:layout_width="472dp"
android:layout_height="500dp"
android:id="@+id/imageView11"
android:src="@mipmap/cover"
android:layout_gravity="center_horizontal|top"
android:contentDescription="@string/content" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/text12"
android:id="@+id/button11"
android:layout_gravity="center_horizontal|bottom"
android:textSize="@dimen/size2"
android:clickable="true"
android:onClick="sendMessage"/>
</FrameLayout>
我想从这个活动转移到名为Catalog java的第二个ACTIVITY
package com.example.lenovo.shop_easy;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
public class catalog extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_catalog);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_catalog, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
public void sendMessage(View view) {
Intent intent = new Intent(catalog.this, product1.class);
startActivity(intent);
}
public void sendMessage1(View view) {
Intent intent = new Intent(catalog.this, PRODUCT2.class);
startActivity(intent);
}
public void sendMessage2(View view) {
Intent intent = new Intent(catalog.this, PRODUCT3.class);
startActivity(intent);
}
public void sendMessage3(View view) {
Intent intent = new Intent(catalog.this, product4.class);
startActivity(intent);
}
public void sendMessage4(View view) {
Intent intent = new Intent(catalog.this, product5.class);
startActivity(intent);
}
public void sendMessage5(View view) {
Intent intent = new Intent(catalog.this, product6.class);
startActivity(intent);
}
public void sendMessage6(View view) {
Intent intent = new Intent(catalog.this, product7.class);
startActivity(intent);
}
public void sendMessage7(View view) {
Intent intent = new Intent(catalog.this, product8.class);
startActivity(intent);
}
public void sendMessage8(View view) {
Intent intent = new Intent(catalog.this, product9.class);
startActivity(intent);
}
public void sendMessage9(View view) {
Intent intent = new Intent(catalog.this, product10.class);
startActivity(intent);
}
}
代码是正确的说Android工作室,但当我在我的手机上运行adb它安装应用程序,一切顺利,但当我打开应用程序时,它显示主要活动,但当我点击按钮它崩溃。请帮忙
这里的主要xml文件也是
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.lenovo.shop_easy" >
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".frontpagee"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".catalog"
android:label="@string/title_activity_catalog" >
</activity>
<activity
android:name=".product1"
android:label="@string/title_activity_product1" >
</activity>
<activity
android:name=".PRODUCT2"
android:label="@string/title_activity_product2" >
</activity>
<activity
android:name=".PRODUCT3"
android:label="@string/title_activity_product3" >
</activity>
<activity
android:name=".product4"
android:label="@string/title_activity_product4" >
</activity>
<activity
android:name=".product5"
android:label="@string/title_activity_product5" >
</activity>
<activity
android:name=".product6"
android:label="@string/title_activity_product6" >
</activity>
<activity
android:name=".product7"
android:label="@string/title_activity_product7" >
</activity>
<activity
android:name=".product8"
android:label="@string/title_activity_product8" >
</activity>
<activity
android:name=".product9"
android:label="@string/title_activity_product9" >
</activity>
<activity
android:name=".product10"
android:label="@string/title_activity_product10" >
</activity>
</application>
</manifest>
该怎么做
这里是logcat
09-06 21:28:40.349 19239-19239/? D/dalvikvm﹕ Late-enabling CheckJNI
09-06 21:28:40.359 19239-19245/? D/dalvikvm﹕ Debugger has detached; object registry had 1 entries
09-06 21:28:40.569 19239-19239/? D/dalvikvm﹕ GC_FOR_ALLOC freed 55K, 77% free 2619K/10920K, paused 29ms, total 29ms
09-06 21:28:40.609 19239-19239/? I/dalvikvm-heap﹕ Grow heap (frag case) to 13.315MB for 9002464-byte allocation
09-06 21:28:40.639 19239-19243/? D/dalvikvm﹕ GC_CONCURRENT freed 1K, 43% free 11409K/19712K, paused 2ms+1ms, total 24ms
09-06 21:28:40.759 19239-19239/? D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 43% free 11409K/19712K, paused 13ms, total 14ms
09-06 21:28:40.789 19239-19239/? I/dalvikvm-heap﹕ Grow heap (frag case) to 28.577MB for 16004368-byte allocation
09-06 21:28:40.839 19239-19243/? D/dalvikvm﹕ GC_CONCURRENT freed <1K, 24% free 27039K/35344K, paused 4ms+8ms, total 51ms
09-06 21:28:40.969 19239-19239/? D/dalvikvm﹕ GC_FOR_ALLOC freed 8803K, 45% free 19530K/35344K, paused 11ms, total 11ms
09-06 21:28:40.989 19239-19239/? I/dalvikvm-heap﹕ Grow heap (frag case) to 33.244MB for 12582928-byte allocation
09-06 21:28:41.019 19239-19243/? D/dalvikvm﹕ GC_CONCURRENT freed 2K, 34% free 31815K/47636K, paused 3ms+4ms, total 30ms
09-06 21:28:41.079 19239-19239/? D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 34% free 31815K/47636K, paused 10ms, total 10ms
09-06 21:28:41.150 19239-19239/? I/dalvikvm-heap﹕ Grow heap (frag case) to 81.242MB for 50331664-byte allocation
09-06 21:28:41.170 19239-19243/? D/dalvikvm﹕ GC_CONCURRENT freed <1K, 17% free 80967K/96792K, paused 4ms+3ms, total 25ms
09-06 21:28:41.650 19239-19239/com.example.lenovo.shop_easy D/dalvikvm﹕ GC_FOR_ALLOC freed 13509K, 24% free 74167K/96792K, paused 9ms, total 9ms
09-06 21:28:41.720 19239-19239/com.example.lenovo.shop_easy D/dalvikvm﹕ GC_FOR_ALLOC freed 1107K, 19% free 79047K/96792K, paused 11ms, total 11ms
09-06 21:28:41.780 19239-19239/com.example.lenovo.shop_easy D/dalvikvm﹕ GC_FOR_ALLOC freed 977K, 14% free 84144K/96792K, paused 12ms, total 12ms
09-06 21:28:41.780 19239-19239/com.example.lenovo.shop_easy I/dalvikvm-heap﹕ Forcing collection of SoftReferences for 8856592-byte allocation
09-06 21:28:41.800 19239-19239/com.example.lenovo.shop_easy D/dalvikvm﹕ GC_BEFORE_OOM freed 9K, 14% free 84135K/96792K, paused 22ms, total 22ms
09-06 21:28:41.800 19239-19239/com.example.lenovo.shop_easy E/dalvikvm-heap﹕ Out of memory on a 8856592-byte allocation.
09-06 21:28:41.800 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ "main" prio=5 tid=1 RUNNABLE
09-06 21:28:41.800 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ | group="main" sCount=0 dsCount=0 obj=0x41788728 self=0x41773600
09-06 21:28:41.800 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ | sysTid=19239 nice=0 sched=0/0 cgrp=apps handle=1074515964
09-06 21:28:41.800 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ | state=R schedstat=( 0 0 0 ) utm=72 stm=18 core=0
09-06 21:28:41.800 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
09-06 21:28:41.800 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:503)
09-06 21:28:41.800 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:356)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:816)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at android.content.res.Resources.loadDrawable(Resources.java:2117)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at android.widget.ImageView.<init>(ImageView.java:127)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at android.widget.ImageView.<init>(ImageView.java:117)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at java.lang.reflect.Constructor.constructNative(Native Method)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at android.view.LayoutInflater.createView(LayoutInflater.java:594)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:274)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at android.app.Activity.setContentView(Activity.java:1895)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at com.example.lenovo.shop_easy.catalog.onCreate(catalog.java:16)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at android.app.Activity.performCreate(Activity.java:5133)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2230)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2316)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at android.app.ActivityThread.access$600(ActivityThread.java:150)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1298)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at android.os.Handler.dispatchMessage(Handler.java:99)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at android.os.Looper.loop(Looper.java:213)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at android.app.ActivityThread.main(ActivityThread.java:5225)
09-06 21:28:41.830 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at java.lang.reflect.Method.invokeNative(Native Method)
09-06 21:28:41.840 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at java.lang.reflect.Method.invoke(Method.java:525)
09-06 21:28:41.840 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
09-06 21:28:41.840 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
09-06 21:28:41.840 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ at dalvik.system.NativeStart.main(Native Method)
09-06 21:28:41.840 19239-19239/com.example.lenovo.shop_easy I/dalvikvm﹕ [ 09-06 21:28:41.840 19239:19239 D/skia ]
--- allocation failed for scaled bitmap
09-06 21:28:41.840 19239-19239/com.example.lenovo.shop_easy D/AndroidRuntime﹕ Shutting down VM
09-06 21:28:41.840 19239-19239/com.example.lenovo.shop_easy W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x417878b0)
09-06 21:28:41.840 19239-19239/com.example.lenovo.shop_easy E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.lenovo.shop_easy/com.example.lenovo.shop_easy.catalog}: android.view.InflateException: Binary XML file line #179: Error inflating class <unknown>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2266)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2316)
at android.app.ActivityThread.access$600(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1298)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:5225)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #179: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:620)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:274)
at android.app.Activity.setContentView(Activity.java:1895)
at com.example.lenovo.shop_easy.catalog.onCreate(catalog.java:16)
at android.app.Activity.performCreate(Activity.java:5133)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2316)
at android.app.ActivityThread.access$600(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1298)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:5225)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:594)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:274)
at android.app.Activity.setContentView(Activity.java:1895)
at com.example.lenovo.shop_easy.catalog.onCreate(catalog.java:16)
at android.app.Activity.performCreate(Activity.java:5133)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2316)
at android.app.ActivityThread.access$600(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1298)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:5225)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.OutOfMemoryError
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:503)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:356)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:816)
at android.content.res.Resources.loadDrawable(Resources.java:2117)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.widget.ImageView.<init>(ImageView.java:127)
at android.widget.ImageView.<init>(ImageView.java:117)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:594)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:274)
at android.app.Activity.setContentView(Activity.java:1895)
at com.example.lenovo.shop_easy.catalog.onCreate(catalog.java:16)
at android.app.Activity.performCreate(Activity.java:5133)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2316)
at android.app.ActivityThread.access$600(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1298)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:5225)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
答案 0 :(得分:0)
在android menifest.xml文件中,添加相关活动
<activity android:name="ListViewImage"></activity>
<activity android:name="com.company.listview.ListViewImage">
</activity>
在您的主要活动中,按照下面所述,为您的按钮点击事件调用onclicklistner。
Button btnClickToNext;
btnClickToNext = (Button)findViewById(R.id.Button_Liste);
btnClickToNext.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
intent = new Intent(MainActivity.this, catalog.class);
startActivity(intent);
}
});
希望,它对您来说绝对合适,并且需要任何帮助,请与我保持联系,共度美好的一天。