Professional Documents
Culture Documents
NAVIGATION
NAVIGATION
<EditText
android:layout_Width="rap_content"
12 android:ayout_height="wrap_content
android:id="0+id/et_dest"
10 android:hínt-"Enter Destination Locationt
<Button
android:layout_width="urap_content"
android:layout_height="wrap_content" T
android:id="0+1d/bi"
android:text="Uisplay Location />
/LinearLayout>
LinearLayout EditTet
PV
Version Contral
ETODOProblems Terminal App Quality Insights O Senites ADp inspection
Eile Edit View Navigate Code Befactor
com) example navigation) MainActivity
Resource
Manager
ProjedNavigation) apPP src main java
sctivity_main.xm! x MainActivityjava
package com. example. navigation;
CompatActivity;
Oimport androidx .appcompat. app. App
Hinport . .
15
16 public class MainActivity extends AppCompatActivity {
17
2 usages
18 EditText etsource, etdestination;
2usages
19 Button bl;
20 @SuppressLint ("MissingInflatedId")
21 G0verride
22 ef b protected void onCreate (Bundle savedInstanceState) {
23
Super.onCreate (savedInstanceState):
setContentView (R.Layout.activity_moin);
25
26 etsource=(EditText) findViewById (R.1d.et_source);
27
etdestination= (EditText) findViewById (R.id.et_dest) ;
28 bl=(Button) findViewById (R. 1d. b1);
29
bl.setonClickListener (new View.OnClickListener () {
30
B0verride
31 of public void onCLick(View v) {
32
33
String ssrcsetsource.getText (). toString (). trin();
34
String sdes=etdestination.getText () . toString ().trín();
35
if (ssrc. equals ("*)& sdes.equals ("") )
37
38
Toast.makeText( context MainActivity. this, tat "Enter Both Locations, Toast. LENGTH_SHOR).show(0:
1
elset
DisplayTrack (ssrc, sdes);
P Version Control TODO Problems Terminal App Quality fnsights O Services App InspectionELogcat
Microsoft Delender confiquratior The 1DE Profiler
atin) 2pp sc) main java) com) eample navigation)MainActivity)O onCreate) anonymous OnClickistener)onClick 5 sppCSmall Phone API 30 d B
Pactivity,mainxmxMeinActivity a
Toast.aokeText( contet MainActivity. this, tert "Enter Both Locations", Toast. LENGTH_SHORT) .shoN() ;
etsef
DisplayTrack(ssrc, sdes) ;
Tusage
47 private void Display Track (String ssrc, String sdes)
4 try {
Uri uri-Uri. porse ( unString
"https://qo0qle.co.in/naps/dir/"*ssrc+"/"*sdes);
Intent intent=new Intent (Intent. ACTION_VIEW, Ur1);
5 intent.setPackage("com.google.andro1d.apps.naps");
intent.setFlags (Intent.FLAG ACTIVITY NEW_TASK):
startActivity (intent):
P Vion Cortrl
ETODO Prselems Terminal
ooh Dlender configution App Cuality Insights O
The DE has deeced M Stnices App Inspection