Eclipse / android AVDで、「残念ながら停止しました」というメッセージが表示されます。
これについて他の質問を確認しましたが、これは私のアプリケーションに固有のものであると思います。コードに問題やエラーがないため、エラーがどこにあるのかわかりません。エミュレーターのセットアップ方法に問題があるのか、それともコードに特定の問題があるのか疑問に思っています。
これが私のコードのセクションです:
activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<ImageButton
android:id="@+id/btn_schedule"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/btn_facebook"
android:layout_below="@+id/btn_facebook"
android:layout_marginTop="64dp"
android:src="@drawable/schedule"
android:background="@null"
android:contentDescription="@string/none"/>
<ImageButton
android:id="@+id/btn_cfrc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/btn_schedule"
android:layout_marginLeft="73dp"
android:layout_toRightOf="@+id/btn_schedule"
android:background="@null"
android:src="@drawable/website"
android:contentDescription="@string/none"/>
<ImageButton
android:id="@+id/btn_twitter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/btn_cfrc"
android:layout_alignParentTop="true"
android:layout_marginTop="64dp"
android:background="@null"
android:src="@drawable/twitter"
android:contentDescription="@string/none"/>
<ImageButton
android:id="@+id/btn_facebook"
android:layout_alignParentLeft="true"
android:layout_alignTop="@+id/btn_twitter"
android:layout_marginLeft="64dp"
android:background="@null"
android:src="@drawable/facebook"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/none"/>
</RelativeLayout>
Main_Activity.java:
package com.example.cfrcradio;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btn1 = (Button) findViewById(R.id.btn_twitter);
btn1.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent myWebLink = new Intent(android.content.Intent.ACTION_VIEW);
myWebLink.setData(Uri.parse("http://www.twitter.com/CFRC"));
startActivity(myWebLink);
}
});
Button btn2 = (Button) findViewById(R.id.btn_facebook);
btn2.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent myWebLink = new Intent(android.content.Intent.ACTION_VIEW);
myWebLink.setData(Uri.parse("http://www.facebook.com/cfrc.kingston
fref=ts"));
startActivity(myWebLink);
}
});
Button btn3 = (Button) findViewById(R.id.btn_cfrc);
btn3.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent myWebLink = new Intent(android.content.Intent.ACTION_VIEW);
myWebLink.setData(Uri.parse("http://www.cfrc.ca/blog/"));
startActivity(myWebLink);
}
});
Button btn4 = (Button) findViewById(R.id.btn_schedule);
btn4.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent myWebLink = new Intent(android.content.Intent.ACTION_VIEW);
myWebLink.setData(Uri.parse("http://www.cfrc.ca/blog/programming/schedule"));
startActivity(myWebLink);
}
});
}
}
マニフェスト:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.cfrcradio"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.cfrcradio.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
助けてください!!