我想去一个带有从 resultPhone 返回的名称的活动,例如:当前手机名称是 GalaxyS3,然后我希望它去 GalaxyS3.class。我怎样才能做到这一点?
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String[] supportedPhone = getResources().getStringArray(R.array.supported_phone);
String[] supportedVersion = getResources().getStringArray(R.array.supported_version);
String currentPhone = android.os.Build.MODEL;
String currentVersion = android.os.Build.VERSION.RELEASE;
for(String cP : supportedPhone) {
String resultPhone = cP;
for(String cV : supportedVersion) {
String resultVersion = cV;
if ((currentPhone.equalsIgnoreCase(resultPhone)) && (currentVersion.equalsIgnoreCase(resultVersion))) {
Intent gotoPhoneDetail = new Intent(this, "resultPhone" + ".class");
startActivity(gotoPhoneDetail);
// how can i make this go to the activity with the name return from resultPhone?
} else {
setContentView(R.layout.phone_checker);
}
}
}
}