How to show a ProgressDialog when MapView (MapBox) is loading on Android? - android

I have an Activity that i use to show a MapView from the Android mapbox-sdk.
I am trying show a ProgressDialog while the MapView is loading , so that i need to listen to any load finishing event.
Looking at the Documentation Site, the only available listeners are listed below
MapView.OnFlingListener
MapView.OnFpsChangedListener
MapView.OnInfoWindowClickListener
MapView.OnMapChangedListener
MapView.OnMapClickListener
MapView.OnMapLongClickListener
MapView.OnMarkerClickListener
MapView.OnMyLocationChangeListener
MapView.OnScrollListener
Anyone have done that with the version 2.2.0 of MapBox for Android? It could be a workaround too.
Thanks in advance.

I believe that issue on Mapbox-GL GitHub solves what you are looking for:
https://github.com/mapbox/mapbox-gl-native/issues/630

Related

Android drag and return to previous activity like Facebook and Google Photos

I have been finding a way to implement animation like Facebook and Google Photos. When in 2nd Activity, when dragging images the images follow and the 2nd Activity started to fade out and we see 1st Activity. Images of what I was trying to ask is here.
Was you able to find a full fledged solution for this ?
https://github.com/nickbutcher/plaid , It might give clues to entry transition and how that was accomplished . So it might help you there. But how about when you want to drag and dismiss that activity?
https://github.com/Commit451/ElasticDragDismissLayout , Its an interesting library. Does do drags . But doesn't remember the position where the thumbnail where it was launched from. Only handles 1 swipe direction and dismisses by sliding to the right. So its not that close to what they do in 2017 Jun Google Photos Android application. You might have to modify it.
If anyone knows a better solution to this please do share.
I have found some code from Nick Butcher sample code.
ElasticDragDismissFrameLayout.java
and when using it:
chromeFader = new ElasticDragDismissFrameLayout.SystemChromeFader(getWindow()) {
#Override
public void onDragDismissed() {
finishAfterTransition();
}
};

Progressdialog for phonegap projects

I am very new to html5, css and javascript. i have knowledge in android development.
Now i have started working on phonegap projects.
In my project i want show a loader just like a progressdialog in android when application moves from one screen to another screen or loading something.
Can any one help me to do this in html5?
I had similar need . I was able to do it using navigator object. Please find below sample code
to load data in background
function someJSFunctionLoadingData() {
navigator.notification.activityStart("Your message....", "loading");
////// some activity
navigator.notification.activityStop();
}
Further to navigate around you could use introduce a small delay ( 2 secs) and let progress bar load during that time and then direct user to the url you need. Below is the example for same
function loadMyUrl(){
navigator.notification.activityStart("Loading some url....", "loading");
setTimeout(function loadMyUrl(){
navigator.app.loadUrl('file:///android_asse/www/someurl.html');
navigator.notification.activityStop();
}, 2000 );
}
I got above idea from this link
An easy solution would be to just create a css based spinner element and set it to hidden/visible when needed via your js.
I searched and found tons of examples online here is one for example.

MapView rendering with tiles missing with an "x" in the center

