English 中文(简体)
因无专业例外而终止任用
原标题:App force close due to uncaught exception

我认为,为了防止这一错误出现在Ill上,就必须写一个手脚的人? 使用<条码><%/代码>和<条码>。 如何这样做?

这里是帮助你的法典。

感谢:

package android.app;
import android.app.Activity;
import android.app.R;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class AndroidActivity extends Activity{

     /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Button next = (Button) findViewById(R.id.Start_CoolWhapp);
        next.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                Intent myIntent = new Intent(view.getContext(), activity2.class);
                startActivityForResult(myIntent, 0);
            }
        });
    }
}
最佳回答

因此,有一些东西。

第一,确保一切活动都列在你面前,如:

<activity android:name=".AndroidActivity " android:label="@string/activity_name"></activity>
<activity android:name=".activity2" android:label="@string/another_activity_name"></activity>

你们可能比这更需要特性,但这符合基本条件。

我不知道,为什么你们需要“恢复行动”,因为我看不见该守则,但如果这只是另一种带有意见的活动,那么你就可以改变你们的法典。

Intent myIntent = new Intent(CurrentActivity.this, NextActivity.class);
CurrentActivity.this.startActivity(myIntent); //you do not have to use CurrentActivity.this to use startActivity however I am trying to show where context is coming from

保证活动2有布局,有布局。

问题回答

暂无回答




相关问题
handling exceptions IN Action Filters

Is there a better way to handle exceptions that occur inside an Action Filter itself in ASP .NET MVC? There re 2 ways I can think of at the moment. Using a try catch and setting the HTTP Status ...

既可捕获,又可举出例外。

我有一种办法,可以进入亚洲开发银行,因此,我国的亚行在多瑙河航道中的所有 st子都位于一个试捕区。 它正在追捕Kexception

Cross compiler exception handling - Can it be done safely?

I am doing some maintenance on a C++ windows dll library that is required to work with different VC++ compilers (as I don’t want to address different mangling schemes). I have already eliminated any ...

File Handling Issue

I am developing a tool in c#, at one instance I start writing into a xml file continuously using my tool,when i suddenly restart my machine the particular xml file gets corrupted, what is the reason ...

Watch a memory location/install data breakpoint from code?

We have a memory overwrite problem. At some point, during the course of our program, a memory location is being overwritten and causing our program to crash. the problem happens only in release mode. ...

Unit Test for Exceptions Message

Is there a simple (Attribute-driven) way to have the following test fail on the message of the exception. [TestMethod()] [ExpectedException(typeof(ArgumentException))] public void ExceptionTestTest() ...

热门标签