InfoWindowAdapter.java: uses or overrides a deprecated API
Like in the title I got this problem and I've searched for like good 2h for the answer but none of the ones I tried worked ;/
Here is the class:
package com.example.michalwolowiec.meetup;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.model.Marker;
import java.util.ArrayList;
public class MeetUpInfoWindowAdapter implements GoogleMap.InfoWindowAdapter {
private final View mWindow;
private Context context;
private ArrayList<User> users;
public MeetUpInfoWindowAdapter(Context context, ArrayList<User> users) {
this.context = context;
this.users = users;
mWindow = LayoutInflater.from(context).inflate(R.layout.event_info_window, null);
}
private void renderWindowInfo(Marker marker, View view){
String title = marker.getTitle();
TextView titleTextView = view.findViewById(R.id.titleTextView);
if(!title.equals("")) titleTextView.setText(title);
String snippet = marker.getSnippet();
TextView snippetTextView = view.findViewById(R.id.snippetTextView);
if(!title.equals("")) snippetTextView.setText(snippet);
//Since markers doesn't have an extra Variable to store images I need to iterate
//through all users to get the porper photo
int photo = 0;
ImageView photoImageView = view.findViewById(R.id.photoImageView);
for(int i = 0; i < users.size(); i++){
User user = users.get(i);
if(title.equals("Username: " + user.getUsername())){
photo = user.getProfilePhoto();
break;
}
}
if(photo!=0)
photoImageView.setImageDrawable(context.getResources().getDrawable(photo));
}
@Override
public View getInfoWindow(Marker marker) {
renderWindowInfo(marker, mWindow);
return mWindow;
}
@Override
public View getInfoContents(Marker marker) {
renderWindowInfo(marker, mWindow);
return mWindow;
}
}
Personally I don't think there is something that I use that is deprecated. Even the IDE is not screaming that I am.
Here are my dependencies:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.jakewharton:butterknife:9.0.0-rc1'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc1'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.github.david-serrano:locationprovider:1.1'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
compileOnly 'org.projectlombok:lombok:1.18.4'
annotationProcessor 'org.projectlombok:lombok:1.18.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
I had to add
implementation 'com.android.support:support-v4:28.0.0'
because I think that the library that I use for location is using it.
BTW. Since I'm not a developer yet ca you guys recommend some good location library for android ?
Thank you in advance
java android google-maps google-maps-markers
add a comment |
Like in the title I got this problem and I've searched for like good 2h for the answer but none of the ones I tried worked ;/
Here is the class:
package com.example.michalwolowiec.meetup;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.model.Marker;
import java.util.ArrayList;
public class MeetUpInfoWindowAdapter implements GoogleMap.InfoWindowAdapter {
private final View mWindow;
private Context context;
private ArrayList<User> users;
public MeetUpInfoWindowAdapter(Context context, ArrayList<User> users) {
this.context = context;
this.users = users;
mWindow = LayoutInflater.from(context).inflate(R.layout.event_info_window, null);
}
private void renderWindowInfo(Marker marker, View view){
String title = marker.getTitle();
TextView titleTextView = view.findViewById(R.id.titleTextView);
if(!title.equals("")) titleTextView.setText(title);
String snippet = marker.getSnippet();
TextView snippetTextView = view.findViewById(R.id.snippetTextView);
if(!title.equals("")) snippetTextView.setText(snippet);
//Since markers doesn't have an extra Variable to store images I need to iterate
//through all users to get the porper photo
int photo = 0;
ImageView photoImageView = view.findViewById(R.id.photoImageView);
for(int i = 0; i < users.size(); i++){
User user = users.get(i);
if(title.equals("Username: " + user.getUsername())){
photo = user.getProfilePhoto();
break;
}
}
if(photo!=0)
photoImageView.setImageDrawable(context.getResources().getDrawable(photo));
}
@Override
public View getInfoWindow(Marker marker) {
renderWindowInfo(marker, mWindow);
return mWindow;
}
@Override
public View getInfoContents(Marker marker) {
renderWindowInfo(marker, mWindow);
return mWindow;
}
}
Personally I don't think there is something that I use that is deprecated. Even the IDE is not screaming that I am.
Here are my dependencies:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.jakewharton:butterknife:9.0.0-rc1'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc1'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.github.david-serrano:locationprovider:1.1'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
compileOnly 'org.projectlombok:lombok:1.18.4'
annotationProcessor 'org.projectlombok:lombok:1.18.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
I had to add
implementation 'com.android.support:support-v4:28.0.0'
because I think that the library that I use for location is using it.
BTW. Since I'm not a developer yet ca you guys recommend some good location library for android ?
Thank you in advance
java android google-maps google-maps-markers
add a comment |
Like in the title I got this problem and I've searched for like good 2h for the answer but none of the ones I tried worked ;/
Here is the class:
package com.example.michalwolowiec.meetup;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.model.Marker;
import java.util.ArrayList;
public class MeetUpInfoWindowAdapter implements GoogleMap.InfoWindowAdapter {
private final View mWindow;
private Context context;
private ArrayList<User> users;
public MeetUpInfoWindowAdapter(Context context, ArrayList<User> users) {
this.context = context;
this.users = users;
mWindow = LayoutInflater.from(context).inflate(R.layout.event_info_window, null);
}
private void renderWindowInfo(Marker marker, View view){
String title = marker.getTitle();
TextView titleTextView = view.findViewById(R.id.titleTextView);
if(!title.equals("")) titleTextView.setText(title);
String snippet = marker.getSnippet();
TextView snippetTextView = view.findViewById(R.id.snippetTextView);
if(!title.equals("")) snippetTextView.setText(snippet);
//Since markers doesn't have an extra Variable to store images I need to iterate
//through all users to get the porper photo
int photo = 0;
ImageView photoImageView = view.findViewById(R.id.photoImageView);
for(int i = 0; i < users.size(); i++){
User user = users.get(i);
if(title.equals("Username: " + user.getUsername())){
photo = user.getProfilePhoto();
break;
}
}
if(photo!=0)
photoImageView.setImageDrawable(context.getResources().getDrawable(photo));
}
@Override
public View getInfoWindow(Marker marker) {
renderWindowInfo(marker, mWindow);
return mWindow;
}
@Override
public View getInfoContents(Marker marker) {
renderWindowInfo(marker, mWindow);
return mWindow;
}
}
Personally I don't think there is something that I use that is deprecated. Even the IDE is not screaming that I am.
Here are my dependencies:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.jakewharton:butterknife:9.0.0-rc1'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc1'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.github.david-serrano:locationprovider:1.1'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
compileOnly 'org.projectlombok:lombok:1.18.4'
annotationProcessor 'org.projectlombok:lombok:1.18.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
I had to add
implementation 'com.android.support:support-v4:28.0.0'
because I think that the library that I use for location is using it.
BTW. Since I'm not a developer yet ca you guys recommend some good location library for android ?
Thank you in advance
java android google-maps google-maps-markers
Like in the title I got this problem and I've searched for like good 2h for the answer but none of the ones I tried worked ;/
Here is the class:
package com.example.michalwolowiec.meetup;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.model.Marker;
import java.util.ArrayList;
public class MeetUpInfoWindowAdapter implements GoogleMap.InfoWindowAdapter {
private final View mWindow;
private Context context;
private ArrayList<User> users;
public MeetUpInfoWindowAdapter(Context context, ArrayList<User> users) {
this.context = context;
this.users = users;
mWindow = LayoutInflater.from(context).inflate(R.layout.event_info_window, null);
}
private void renderWindowInfo(Marker marker, View view){
String title = marker.getTitle();
TextView titleTextView = view.findViewById(R.id.titleTextView);
if(!title.equals("")) titleTextView.setText(title);
String snippet = marker.getSnippet();
TextView snippetTextView = view.findViewById(R.id.snippetTextView);
if(!title.equals("")) snippetTextView.setText(snippet);
//Since markers doesn't have an extra Variable to store images I need to iterate
//through all users to get the porper photo
int photo = 0;
ImageView photoImageView = view.findViewById(R.id.photoImageView);
for(int i = 0; i < users.size(); i++){
User user = users.get(i);
if(title.equals("Username: " + user.getUsername())){
photo = user.getProfilePhoto();
break;
}
}
if(photo!=0)
photoImageView.setImageDrawable(context.getResources().getDrawable(photo));
}
@Override
public View getInfoWindow(Marker marker) {
renderWindowInfo(marker, mWindow);
return mWindow;
}
@Override
public View getInfoContents(Marker marker) {
renderWindowInfo(marker, mWindow);
return mWindow;
}
}
Personally I don't think there is something that I use that is deprecated. Even the IDE is not screaming that I am.
Here are my dependencies:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.jakewharton:butterknife:9.0.0-rc1'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc1'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.github.david-serrano:locationprovider:1.1'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
compileOnly 'org.projectlombok:lombok:1.18.4'
annotationProcessor 'org.projectlombok:lombok:1.18.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
I had to add
implementation 'com.android.support:support-v4:28.0.0'
because I think that the library that I use for location is using it.
BTW. Since I'm not a developer yet ca you guys recommend some good location library for android ?
Thank you in advance
java android google-maps google-maps-markers
java android google-maps google-maps-markers
asked Nov 14 '18 at 16:14
Wolo21Wolo21
83
83
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53304498%2finfowindowadapter-java-uses-or-overrides-a-deprecated-api%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53304498%2finfowindowadapter-java-uses-or-overrides-a-deprecated-api%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown