I want to ask that how can I use "if" structure in the new activity which is related to a string on the main activity.
here is my new activity ;
public class yeniaktivite extends Activity {
public ImageView Abir;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.yeniaktivite);
Intent intent = getIntent();
String id = intent.getStringExtra("key");
if (id == "A2") {
Toast.makeText(getApplicationContext(), id, Toast.LENGTH_LONG).show();
}
Abir = (ImageView) findViewById(R.id.imageView1);
Abir.setImageResource(R.drawable.abir);
}
}
this code ignores the if structure on running
Aucun commentaire:
Enregistrer un commentaire