Android Open Source - Mero-Bhada-Meter Main Activity






From Project

Back to project page Mero-Bhada-Meter.

License

The source code is released under:

GNU General Public License

If you think the Android project Mero-Bhada-Meter listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.nirab.merobhadameter;
//from   w  w w.  jav  a  2s .  c  o m
import java.io.File;

import android.os.Bundle;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.app.Activity;
//import android.view.Menu;
import android.content.Intent;
import android.content.SharedPreferences;

public class MainActivity extends Activity {

  SharedPreferences preferences;
  boolean offline_mode;
  private String mapsFolder;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.splash);
    preferences = PreferenceManager.getDefaultSharedPreferences(this);
    Thread timer = new Thread(){
      public void run(){
        try{
              mapsFolder = Environment.getExternalStorageDirectory()
                      .getAbsolutePath() + "/merobhadameter/maps/";
              if (!new File(mapsFolder).exists())
              {
                  new File(mapsFolder).mkdirs();
              }
          sleep(3000);
        }
        catch(InterruptedException e){
          e.printStackTrace();
        }
        finally{
          offline_mode = preferences.getBoolean("offline_chkbox_preference", false);
          if (offline_mode){
            Intent openMain = new Intent(MainActivity.this, OfflineMapActivity.class);
            startActivity(openMain);
          }
          else{
          Intent openMain = new Intent(MainActivity.this, MapActivity.class);
          startActivity(openMain);
          }
        }
      }
      
    };
    timer.start();
  }

  @Override
  protected void onPause() {
    super.onPause();
    finish();
  }


}




Java Source Code List

com.nirab.merobhadameter.AsyncTaskCompleteListener.java
com.nirab.merobhadameter.DownloadOfflineData.java
com.nirab.merobhadameter.Fare.java
com.nirab.merobhadameter.MainActivity.java
com.nirab.merobhadameter.MapActivity.java
com.nirab.merobhadameter.MenuActivity.java
com.nirab.merobhadameter.MyPreferencesActivity.java
com.nirab.merobhadameter.OfflineMapActivity.java
com.nirab.merobhadameter.OfflineRoute.java
com.nirab.merobhadameter.SamplesApplication.java
com.nirab.merobhadameter.Utils.java
com.nirab.merobhadameter.ViaPointInfoWindow.java