2014-09-12 93 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

相关问题