This is very, very strange. I've never seen anything like it. At the time I am took this screenshot, I'm not loading any overlays. First, I thought it was my internet connection where it couldn't download the tile information; but we have many users reporting the same issue who downloaded from the market. This just started happening like a week ago. Not sure why though. Anyone have a clue? Thanks!
Ok. After starting from a clean project I found these two lines of code that was the culprit.
mapView.setSatellite(true);
mapView.setStreetView(true);
They appeared back to back of each other and I looked back at the very beginning of development and they were there and it worked just fine. Apparently, this is a BUG in the MapView as I'm guessing it tries to show both SateliteView and StreetView at the same time. One would think that the latter would override the former; but I guess not.
So, the question I have is, why this all of the sudden surfaced just within the last week or so. My guess is that the Maps Application was last updated in the market on Sept 8th and maybe a day or so after updating from the market, this issue started to resurface.
As a test, can someone just add these two lines to their code and confirm you get the same behavior?
I had only setStreetView(true) and getting those annoying grey boxes. I played around with both lines with no luck. Solved it by removing both setStreeView and setSatellite from my code, goes to streetview by default.
I had the same problem with my app that uses google maps library... Because i have in my setting option where user can change view of the map to Satelite or Street, i dont use setStreetView(true) at all...just mapView.setSatelite(true or false)...
preferences = PreferenceManager.getDefaultSharedPreferences(this);
pogled = preferences.getString("list", "Street");
if(pogled.equalsIgnoreCase("Street")){
mapView.setSatellite(false);
//mapView.setStreetView(true);
}else if (pogled.equalsIgnoreCase("Satelite")) {
mapView.setSatellite(true);
}
As you can see i had mapView.setStreetView(true) but that gave me a headache... :D I hope this will help you...
I removed setStreetview(true) from my code and now its working fine i was saw this issue occured in last 2 weeks , nyway we finally solved the issue thats great
Street view is always considered as the default option.
The problem arises when we use both setStreetView(true) and setSatellite(true) at the same time. Problem will be solved like this
if(mapView.isSatellite()){
mapView.setSatellite(false);
}else{
mapView.setStreetView(false);
mapView.setSatellite(true);
}
I hope that will help
private void setUpMapTypeScreen() {
if (mapType.equalsIgnoreCase("Satellite")) {
mapView.setSatellite(true);
// mapView.setStreetView(false);
} else if (mapType.equalsIgnoreCase("StreetView")) {
mapView.setSatellite(false);
// mapView.setStreetView(true);
}
mapView.invalidate();
}
mapType is a user defined string variable. Not false the previous view type when switching to view types. that the error we made, only set the view type you required.
I had the same problem, I took out my mapController, and it fixed it. The only other thing I did different was put the mapview in a linearlayout with a textview (it used to just be a mapview only) and I played around with the mapcontroller, commenting it out.
Since those are the only two things I changed, I'm pretty sure your problem lies in there as well.
I was having the same problem and the common advice that I have got is to not use setStreeView(true) and setSatellite(true) together. Some have even suggested not to use setStreetView(true) altogether. But my code was working okay before. I had to reinstall my machine and therefore installed android SDK and other components afresh after which this started happening. So my guess is that this is an issue with some specific version But I have found out that this problem occurs specific revision of 2.2 - in my case Android SDK Platform 2.2, revision 3. I have tried running same code on 2.3 and it works correctly i.e no grey boxes.
Besides removing mapController.setStreetView(true), there is also another thing that should be added to the layout XML..
xmlns:android="http://schemas.android.com/apk/res/android"
<com.google.android.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/mapa"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="YOUR API KEY"
android:clickable="true"></com.google.android.maps.MapView>
Note the xml namespace after com.google.android.maps.MapView. After adding the namespace, the cross tiles disappeared. Don't know if it's a bug or the namespace is necessary in order for the api render the map correctly. Either way, it worked.

Appcelerator titanium - MapView on android causes app crash

am trying to display a map on android emulator, using the following code:
var window = Ti.UI.createWindow();
window.open();
var mapView = Ti.Map.createView({
mapType: Ti.Map.STANDARD_TYPE,
region:{
latitude:33.74511, longitude:-84.38993,
latitudeDelta:0.5, longitudeDelta:0.5
},
animate:true,
regionFit:true,
userLocation:true
});
window.add(mapView);
alert(mapView)//outputs Ti.Map.View
I have made all the steps mentioned here http://wiki.appcelerator.org/display/guides/Maps+for+Android
but the application crashes. Does anyone has an idea what might be causing this?
thank you
Without a stacktrace of your crash I can only guess it's caused by an emulator which does not provide the Google Maps API. See http://developer.appcelerator.com/question/121105/crash-in-android-when-using-maps
try removing the your key here from the tiapp.xml file then refreshing the android emulator and it will work but resets to the empty google interface anybody got any ideas
You may have created other Map views elsewhere in your code.In that event,Google doesnt allow that and you end up with a force close (IllegalStateException)

Android : Issues with medialets ads

I wanna use medialets ad in my android app. I have faced some issues which are listed below,
Got an sample with downloaded sdk, banner ads are not working in the sample itself, can anyone got this issue, whats wrong with the banner ads?
And Interstitial ads are working fine with the normal activity which extends AdActivity. If I load the following lines in oncreate then its getting crashed.
InterstitialAdView view = new InterstitialAdView(AdDemo.this);
view.setSlotName("ViewTwoFull");
view.prepare();
If I give that inside onclick() then its working fine.
Actually I want to load the interstitial ads when an item clicked in the list, my list activity is there with in the tab activity, in this case interstitial ad also not coming.
Can anyone worked with medialets, how to solve these issues.
Thanks in advance.
I am the Lead Integration Engineer at Medialets. Please email help#medialets.com with the name of the App you are working on, the SDK version, and the issues you are having. We will get back to you with help as soon as possible.
Thanks,
Chris
# Ashok : uset these two lines in ur oncreate method
getAdManager().setServiceListener(this);
getAdManager().start(getParent());

Categories

Resources