我的应用在android studio中停止运行。它给出以下评论 声音:无法初始化DirectSoundCapture dsound:原因:没有可用的声音驱动程序,或者给定的GUID不是有效的DirectSound设备ID dsound:尝试在没有DirectSoundCapture对象的情况下初始化语音 dsound:尝试在没有DirectSoundCapture对象的情况下初始化语音 音频:无法创建语音`goldfish_audio_in' qemu-system-i386.exe:警告:打开音频输入失败 dsound:尝试在没有DirectSoundCapture对象的情况下初始化语音 dsound:尝试在没有DirectSoundCapture对象的情况下初始化语音
我尝试了该论坛中给出的所有答案,但没有用
打包com.example.admin.myapplication;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.Bundle;
import android.R.string;
import android.app.Activity;
import android.graphics.Color;
import android.graphics.Typeface;
import android.view.Menu;
import android.view.View;
import android.webkit.WebChromeClient;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.appindexing.Action;
import com.google.android.gms.appindexing.AppIndex;
import com.google.android.gms.appindexing.Thing;
import com.google.android.gms.common.api.GoogleApiClient;
公共类MainActivity扩展了活动{
EditText user, pass;
Button btn_submit;
TextView result;
String a;
String b;
/**
* ATTENTION: This was auto-generated to implement the App Indexing API.
* See https://g.co/AppIndexing/AndroidStudio for more information.
*/
private GoogleApiClient client;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
result = (TextView) findViewById(R.id._result);
btn_submit = (Button) findViewById(R.id.button1);
OnButtonClickListener();
user = (EditText) findViewById(R.id._user);
pass = (EditText) findViewById(R.id._pass);
final Typeface _type = Typeface.createFromAsset(getAssets(), "fonts/air.ttf");
btn_submit.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View arg0) {
// TODO自动生成的方法存根a =“ andrew”;
b = "jesus";
if (user.getText().toString().equals("") || pass.getText().toString().equals(""))
{
Toast.makeText(getApplicationContext(), "Field Empty", Toast.LENGTH_SHORT).show();
} else {
if (user.getText().toString().equals(a) && pass.getText().toString().equals(b))
{
result.setTextColor(Color.RED);
result.setText("Successfull");
result.setTypeface(_type);
} else {
result.setTextColor(Color.RED);
result.setText("Failed");
result.setTypeface(_type);
}
}
}
});
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
//膨胀菜单;这会将项目添加到操作栏(如果有)。 getMenuInflater()。inflate(R.menu.activity_main,menu);
return true;
}
/**
* ATTENTION: This was auto-generated to implement the App Indexing API.
* See https://g.co/AppIndexing/AndroidStudio for more information.
*/
public Action getIndexApiAction() {
Thing object = new Thing.Builder()
.setName("Main Page") // TODO: Define a title for the content shown.
// TODO: Make sure this auto-generated URL is correct.
.setUrl(Uri.parse("http://[ENTER-YOUR-URL-HERE]"))
.build();
return new Action.Builder(Action.TYPE_VIEW)
.setObject(object)
.setActionStatus(Action.STATUS_TYPE_COMPLETED)
.build();
}
@Override
public void onStart() {
super.onStart();
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
client.connect();
AppIndex.AppIndexApi.start(client, getIndexApiAction());
}
@Override
public void onStop() {
super.onStop();
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
AppIndex.AppIndexApi.end(client, getIndexApiAction());
client.disconnect();
}
}
tools:context=".MainActivity" > <LinearLayout
android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:orientation="vertical" > <TextView
android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Name" />
<EditText android:id="@+id/_user"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" >
<requestFocus /> </EditText> <TextView
android:id="@+id/textView2"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Password" />
<EditText
android:id="@+id/_pass"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:ems="10" />
<Button android:id="@+id/button1"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Submit" />
<TextView android:id="@+id/_result"
android:layout_width="wrap_content" android:layout_height="wrap_content" />