2014-09-12 74 views
0

任何人都可以告訴我這有什麼問題嗎?它給我一個錯誤;}} 我添加和刪除{}和(),但它沒有工作。 我從這個計算器代碼,但沒有奏效它給了我一個GPS的錯誤

package com.f.da; 
    import android.app.Activity; 
    import android.content.Intent; 
    import android.net.Uri; 
    import android.os.Bundle; 
    import android.widget.Button; 
    import android.view.View; 
    import android.view.View.OnClickListener; 

    public class PageSeven extends Activity { 
     Button da; 
     @Override 
     public void onCreate(Bundle savedInstanceState) { 
      super.onCreate(savedInstanceState); 
      setContentView(R.layout.oulo); 
      addListenerOnButton(); 
     } 
     public void addListenerOnButton() { 
     da = (Button) findViewById(R.id.da);; 
      da.setOnClickListener(new OnClickListener() { 
       @Override 
       public void onClick(View arg0) { 
        String CURRENT_LOCATION = "37.980442, 23.727892"; 
        String DESTINATION_LOCATION = "DA"; 
        Intent intent = new Intent(android.content.Intent.ACTION_VIEW, 
        Uri.parse("http://maps.google.com/maps?saddr="+ CURRENT_LOCATION +" daddr="+DESTINATION_LOCATION)); 
        startActivity(intent); 
       } 
      }}; 
     } 
    } 
+0

發佈錯誤的stacktrace ... – John 2014-09-12 11:26:33

+0

嗯,我該怎麼做? – Shams 2014-09-12 11:29:15

回答

0

更換}};});。您需要爲setOnClickListener(關閉)

+0

謝謝laalto :) – Shams 2014-09-12 11:41:58

相關問題