Closed ashu10832 closed 7 years ago
Why don't you use .equals(). That should work well enough as well.
On Sunday, May 28, 2017, Ashu Gupta notifications@github.com wrote:
@ashu10832 commented on this pull request.
In app/src/main/java/in/tosc/digitaloceanapp/adapters/ DataCenterAdapter.java https://github.com/coding-blocks/DigitalOceanApp/pull/36#discussion_r118843713 :
@@ -40,31 +36,57 @@ public DataCenterViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { @Override public void onBindViewHolder(DataCenterViewHolder holder, int position) { this.postion = holder.getAdapterPosition();
- String thisCountry = countriesList.get(position).getCity();
- int url = countriesList.get(position).getId();
- holder.countryName.setText(thisCountry);
- Picasso.with(context).load(url).resize(425,220).into(holder.img);
- String thisRegion = regions.getRegions().get(position).getName();
- holder.countryName.setText(thisRegion);
- if(thisRegion.contains("New York"))
I couldn't find any way to use switch case with String.contains() method. Please tell how it can be done. [image: screen shot 2017-05-28 at 9 01 21 pm] https://cloud.githubusercontent.com/assets/19621727/26529960/0e92e4be-43e9-11e7-8b75-7172b05da428.png
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/coding-blocks/DigitalOceanApp/pull/36#discussion_r118843713, or mute the thread https://github.com/notifications/unsubscribe-auth/AGQtlr0aLYGqRPqtRWkRd6ULr6xwypFeks5r-ZQUgaJpZM4NoXzp .
-- Best, Harshit Dwivedi
@the-dagger Because many times we get 2 data centres from same country and then they have names like 'Banglore 1' and 'Banglore 2'. Therefore, .equals wont work in that case.
Oh i see. Alright then, you can go ahead with if else ladder.
@ashu10832 Could you resolve the conflicts with the java classes?
@the-dagger Resolved Conflicts Please Review
@the-dagger Thank you for reviewing. I have fixed the indentation and log mistakes
Sorry for my previous messy pull request. I got confused in branching in git.
This PR resolves the issue of hardcoded regions. Please consider this new PR.