不幸的是(应用程序名称)在向现有项目添加新活动时发出消息

时间:2014-12-30 07:39:57

标签: android android-intent android-activity intentfilter android-anr-dialog

1.新活动

public class RateQuizActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {

    Log.d("feedback", "Activity loaded");
  setContentView(R.layout.rate_this_quiz);

    Log.d("feedback", "Content View setted");
}}

2.call using intent - (0N按钮点击)

Handler handler = new Handler(Looper.getMainLooper());
            handler.post(new Runnable() {
                @Override
                public void run() {
                    Intent in = new Intent(QuizByteReviewActivity.this, RateQuizActivity.class);

                     startActivity(in);


                }
            });

log cat显示"活动已加载"和 "内容视图已设置"消息,但点击按钮获取"不幸(应用程序名称)stopes消息"

1 个答案:

答案 0 :(得分:0)

试试这个:

Handler handler = new Handler(Looper.getMainLooper());
        handler.post(new Runnable() {
            @Override
            public void run() {
                Intent in = = new Intent(Intent.ACTION_VIEW);
                in.setClass(QuizByteReviewActivity.this, RateQuizActivity.class);

                 startActivity(in);


            }
        });

将RateQuizActivity添加到清单:

<activity
    android:name="com.example.RateQuizActivity "
    android:label="@string/title_activity_display_message">        
</activity>