Skip to main content

Posts

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

Saved Perf in Android

Just add this class in your package  package com.plzf1.rollearn ; import android.app.Application ; import android.content.SharedPreferences ; public class MyApplication extends Application { public static final String MENULIST = "menulist" ; public static final String VEGLIST = "veglist" ; public static final String CARTLIST = "cartlist" ; public static final String FRUITLIST = "fruitlist" ; @Override public void onCreate () { super .onCreate() ; } public void saveIntoPrefs (String key , String value) { SharedPreferences prefs = getSharedPreferences(Fconstants.PREF_NAME , MODE_PRIVATE ) ; SharedPreferences.Editor edit = prefs.edit() ; edit.putString(key , value) ; edit.commit() ; } public void saveIntoPrefs (String key , int value) { SharedPreferences prefs = getSharedPreferences(Fconstants.PREF_NAME , MODE_PRIVATE ) ; SharedPreferences.Edit...

Room Data base config insert update delete

for use room data base in android you need to setup faw things first you have to add two deandancy in your gradel file  implementation "android.arch.persistence.room:runtime:1.0.0-beta2" annotationProcessor "android.arch.persistence.room:compiler:1.0.0-beta2" then make a entity class and dao class in your file structure  Data base class   package com.plzf1.rollearn.database; import android.arch.persistence.room.Database; import android.arch.persistence.room.RoomDatabase; @Database(entities = User.class , version = 1) public abstract class MyDataBase extends RoomDatabase {     public abstract UserDao userDao(); } Entity Class android.arch.persistence.room.ColumnInfo; import android.arch.persistence.room.Entity; import android.arch.persistence.room.PrimaryKey; @Entity(tableName = "user") public class User {     @PrimaryKey(autoGenerate = true)     private int us...

Configuration 'compile' is obsolete and has been replaced with 'implementation'. It will be removed at the end of 2018

just add it in your main gradel file  and add this in your project gradel dependencies { classpath 'com.android.tools.build:gradle:3.1.0' classpath 'com.google.gms:google-services:3.2.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } repositories { jcenter() maven { url "https://jitpack.io" } }

How to add DNS in google cloud

how to add dns in google cloud  1 click on Cloud DNS under networking  create name of dns  DNS name - your website name 2 click on add record set in record resourse type set as a  3 pase your cloud server ip in IPv4 text Area again click on add record set  1. in DNS name set "www" 2 in resourse record type select cname 3. in canonical name type your domain name