应用程序在切换活动时停止工作

时间:2018-02-22 01:39:17

标签: android android-intent

当我从main切换活动时,我的应用程序关闭。当我检查日志时,我看到的唯一错误是:

Emulator: coreaudio: Could not lock voice for audioOutputDeviceIOProc
Emulator: Reason: Invalid argument

我已经更改了hw:audioOutput = no和hw:audioInput = no但是事情仍然无效。我如何使用Intent是一个问题吗?如何让这个应用程序停止崩溃。谢谢

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

    ImageButton SuvButton;
    ImageButton TwoDoorButton;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        SuvButton = (ImageButton) findViewById(R.id.SuvImageButton);


        SuvButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //Toast.makeText(MainActivity.this,"Suv Button Works",Toast.LENGTH_LONG).show();
                startActivity(new Intent(MainActivity.this, ExpandableText.class));
            }
        });

        TwoDoorButton = (ImageButton) findViewById(R.id.TwoDoorImageButton);

        TwoDoorButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(MainActivity.this,"Two Door Button Works",Toast.LENGTH_LONG).show();
                //Intent intentTwo = new Intent(MainActivity.this,ExpandableText.class);
                //startActivity(intentTwo);
            }
        });
    }
}

1 个答案:

答案 0 :(得分:0)

您是否在AndroidManifest.xml中注册了ExpandableText个活动?