ボタンをクリックした後に 2 番目のレイアウトを読み込もうとしていますが、何らかの理由でアプリケーションがクラッシュし続けます...すべてを正しく行ったと確信していますが、クリックするたびに何らかの理由でまだ失敗しています画面下の保存ボタン。
PS
さらに情報が必要な場合は、お知らせください。喜んで提供させていただきます。
ジャワ
package com.example.linkingmanager;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.content.Intent;
public class App2Activity extends Activity {
Button button;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main2);
}
public void saveButtonClicked(View v) {
// do stuff
super.onCreate(savedInstanceState);
Intent intent = new Intent(App2Activity.this, AppActivity.class);
App2Activity.this.startActivity(intent);
}
}
XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:orientation="vertical" android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<TextView android:textAppearance="?android:textAppearanceLarge" android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="User Settings:" />
<TextView android:textAppearance="?android:textAppearanceMedium" android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Data Limit" />
<SeekBar android:id="@+id/seekBar1" android:layout_width="fill_parent" android:layout_height="wrap_content" />
<LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView android:gravity="left" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="10MB" android:layout_weight="1.0" />
<TextView android:gravity="right" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Unlimited Data" android:layout_weight="1.0" />
</LinearLayout>
<TextView android:textAppearance="?android:textAppearanceMedium" android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Bandwidth Limit" />
<SeekBar android:id="@+id/seekBar1" android:layout_width="fill_parent" android:layout_height="wrap_content" />
<LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView android:gravity="left" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="10kbs" android:layout_weight="1.0" />
<TextView android:gravity="right" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Unlimited Bandwidth" android:layout_weight="1.0" />
</LinearLayout>
<TextView android:textAppearance="?android:textAppearanceSmall" android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content" />
<TextView android:textAppearance="?android:textAppearanceMedium" android:id="@+id/TextView02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="WiFi Time Limit" />
<TimePicker android:id="@+id/timePicker1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="50.0dip" android:layout_weight="1.0" />
<EditText android:id="@+id/editText1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="Blocked Sites - [ex: www.xxx.com]" android:ems="10" />
<Button android:id="@+id/saveButton" android:onClick="saveButtonClicked" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Save" />
</LinearLayout>
ログキャット
03-04 07:35:41.939: D/dalvikvm(944): GC_FOR_ALLOC freed 40K, 7% free 2456K/2640K, paused 46ms, total 49ms
03-04 07:35:41.989: I/dalvikvm-heap(944): Grow heap (frag case) to 5.831MB for 3456016-byte allocation
03-04 07:35:42.049: D/dalvikvm(944): GC_FOR_ALLOC freed 2K, 4% free 5828K/6016K, paused 58ms, total 59ms
03-04 07:35:42.139: D/dalvikvm(944): GC_CONCURRENT freed <1K, 4% free 5828K/6016K, paused 8ms+16ms, total 90ms
03-04 07:35:42.799: D/libEGL(944): loaded /system/lib/egl/libEGL_emulation.so
03-04 07:35:42.878: D/(944): HostConnection::get() New Host Connection established 0x2a155228, tid 944
03-04 07:35:42.959: D/libEGL(944): loaded /system/lib/egl/libGLESv1_CM_emulation.so
03-04 07:35:42.979: D/libEGL(944): loaded /system/lib/egl/libGLESv2_emulation.so
03-04 07:35:43.099: W/EGL_emulation(944): eglSurfaceAttrib not implemented
03-04 07:35:43.119: D/OpenGLRenderer(944): Enabling debug mode 0
03-04 07:35:47.248: W/EGL_emulation(944): eglSurfaceAttrib not implemented
03-04 07:35:55.629: D/AndroidRuntime(944): Shutting down VM
03-04 07:35:55.671: W/dalvikvm(944): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
03-04 07:35:55.709: E/AndroidRuntime(944): FATAL EXCEPTION: main
03-04 07:35:55.709: E/AndroidRuntime(944): java.lang.IllegalStateException: Could not find a method saveButtonClicked(View) in the activity class com.example.linkingmanager.App2Activity for onClick handler on view class android.widget.Button with id 'saveButton'
03-04 07:35:55.709: E/AndroidRuntime(944): at android.view.View$1.onClick(View.java:3586)
03-04 07:35:55.709: E/AndroidRuntime(944): at android.view.View.performClick(View.java:4204)
03-04 07:35:55.709: E/AndroidRuntime(944): at android.view.View$PerformClick.run(View.java:17355)
03-04 07:35:55.709: E/AndroidRuntime(944): at android.os.Handler.handleCallback(Handler.java:725)
03-04 07:35:55.709: E/AndroidRuntime(944): at android.os.Handler.dispatchMessage(Handler.java:92)
03-04 07:35:55.709: E/AndroidRuntime(944): at android.os.Looper.loop(Looper.java:137)
03-04 07:35:55.709: E/AndroidRuntime(944): at android.app.ActivityThread.main(ActivityThread.java:5041)
03-04 07:35:55.709: E/AndroidRuntime(944): at java.lang.reflect.Method.invokeNative(Native Method)
03-04 07:35:55.709: E/AndroidRuntime(944): at java.lang.reflect.Method.invoke(Method.java:511)
03-04 07:35:55.709: E/AndroidRuntime(944): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-04 07:35:55.709: E/AndroidRuntime(944): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-04 07:35:55.709: E/AndroidRuntime(944): at dalvik.system.NativeStart.main(Native Method)
03-04 07:35:55.709: E/AndroidRuntime(944): Caused by: java.lang.NoSuchMethodException: saveButtonClicked [class android.view.View]
03-04 07:35:55.709: E/AndroidRuntime(944): at java.lang.Class.getConstructorOrMethod(Class.java:460)
03-04 07:35:55.709: E/AndroidRuntime(944): at java.lang.Class.getMethod(Class.java:915)
03-04 07:35:55.709: E/AndroidRuntime(944): at android.view.View$1.onClick(View.java:3579)
03-04 07:35:55.709: E/AndroidRuntime(944): ... 11 more
03-04 07:35:58.489: I/Process(944): Sending signal. PID: 944 SIG: 9