Java 活动之间的更改不起作用
我正在尝试在我的Android应用程序(2.1-update1)中的活动之间进行切换,但它不起作用。 有什么建议吗 调试应用程序时发生的唯一一件事是它在Instrumentation.java中的这部分代码上停止:Java 活动之间的更改不起作用,java,android,sdk,Java,Android,Sdk,我正在尝试在我的Android应用程序(2.1-update1)中的活动之间进行切换,但它不起作用。 有什么建议吗 调试应用程序时发生的唯一一件事是它在Instrumentation.java中的这部分代码上停止: public void waitForIdle() { synchronized (this) { while (!mIdle) { try {
public void waitForIdle() {
synchronized (this) {
while (!mIdle) {
try {
wait();
} catch (InterruptedException e) {
}
}
}
}
Eclipse说它位于上的线程1中
仪器仪表。检查StartActivityResult(int,Object)行:1537。如果我
继续应用程序,下一站是在ZygoteInit.java中尝试运行
可丢弃原因=例如getCause()。。。月食说
ZygoteInit$MethodAndArgsCaller.run()行:864
以下是源代码:
HappyHomes.java
package com.example.app;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class HappyHomes extends Activity {
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button login = (Button) findViewById(R.id.btnLogin);
login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ProgressDialog laddRuta = ProgressDialog.show(HappyHomes.this, "",
"Loggar in, vänligen vänta...", true);
Intent myIntent = new Intent(view.getContext(), Kategorier.class);
myIntent.
startActivity(myIntent);
}
});
}
}
package com.example.app;
import android.app.Activity;
import android.os.Bundle;
public class Kategorier extends Activity {
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.kategorier);
}
}
Kategorier.java
package com.example.app;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class HappyHomes extends Activity {
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button login = (Button) findViewById(R.id.btnLogin);
login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ProgressDialog laddRuta = ProgressDialog.show(HappyHomes.this, "",
"Loggar in, vänligen vänta...", true);
Intent myIntent = new Intent(view.getContext(), Kategorier.class);
myIntent.
startActivity(myIntent);
}
});
}
}
package com.example.app;
import android.app.Activity;
import android.os.Bundle;
public class Kategorier extends Activity {
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.kategorier);
}
}
谢谢你的帮助 确保
Kategorier
已在您的AndroidManifest.xml
文件中注册。更改myIntent.startActivity(myIntent)代码>到<代码>快乐家庭。这是一种开始的触觉(myIntent)代码>在Intent类中没有任何startActivity()方法。你一定做错了。
只需写入startActivity(myIntent)所有服务、广播接收器和活动都必须在清单文件中声明 你能显示logcat的输出吗?