So i have some markers and Custom Info Windows and putextras. I don't know to use putextras that much but I know how to use them a bit. So I used a put extra to transfer data from MapsActivity to Country Adapter which I will explain: So my idea is that when a user clicks on CustomInfoWindow an intent opens named Country Adapter. That country adapter has 2 textviews for title and content. Currently i am successful just in transferring one set of data but the other just doesn't work. I may be doing something wrong but I get really confused in setting Put extras. MapsActivity:
@Override
public void onInfoWindowClick(Marker marker) {
if("India".equals(marker.getTitle())) {
Intent intent = new Intent(this,Country.class);
intent.putExtra("India","text");
startActivity(intent);
}
if("Australia".equals(marker.getTitle())){
Intent intent = new Intent(this,Country.class);
intent.putExtra("Austrailia","text");
// want to create a method that when this is clicked it gives different texts.
startActivity(intent);
}
My Country Adapter:
Button bt = findViewById(R.id.button);
bt.setOnClickListener(v -> openMap());
TextView countryName = findViewById(R.id.textView);
TextView Main = findViewById(R.id.textView2);
Bundle bundle = getIntent().getExtras();
if(bundle != null) {
String India = bundle.getString("India");
countryName.setText("India,South Asia");
}
if(bundle != null) {
String Australia = bundle.getString("Australia");
countryName.setText("Australia,Oceania");
}
}
public void openMap(){
finish();
}
}
I want to display different texts for both of them but it doesn't work. I am very new to this so please answer in detail..