Shift+Shift — Search Every Where Ctrl+F — Find Text with in a Single File Ctrl+Shift+F - Find Text in All Files Ctrl+R — Replace Selected Text in a Single File Ctrl+Shift+R — Replace Selected Text in all Files (Be Careful while Using This) Ctrl+Shift+A — Search for IDE Commands
Navigation Keys
Ctrl+N — Navigate to Class Ctrl+Shift+N — Navigate to a File Ctrl+B — Jump to Declareations Alt+ ↑ — Jump to Previous Method Alt+↓ — Jump to Next Method Ctrl+G — Jump to Line Ctrl+E — Recent Files Ctrl+Shift+Back Space — Jump to Last Edited Location Ctrl+B — Find Declarations Ctrl+Left Mouse(or)Ctrl+Alt+F7— Show Usage Alt + F7 / Ctrl + F7 — Find usages /Find usages in file Ctrl+Shift+B — Find Implementations F3 — Find Next Shift+F3 — Find Previous
Selection Keys
Ctrl + W — Extend selection (selects a word->line->method->Class ) Ctrl +Shift+ W — Decrease Selection Alt + J — Select next occurrence Ctrl + Alt + Shift + J — Select all occurrences Alt + Shift + J — Unselect occurrence Ctrl+Shift+V — Paste from recent buffers (from a History of Copied Contents)
Editing Keys
Ctrl+F6 -Refractor Code Ctrl+D — Duplicate a Line/Selected part Ctrl+Y — Delete a Line/Selected part Ctrl+Q — Quick Documentation Ctrl + Space — Code completion Ctrl+Shift+Space — Smart code completion (by expected type removes unrelated suggestions) Alt+Insert — Generate Code Ctrl+J — Insert Live template Ctrl + O — Override methods Ctrl + I — Implement methods Ctrl + Alt + T — Surround with… Ctrl + / — Comment / uncomment with line comment Ctrl + Shift + / — Comment / uncomment with block comment Ctrl+Alt+L — Reformat code
Run
Ctrl + F9 — Compile and Run Make project Ctrl + Shift + F9 — Compile selected file, package or module Shift + F10 — Run Shift + F9 — Debug Ctrl + Shift + F10 — Run context configuration from editor
Debugging
F8 / F7 — Step over / into Shift + F7 / Shift + F8 — Smart step into/Step out Alt + F9 — Run to cursor Alt + F8 — Evaluate expression F9 — Resume program Ctrl + F8 — Toggle break point Ctrl + Shift + F8 — View breakpoints
publicvoidonClickBtn(View v)//The function name can be changed { Toast.makeText(this, "Clicked on Button", Toast.LENGTH_LONG).show(); //Dummy code //Code Here }
<?xml version="1.0" encoding="utf-8"?> <manifestxmlns:android="http://schemas.android.com/apk/res/android" package="com.example.max.lab10"> <!-- The ACCESS_COARSE/FINE_LOCATION permissions are not required to use Google Maps Android API v2, but you must specify either coarse or fine location permissions for the 'MyLocation' functionality. --> <uses-permissionandroid:name="android.permission.ACCESS_FINE_LOCATION" />
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <!-- The API key for Google Maps-based APIs is defined as a string resource. (See the file "res/values/google_maps_api.xml"). Note that the API key is linked to the encryption key used to sign the APK. You need a different API key for each encryption key, including the release key that is used to sign the APK for publishing. You can define the keys for the debug and release targets in src/debug/ and src/release/. --> <meta-data android:name="com.google.android.geo.API_KEY" android:value="@string/google_maps_key"/>
// Obtain the SupportMapFragment and get notified when the map is ready to be used. SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); }
/** * Manipulates the map once available. * This callback is triggered when the map is ready to be used. * This is where we can add markers or lines, add listeners or move the camera. In this case, * we just add a marker near Sydney, Australia. * If Google Play services is not installed on the device, the user will be prompted to install * it inside the SupportMapFragment. This method will only be triggered once the user has * installed Google Play services and returned to the app. */ @Override publicvoidonMapReady(GoogleMap googleMap){ mMap = googleMap;
// Step 3: Initialize city coordinates privatevoidinitializingCity(){ HongKong = new LatLng(22.2783,114.1747); Paris = new LatLng(48.8567, 2.3508); London = new LatLng(51.518815, -0.1275); NewYork = new LatLng(40.713723, -74.012640);
}
//Step 4: Code for user's button click response
privatevoidgoLondon(){ // Code for actions when btnLondon is clicked mMap.clear(); double distance = computeDistance(London); String distMsg = "Distance from HK: " + distance + "Km";
// Step 5: Compute the actual spherical distance between 2 cities on earth privatedoublecomputeDistance(LatLng dest){ int R = 6731; // earth radius in km double dLat = Math.toRadians(HongKong.latitude-dest.latitude); double dLng = Math.toRadians(HongKong.longitude-dest.longitude); double lat1 = Math.toRadians(dest.latitude); double lat2 = Math.toRadians(HongKong.longitude);