2016-06-30 3 views

答えて

0

ストアジェンダータイプ1つの文字列で例えば

String gender-"girl"; 

あなたの次の活動でこの値を取得し、今例えば意図に

Intent i=new Intent(currentAtvity.this,nextActivity.class); 
i.putExtra("gender",gender); 
startActivity(i); 

をこの文字列を渡す:

Intent intent = getIntent(); 
     try { 

     String selectedGender=intent.getExtras().getString("gender")); 
     } catch (Exception e) { 
      e.printStackTrace(); 
     } 
if(selectedGender.equals("girl")){ 
//write code to change background of your button or layout 
}else{ 
//boy will be selected 
} 
関連する問題