package com.example.restaurantfinder;
public class SearchBarActivity extends Activity implements LocationListener{
protected LocationManager locationManager;
protected LocationListener locationListener;
protected Context context;
private EditText mSearchTerm;
String ll;
String provider;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
setContentView(R.layout.search_layout);
setTitle("Search using yelp");
mSearchTerm = (EditText)findViewById(R.id.searchTerm);
}
@Override
**public void onLocationChanged(Location location) {
ll = location.getLatitude() + "," + location.getLongitude();
}**
public void search(View v) {
String term = mSearchTerm.getText().toString();
Intent intent = new Intent(this, YelpSearchListActivity.class);
intent.setData(new Uri.Builder().appendQueryParameter("term", term).**appendQueryParameter("ll", ll)**.appendQueryParameter("radius_filter","5000").build());
startActivity(intent);
}
}
I am new to Java and android.What I want to do is calculate longitude and latitude as the location changes and pass it on to my query appendQueryParameter("ll", /* function*/). How can I do this?