Can anyone tell me what's wrong with this? It's giving me an error on ;}} I added and removed {} and () but it didn't work. I took this code from stackoverflow but it didn't work
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);
}
}};
}
}
Replace }};
with });
. You need a closing )
for the setOnClickListener(
.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments