谁能告诉我这是怎么了?它给了我一个错误;}}我添加并删除了{}和(),但没有用。我从stackoverflow中获取了这段代码,但是没有用
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);
}
}};
}
}
替换}};
为});
。您需要关闭)
的setOnClickListener(
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句