Select to view content in your preferred language

MapView.setEsriLogoVisible(true);

2107
8
Jump to solution
04-16-2012 05:09 AM
SimonKlein
Regular Contributor
I tried this in my App and in the samples, checked for map.isLoaded() but I get a NullPointerException.
[ATTACH=CONFIG]13547[/ATTACH]

I don't need it in my app, but out of curiostiy: Is it the same for anybody else?

It is needed for attributing an App: http://help.arcgis.com/en/arcgismobile/10.0/apis/android/help/#/Attributing_your_application/0119000...
0 Kudos
1 Solution

Accepted Solutions
DanO_Neill
Deactivated User
The fix is included with our recent v1.1.1 release.  The API has not changed but the logo is now available in the SDK.

View solution in original post

0 Kudos
8 Replies
SimonKlein
Regular Contributor
So I tried this again with the method call in the onstatuschangedlistener and it does not crash, but also shows nothing on the map.
0 Kudos
AndyGup
Esri Regular Contributor
@simra, yep, these problems are related to the application life cycle and that the map hasn't been fully initialized yet. Certain processes load or run slower on a phone in comparison to a browser, so it's best to simply make sure the map has loaded before doing any actions against it by setting up an OnStatusChangedListener.

Here are some details on the OnStatusChangedListener: http://help.arcgis.com/en/arcgismobile/10.0/apis/android/api/com/esri/android/map/event/OnStatusChan...

I'm not sure why the logo wouldn't show up. Did the app throw any other errors?

-Andy
0 Kudos
SimonKlein
Regular Contributor
I just used the HelloWorld example and added a listener in which I set the logo
super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  
  // Retrieve the map and initial extent from XML layout
  map = (MapView)findViewById(R.id.map);
  // Add tiled layer to MapView
  tileLayer = new ArcGISTiledMapServiceLayer("http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");
  map.addLayer(tileLayer);
  
  map.setOnStatusChangedListener(new OnStatusChangedListener() {
   
   @Override
   public void onStatusChanged(Object source, STATUS status) {
    if(source == map && status == STATUS.LAYER_LOADED)
     map.setEsriLogoVisible(true);
    Log.i("HelloWorld","map loaded");
    
   }
  });
 }


No errors in logcat just not showing any logo.

Could you post a screeenshot of how it is supposed to look like.
0 Kudos
AndyGup
Esri Regular Contributor
@Simra, in general I'd recommend running your apps in Eclipse debug mode. That way you get access to the Eclipse debugger and DDMS/Logcat at the same time. Also, please make the following changes to your code that are in red text below. That will enable the error to show up in Logcat. Can you give this a try and let me know if anything shows up?

Note: I'm getting a nullpointer exception when I run your code, which would explain why the logo isn't showing up. We are also looking into on our end.

@Override
public void onStatusChanged(Object source, STATUS status) {
  if (OnStatusChangedListener.STATUS.INITIALIZED == status && source == map) {
     Log.d("Test", "resolution:" + map.getResolution());
     try{
      map.setEsriLogoVisible(true);
     }
     catch(Exception e)
     {
      Log.d("Test","OnStatusChangedListener: " + e.getMessage());
      System.out.println("OnStatusChangedListener: " + e.getMessage());
     }
  }
  if(OnStatusChangedListener.STATUS.INITIALIZATION_FAILED == status){
   //Best Practice to handle initialization failures
   Log.d("Test","failed: " + status.toString());
  }    
}
});



-Andy
0 Kudos
SimonKlein
Regular Contributor
Thanks. I just coded this as a quick test to see, if it is something at my end. I added this code to the normal HelloWorld example for testing.

With your changes I'm also getting a nullpointer exception.
05-08 07:51:31.250: D/Test(16743): OnStatusChangedListener: null
05-08 07:51:31.250: I/System.out(16743): OnStatusChangedListener: null
0 Kudos
AndyGup
Esri Regular Contributor
@Simra, gotcha thanks. We are going ahead and creating a CR on this issue. I don't have the number yet.

Just a side note for when it does get fixed, you should be able to turn the method to true without setting the OnStatusChangedListener.

-Andy
0 Kudos
SimonKlein
Regular Contributor
That's great news! Thank you very much!
0 Kudos
DanO_Neill
Deactivated User
The fix is included with our recent v1.1.1 release.  The API has not changed but the logo is now available in the SDK.
0 Kudos