安卓第一行代码学习 The application may be doing too much work on its main 问题。求助
皆灾 2018-01-19 03:09:19 最近在学习大神的第一行代码,发现总是提示The application may be doing too much work on its main thread.这个错误。开始没太在意,因为就安卓模拟器的运行来说,有些小例子是可以测试的。但是最近看到了返回数据在logcat中看,但是由于提示The application may be doing too much work on its main thread.这个错误,总是不能看到logcat的值
。
01-19 04:14:52.720 2830-2858/com.example.activitytest D/OpenGLRenderer: endAllActiveAnimators on 0x8f0e1880 (RippleDrawable) with handle 0x9bceaf90
01-19 04:16:23.037 2830-2830/com.example.activitytest I/Choreographer: Skipped 56 frames! The application may be doing too much work on its main thread.
01-19 04:16:27.238 2830-2830/com.example.activitytest I/Choreographer: Skipped 52 frames! The application may be doing too much work on its main thread.
01-19 04:16:33.055 2830-2830/com.example.activitytest I/Choreographer: Skipped 47 frames! The application may be doing too much work on its main thread.
01-19 04:16:35.288 2830-2830/com.example.activitytest I/Choreographer: Skipped 31 frames! The application may be doing too much work on its main thread.
01-19 04:16:36.370 2830-2830/com.example.activitytest I/Choreographer: Skipped 51 frames! The application may be doing too much work on its main thread.
01-19 07:02:23.004 2830-2830/com.example.activitytest I/Choreographer: Skipped 242 frames! The application may be doing too much work on its main thread.
01-19 07:02:28.840 2830-2830/com.example.activitytest I/Choreographer: Skipped 125 frames! The application may be doing too much work on its main thread.
这是logcat提示。
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.first_layout);
Button button1 = (Button) findViewById(R.id.button_1);
button1.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
Intent intent = new Intent(FirstActivity.this,SecondActivity.class);
startActivityForResult(intent,1);
}
});
}
这是FirstActivity中的更改
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.second_layout);
Button button2 =(Button) findViewById(R.id.button_2);
button2.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
Intent intent = new Intent();
intent.putExtra("data_return","Hello FirstActivity");
setResult(RESULT_OK,intent);
finish();
}
});
}
这是SecondActivity中的更改。
这个例子郭霖大神给出的打印信息是
com.example.activity D/FirstActivity:Hello FirstActivity
来论坛找了很多提示The application may be doing too much work on its main thread.这种的错误,发现都是很大规模的程序,那我这种小例子的测试怎么会提示这种呢?费解。求大腿指教一二,感激不尽。