当我单击按钮时,我没有激活转到另一个 android 页面的意图。
我的java代码
public class CharSheets extends Activity implements OnClickListener{
Button Descrip, Atributes, Weapons, Skills, ACItems, Gear,
Feats, SpecialAbilities, Spells;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.charsheets);
setids();
}
private void setids() {
// TODO Auto-generated method stub
Descrip = (Button)findViewById(R.id.bCharDescrip);
}
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
switch(arg0.getId()) {
case R.id.bCharDescrip:
Intent i = new Intent(CharSheets.this, CharDescrip.class);
startActivity(i);
break;
case R.id.bCharAtributes:
Intent i1 = new Intent(CharSheets.this, CharAtributes.class);
startActivity(i1);
break;
}
}
}
XML 盛会
<activity
android:name=".CharAtributes"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.CHARSATRIBUTES" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".CharDescrip"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.CHARDESCRIP" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
我不确定是什么导致了这个问题,但我尝试了其他解决方案,但都没有奏效。我现在这样做的方式我以前用过,而且效果很好。