Monday, February 14, 2011

Wednesday, December 16, 2009

Getting Current Location on Android SDK, requestLocationUpdates

Sorry that I've been MIA for past few month, didn't do any development and I was more focused on life. I am back to android development now and obviously I ran into few problems.

I've spent entire day trying to figure out how to get current location and yet all these forum posts were only giving half of the answer, so i decided to blog about it.

Step 1:
The permission is required on AndroidManifest.xml
please make sure

is there.

Step 2:
Listener is required due to the fact the last known location seems to be null all the time on the emulator. And somehow you need an empty class to accommodate that, I don't know why but it's just the way it is, and you can't declare new LocationListener() for some reason.

public class CurrentLocationListener implements LocationListener{

public void onLocationChanged(Location argLocation) {

}
public void onProviderDisabled(String provider) {
}

public void onProviderEnabled(String provider) {
}

public void onStatusChanged(String provider, int status, Bundle arg2) {
}
}


Step 3:
Declare Location Manager and Listener in order to get current latitude and longitude
in whichever class you decide to write them in.


LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

LocationListener myLocationListener = new CurrentLocationListener();

locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1, 1, myLocationListener);

Location currentLocation = locationManager.getLastKnownLocation("gps");

String Latitude = String.valueOf(currentLocation.getLatitude());
String Longitude = String.valueOf(currentLocation.getLongitude());


This worked for me up to this date, if it has any problems feel free to make comment on it.

I'll post about how to get data from wcf next time.

Monday, June 29, 2009

Detention slip, "Thats what she said"


Today my network administrator emailed us this for some fun.

Apple's joke, showing PC as blue screen of death.


So I've been messing around with my Macbook Pro, I've been using finder to access other people's computer to get shared files and such.

But I've noticed something very interesting today, the PC icon on Finder is actually blue screen of death... lol

Wednesday, May 20, 2009

My first Mac, a UniBody MacBook Pro at $1500


After weeks of surfing craigslist, replying to all sort of scams and went to many places to meet up, I've finally managed to buy a Macbook Unibody at $1500 from Mike King, I gave him a great review due to transaction was successful.

The spec is

2.4Ghz Core 2 duo
2GB Ram
250GB 5400RPM hard drive
It sells for $1999 at bestbuy or apple store.

I've always been a PC user, and I still intend to install windows on this Mac, but after using it for one day I've find myself impressed about how much Apple care about their product, from trackpad to the charger, every piece is done with great detail. I shopped in bestbuy for 2 days and the more I look at Mac, the more I enjoy the quality of the product, which eventually made me making the decision on buying the mac.

Throughout all these times searching for DSLR camera and macbook, I've manage to realize that value of an item is only worth it when it exchanges hand without losing its value, and only quality product intend to maintain their value. If I've bought a PC, the moment I buy it anywhere it loses all its value right after, and it just seems so hard to find PC makers making quality product these days, everything is wrapped with cheap plastics which gets overheat very easily.

Wednesday, May 13, 2009

Android SDK's Guide, Image from Gallary to be Clickable

Android's Online Resource is very limited, it took me a day before I can figure out how to make those pictures in the photo gallery clickable. I am still a newbie at android development, but I have never spend this much time trying to figure out something that's this simple.

On the android's website it has Hello Gridview guide, which shows you the photo gallary. If you want further clicks from those photos following code is to be added.

All the XML has already set up in the tutorial.

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
GridView gridview = (GridView) findViewById(R.id.photogridview);
gridview.setAdapter(new ImageAdapter(this));

gridview.setOnItemClickListener(new OnItemClickListener() {
@SuppressWarnings("unchecked")
public void onItemClick(AdapterView parent, View v, int position, long id){
GoDoWhatever();
}}});
}

protected void GoDoWhatever()
{
//Do Whatever you want to do after pictures in the gallery are being clicked
}

Hopefully this helps

Friday, May 8, 2009

Craigslist Spammer, Craigslist Scammer, They should get banned

I've been trying to buy a laptop for a while, hunting deals off slickdeals and fatwallet. California Tax is 9.25%, buying anything off online or retail store feels like getting ripped off because I'd be paying almost 10% more for someone else's irresponsible action. So I decide to get one off craigslist, at least I can bargain down some price off these over priced laptops.

Craigslist Major City such as Los Angeles, New York were filled with spam results when someone search for "HP Pavillion" or "Dell Latitute", even "Apple Macbook Pro". And all these posts will end up with a image on the bottom to show their websites. Most of them are from china with a phone number leaving behind, and their website will make it look like its an actual site.

Buyers be aware, these spammers are also scammers, the site that they direct you is actually scam sites. Do not deal with craigslist seller if you can not meet them in person, do not send them money over any form of transaction other than cash. If you try to save a few bucks on these foreign over sea bargain, you'll end up losing your money without realizing it.

I really hope craigslist would do something about it soon, such as banning proxy sites and sites from foreign countries, this way we'd have some regulation in the system, free of spams and scams.