Why does the Google Maps API crash sometimes when I click on the directions button on the toolbar? - java

My Android GPS app is getting a crash sometimes when the user selects a waypoint on the map then taps the blue directions arrow button on the Google toolbar that appears at the bottom of the map.
In the crash log, the error is this:
Exception java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.android.gms.maps.model.LatLng com.google.maps.api.android.lib6.impl.cy.k()' on a null object reference
Is there any solution to this other than disabling the Google maps toolbar like this?
gm.getUiSettings().setMapToolbarEnabled(false);
In my gradle file, I'm using version 18 of the Google Maps API:
implementation 'com.google.android.gms:play-services-maps:18.1.0'

Related

How to reposition controlMarkerUI for Google Maps API in Android Studio

I've finally managed to get the setMyLocationEnabled(true) feature to show up on my map. But I have no clue how to set the constraints for the "recenter" button or the compass that comes with it. They're positioned on the top left and top right by default.
Is there anyway to reposition them or access their constraints?
The activity_maps.xml doesn't show anything.

Buttons showed when a marker is clicked in a MapsActivity in Android

I'm developing a simple app that uses one MapsActivity. Since I'm new to Android app developing, I have some doubts.
I've seen that when you click to a marker you've previously added, two buttons show up on the inferior right corner. One is to open Google Maps itself, and the other to open Google Maps with a route to the marker.
What are the activities that those two buttons start? I would just like to remove those two default buttons and make one myself with a text like "Show route", the problem is that I don't know how to acces to those two buttons (so I can remove them) and the activities they manage.
Thanks.
Try this:
mMap.getUiSettings().setMapToolbarEnabled(false);
Edit:
Please note that your mMap variable has to be initialized, otherwise you will get a null pointer exception

Android Empty Activity and Blank Activity

I am trying to make an android project and there are many types of activities,
from there I see blank activity and empty activity.
Does anyone know the difference between the two?
Blank activity is not creating main_activity.xml but is created by empty activity.
In empty activity, I am unable to add EditText Field, Does anyone know why I am not able to add it? Error says :
Exception raised during rendering: java.lang.System.arraycopy([CI[CII)V
Exception details are logged in Window > Show View > Error Log
And when I open error log, there is no error
Check which API level you're using for rendering the view. In my case it was API 20 (for Android Wear). I changed it to API 19 and the error is gone.
In my case, same to you blank activity don't generate java&layout but empty activity works well.
EditText could use with API20, API21. (BTW blank activity worked well with previous installed).
Blank Activity: this will create a blank activity with just 1 textview.
Full Screen Activity: This is typically used by games. This activity hides the status bar and then your activity takes all screen space.
Master Detail Flow: This template creates advanced navigation, based on fragments, which will work on both tablets and phones without any change

How to touch image button without getview or findViewById on Robotium?

I'm making auto test script(robotium) for android app (audio player)
but have some problems.
Touch event(getview, findViewById , clickOnView) don't work only when particular object is avaliable on screen.
I don't know what type of object it is... I'm not developer and I don't know about Java.
touch event test script like this
Button button = (Button)solo.getCurrentActivity().findViewById(com.packname.mirror.R.id.bt_menu);
solo.clickOnView(button);
Also android debug monitor can't dump view hierarchy when that particular object is available on screen - (Error obtaining UI hierarchy
Error while parsing UI hierarchy XML file: Invalid ui automator hierarchy file.)
so, I think getview, findViewById do not work only when particular object is available on the screen.
It seems need to find a way to touch image buttons without using getview or findViewById
Can't use axis touch method... many linear layout objects in app.
That cause problem when testing on various resolution devices.
In short, How to touch image button without getview or findViewById on Robotium ?
I don't have source but I have only R.java source(R.java maybe helping about it?)
please help me
(sorry for my bad English)

Google Map View on Non Touch-Screen Phones

I have implemented Google Map view in my app with a number of custom markers. I am testing in the emulator and everything works fine if I treat the emulator like a touch screen phone - I can click on the custom markers and navigate and move the map properly.
However I don't seem to be able to manipulate the map with the trackball / dpad controls. Can Google Map view be used with the trackball or dpad ?
Thanks !
Try overriding the onTrackballEvent(android.view.MotionEvent event) method in the MapView.

Categories

Resources