Skip to main content

Posts

Showing posts from December, 2019

How to create google map with drag marker to get user location with auto correct location edit text ...

For drag and drop with user location You have to create a google map fragment activity below are the xml code of google map xml <? xml version ="1.0" encoding ="utf-8" ?> < androidx.constraintlayout.widget.ConstraintLayout xmlns: android ="http://schemas.android.com/apk/res/android" xmlns: app ="http://schemas.android.com/apk/res-auto" xmlns: tools ="http://schemas.android.com/tools" android :layout_width ="match_parent" android :layout_height ="match_parent" tools :context =".GetUserLocationActivity" > < fragment android :id ="@+id/mapuserloc" android :name ="com.google.android.gms.maps.SupportMapFragment" android :layout_width ="match_parent" android :layout_height ="522dp" app :layout_constraintEnd_toEndOf ="parent" app :layout_constraintStart_toStartOf ="p

How to implement the Android ActionBar back button

Add this code in your on create activity Method  @Override protected void onCreate(Bundle savedInstanceState) { super .onCreate(savedInstanceState); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled( true ); getSupportActionBar().setDisplayShowHomeEnabled( true ); } then call this method @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id. home : finish(); return true ; default : return super .onOptionsItemSelected(item); } } this is default support action bar if you want your own then use own tool bar in your xml thanks