新人求助,请各位前辈帮我看看错误在哪里 这是logcat通过intent跳转activity ecplise没提示错误但是程序不能运行 多谢各位前辈啦android 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 有没有在AndroidManifest.xml中把所有的Activity都注册了?把代码贴上来看一下吧 package com.example.shishenxuanze;import android.os.Bundle;import android.app.Activity;import android.content.DialogInterface;import android.content.DialogInterface.OnClickListener;import android.content.Intent;import android.view.Menu;import android.widget.Button;public class Shishenxuanze extends Activity { private Button button1 = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_shishenxuanze); button1 = (Button)findViewById(R.id.button1); button1.setOnClickListener((android.view.View.OnClickListener) new MyButtonListener()); } class MyButtonListener implements OnClickListener{ @Override public void onClick(DialogInterface arg0, int arg1) { // TODO Auto-generated method stub Intent intent = new Intent(); intent.setClass(Shishenxuanze.this, Zishibu.class); Shishenxuanze.this.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.shishenxuanze, menu); return true; }}这是第一个activitypackage com.example.shishenxuanze;import android.app.Activity;import android.os.Bundle;import android.widget.ImageView;public class Zishibu extends Activity { private ImageView imageview1 = null; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.zishibu); imageview1 = (ImageView)findViewById(R.id.imageView1); }}第二个activity<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.shishenxuanze" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="com.example.shishenxuanze.Shishenxuanze" 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="com.example.shishenxuanze.Zishibu" android:label="@string/app_name"/> </application></manifest>AndroidMainfest.xml 你把 Shishenxuanze这个类名换成别的名字试试 我记得貌似button用的onclick后面应该是 onclick(View v){......}吧 class MyButtonListener implements OnClickListener{@Overridepublic void onClick(DialogInterface arg0, int arg1)这个方法引用错了,应该是public void onClick(View v) android 错误 error opening trace file: 关于android TextView System.loadLibrary 超时求教... android中,控制按纽区域,在线 View不响应Gesture eclipse下开发android问题? 求教Gallery的问题 ListView点击完的时候有没有办法不让它自己刷新? andriod openfire 安卓开发 获取手机内存的音乐文件 关于Android中setPositiveButton和setNegativeButton的使用问题 【求助】android 调用https接口问题
import android.app.Activity;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.view.Menu;
import android.widget.Button;public class Shishenxuanze extends Activity {
private Button button1 = null; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_shishenxuanze);
button1 = (Button)findViewById(R.id.button1);
button1.setOnClickListener((android.view.View.OnClickListener) new MyButtonListener());
}
class MyButtonListener implements OnClickListener{ @Override
public void onClick(DialogInterface arg0, int arg1) {
// TODO Auto-generated method stub
Intent intent = new Intent();
intent.setClass(Shishenxuanze.this, Zishibu.class);
Shishenxuanze.this.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.shishenxuanze, menu);
return true;
}}
这是第一个activity
package com.example.shishenxuanze;import android.app.Activity;
import android.os.Bundle;
import android.widget.ImageView;public class Zishibu extends Activity {
private ImageView imageview1 = null; @Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.zishibu);
imageview1 = (ImageView)findViewById(R.id.imageView1);
}}
第二个activity
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.shishenxuanze"
android:versionCode="1"
android:versionName="1.0" > <uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" /> <application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.shishenxuanze.Shishenxuanze"
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="com.example.shishenxuanze.Zishibu"
android:label="@string/app_name"/>
</application></manifest>
AndroidMainfest.xml
public void onClick(DialogInterface arg0, int arg1)
这个方法引用错了,应该是public void onClick(View v)