Open More than 1 intent (Activity )
I have created 2 activities. It force closes. Why?
05-12 23:26:07.041: ERROR/AndroidRuntime(5170): Uncaught handler: thread main exiting due to uncaught exception
05-12 23:26:07.051: ERROR/AndroidRuntime(5170): java.lang.VerifyError: yaraby.y.yaraby$1
05-12 23:26:07.051: ERROR/AndroidRuntime(5170): at yaraby.y.yaraby.onCreate(yaraby.java:44)
05-12 23:26:07.051: ERROR/AndroidRuntime(5170): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1127)
05-12 23:26:07.051: ERROR/AndroidRuntime(5170): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
05-12 23:26:07.051: ERROR/AndroidRuntime(5170): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
05-12 23:26:07.051: ERROR/AndroidRuntime(5170): at android.app.ActivityThread.access$1800(ActivityThread.java:112)
05-12 23:26:07.051: ERROR/AndroidRuntime(5170): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
05-12 23:26:07.051: ERROR/AndroidRuntime(5170): at android.os.Handler.dispatchMessage(Handler.java:99)
05-12 23:26:07.051: ERROR/AndroidRuntime(5170): at android.os.Looper.loop(Looper.java:123)
05-12 23:26:07.051: ERROR/AndroidRuntime(5170): at android.app.ActivityThread.main(ActivityThread.java:3948)
05-12 23:26:07.051: ERROR/AndroidRuntime(5170): at java.lang.reflect.Method.invokeNative(Native Method)
05-12 23:26:07.051: ERROR/AndroidRuntime(5170): at java.lang.reflect.Method.invoke(Method.java:521)
05-12 23:26:07.051: ERROR/AndroidRuntime(5170): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
05-12 23:26:07.051: 开发者_StackOverflow中文版ERROR/AndroidRuntime(5170): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
05-12 23:26:07.051: ERROR/AndroidRuntime(5170): at dalvik.system.NativeStart.main(Native Method)
if any one have a solution please tell me and i can send my project code to be checked
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
inputfld=(EditText)findViewById(R.id.input);
Text=(TextView)findViewById(R.id.view);
Enter=(Button)findViewById(R.id.enter);
Connect=(Button)findViewById(R.id.connect);
Text.append( "\n about to create a socket");
txt=(EditText)findViewById(R.id.txt);
next = (Button) findViewById(R.id.Button01);
next.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(yaraby.this, HelloItemizedOverlay.class);
yaraby.this.startActivity(i);
// Toast.makeText(getApplicationContext(), "haaaaaaaaaaa",Toast.LENGTH_LONG).show();
}
});
this the first Oncreate for first class
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main2);
Button next = (Button) findViewById(R.id.Button02);
next.setOnClickListener(new View.OnClickListener() {
private String key;
public void onClick(View view) {
next.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(yaraby.this, HelloItemizedOverlay.class);
yaraby.this.startActivity(i);
next.setOnClickListener(new OnClickListener() { is the 44 line !!
精彩评论