Note that there are some explanatory texts on larger screens.

plurals
  1. POI can't close alertdialog
    text
    copied!<p>I created an alertdiaolog in a class. I put a custom closebutton and another button for make a call. I set these items in a different mapActivity class. </p> <p>Actually i have two problems. One is when i try to close my alertdiaolog with close button nothing happens second is when i try to make a call i get IndexOutofBound exception error.</p> <p>Here is my code : </p> <pre><code> Context mContext = getApplicationContext(); LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.alertmenu, (ViewGroup) findViewById(R.id.widget0)); ImageButton alertimagebutton = (ImageButton) layout.findViewById(R.id.closebutton); alertimagebutton.setImageResource(R.drawable.close_button); Button alertphone = (Button) layout.findViewById(R.id.widget35); alertphone.setText(phonevalue.get(i)); //call alertphone.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { try { System.out.println(phonevalue.get(i)); Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:"+phonevalue.get(i))); startActivity(callIntent); } catch (Exception e) { System.out.println("Couldn't make a call= "+e); } } }); //close alertimagebutton.setOnClickListener(new View.OnClickListener(){ public void onClick(View v) { System.out.println("closed"); // logcat shows this message MyClass.alertDialog.dismiss(); } }); MyClass.alertDialog = builder.create(); mapOverlays.add(MyClass); </code></pre> <p>Note: I did this same things for listview activty and it works fine. When user clicks for detalied view it shows my alertdiaolog and can close and make call. But i created my alertdiaolog in same activity not a different class. </p> <p>Note 2 :I do this for when user clicks an image in map i want to show detailed view about this person. First i created balloon and second user clicks this button it shows images detailed view.</p> <p>EDIT : I solved phonecall problem. I declared another string variable after i set my phoneno:</p> <pre><code> Button alertphone = (Button) layout.findViewById(R.id.widget35); alertphone.setText(phonevalue.get(i)); final String phone = phonevalue.get(i); </code></pre> <p>And i changed callintent :</p> <pre><code> callIntent.setData(Uri.parse("tel:"+phone)); </code></pre> <p>Now it works fine but still i can't close my dialogbox.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload