package com.sjriley.zappit.models; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.protocol.HTTP; import org.apache.http.util.EntityUtils; import com.sjriley.zappit.PreferencesActivity; import android.content.Context; import android.content.SharedPreferences; import android.location.Location; import android.location.LocationManager; import android.util.Log; public abstract class BaseModel { private static final String TAG = BaseModel.class.getSimpleName(); protected HttpClient httpClient; protected LocationManager locationManager; Context context ; public BaseModel(Context context) { this.context = context; httpClient = new DefaultHttpClient(); } protected Location getLocation(){ SharedPreferences prefs = context.getSharedPreferences(PreferencesActivity.DEFAULT_PREFERECES, 0); Location location = new Location(""); location.setLatitude(Double.parseDouble(prefs.getString(PreferencesActivity.LATITUDE, "0"))); location.setLongitude(Double.parseDouble(prefs.getString(PreferencesActivity.LONGITUDE, "0"))); Log.d(TAG, "long =" + location.getLongitude()); Log.d(TAG, "lat =" + location.getLatitude()); return location; } }