Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Android Programming: Android Studio: Google Maps API I have this part of code in my MapsActivity.java that keeps crashing when I click on the polygon,

Android Programming: Android Studio: Google Maps API

I have this part of code in my MapsActivity.java that keeps crashing when I click on the polygon, how do i fix it?

==================================================================================================== mMap.setOnPolygonClickListener(new GoogleMap.OnPolygonClickListener() { @Override public void onPolygonClick(Polygon polygon) { AlertDialog.Builder mBuilder = new AlertDialog.Builder(MapsActivity.this); @SuppressLint("InflateParams") View mView = getLayoutInflater().inflate(R.layout.dialog_info, null); final NumberPicker numberPicker = (NumberPicker) mView.findViewById(R.id.hours); numberPicker.setMinValue(0); numberPicker.setMaxValue(24); Button mPay = (Button) mView.findViewById(R.id.btnPay); mPay.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if(numberPicker.getValue() > 0){ Toast.makeText(MapsActivity.this,"Thank You", Toast.LENGTH_SHORT).show(); }else{ Toast.makeText(MapsActivity.this, "Please pick your Hours", Toast.LENGTH_LONG).show(); } } }); mBuilder.setView(mView); AlertDialog dialog = mBuilder.create(); dialog.show(); } }); 

===============================================================================================

dialog_info.xml

     

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions

Question

If youre paying a lot more, you may be the one whos being set up.

Answered: 1 week ago

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago