私はAndroidで新しいアクティビティを開くボタンを持っていますが、何もしません。最初の活性のためアクティビティは開かない
のJava:第二活性について
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.lists);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
// ignore orientation/keyboard change
super.onConfigurationChanged(newConfig);
ListView listsList = (ListView) findViewById(R.id.lists);
Button newList = (Button) findViewById(R.id.newlistbutton);
newList.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent myIntent = new Intent(v.getContext(), NewWishList.class);
startActivity(myIntent);
}
});
}
}
ジャワ:
public class NewWishList extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.newlist);
Button back = (Button) findViewById(R.id.backbutton);
back.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent intent = new Intent(view.getContext(), ListOfLists.class);
startActivity(intent);
}
});
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
// ignore orientation/keyboard change
super.onConfigurationChanged(newConfig);
RadioGroup option = (RadioGroup) findViewById(R.id.radioGroup1);
}
}
マニフェスト:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.wish.list"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="7" />
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-feature android:name="android.hardware.screen.portrait"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Black.NoTitleBar">
<activity
android:name="com.wish.list.FacebookSignIn"
android:label="@string/app_name"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="portrait" >
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ListOfLists"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="portrait"
></activity>
<activity
android:name=".NewWishList"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="portrait"
></activity>
</application>
</manifest>
LogcatまたはError Logにエラーはありません。それは非常に奇妙です。私がonConfigurationChangeを持っている理由は、それがForce Portrait Orientationをオンに設定しているからです。アクティビティはマニフェストで定義されます。代わりにv.getcontextの
「v」とはマニフェストを投稿してください。 –
@JeffreyBlattman public void onClick(View v)これは、最初のアクティビティのボタンのOnClickListenerにあります。今マニフェストを投稿します。 – Cole
onclickリスナを設定するためにonConfigurationChangedがまだ呼び出されていないため、おそらく呼び出されないonClickメソッドにブレークポイントまたはデバッグログを挿入します。 – superfell