Tuesday, June 12, 2012

Android: SharedPreferences shared by different activities

Following code cannot be shared by different Activities:

context.getSharedPreferences("PreferenceManager", context.MODE_PRIVATE).getString(key, defaultValue);

If you save on one Activity and wants to load on the other activity, the other Activity cannot find it.

Solution:
PreferenceManager.getDefaultSharedPreferences(context).getString(key, defaultValue);

Monday, June 11, 2012

Domain: How to register your domain to search engine?



Domain: How to promote your website to search engines? (for free)

iNeedHits - iNeedHits

Submit Express - Submit Express

DreamSubmit - DreamSubmit

Android: How to get device unique ID example

Available starting from 2.3+ (level 9)

  public void example() {
         String sUID = Build.SERIAL;
  }

Android: Get device model name example


  public void example() {
         String sModel = Build.MODEL;
  }

Android: Get device CPU Processor example


  public void example() {
         String sCPU = Build.CPU_ABI;
  }

Android: Get device manufacturer name example


  public void example() {
         String sManufacturer = Build.MANUFACTURER;
  }

Android: Get Android OS version example

  public void example() {
         String sOSVersion = Build.VERSION.RELEASE;
  }

Android: Wifi - Get hidden SSID example


       WifiManager wifiManager = (WifiManager)
                    getSystemService(Context.WIFI_SERVICE);
       WifiInfo wifiInfo = wifiManager.getConnectionInfo();
       String hiddenSSID = wifiInfo.getHiddenSSID();

Android: wifi - Get Network Link Speed exmaple


       WifiManager wifiManager = (WifiManager)
                    getSystemService(Context.WIFI_SERVICE);
       WifiInfo wifiInfo = wifiManager.getConnectionInfo();
       String networkSpeed = wifiInfo.getLinkSpeed();