在不更改代码

时间:2015-04-26 15:40:27

标签: android android-activity android-emulator onresume

根本没有改变我的代码,似乎我的应用程序已经决定它不想再运行了。

每当我尝试在我的模拟器上启动它时,我在日志中收到以下错误:

java.lang.RuntimeException: Performing stop of activity that is not resumed: {...FrontPage}

编辑:这是完整的例外:

04-25 23:49:25.839  32562-32562/com.xxxxxxx.chessgame E/ActivityThread﹕ Performing stop of activity that is not resumed: {com.xxxxxx.chessgame/com.xxxxxx.chessgame.FrontPage}
    java.lang.RuntimeException: Performing stop of activity that is not resumed: {com.xxxxx.chessgame/com.xxxxxx.chessgame.FrontPage}
            at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3590)
            at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3684)
            at android.app.ActivityThread.access$1100(ActivityThread.java:153)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1376)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:157)
            at android.app.ActivityThread.main(ActivityThread.java:5633)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:896)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:712)
            at dalvik.system.NativeStart.main(Native Method)

我在app工作和不工作之间的间隔期间做的唯一事情就是通过Android Studio下载新的设备模拟器。

FrontPage活动中的完整代码如下:

public class FrontPage extends ActionBarActivity {

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.frontpage);
        Toolbar toolbar = (Toolbar) findViewById(R.id.app_bar);
        toolbar.setTitle("Chess");
        setSupportActionBar(toolbar);



        final ImageButton gamesButton = (ImageButton) findViewById(R.id.goToGames);
        gamesButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View V) {
                Intent i = new Intent(FrontPage.this, chessboard.class);
                startActivity(i);
            }
        });
        final ImageButton rankingsButton = (ImageButton) findViewById(R.id.goToRankings);
        rankingsButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View V) {
                Intent i = new Intent(FrontPage.this, Rankings.class);
                startActivity(i);
            }
        });




        }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.global, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;

        }
        return super.onOptionsItemSelected(item);
    }
    }

我没有onResume()方法,是问题的一部分吗?我不知道如果我的应用程序在整个开发过程中没有它就能正常工作。

0 个答案:

没有答案