Android Open Source - student_travel_app Simple Travel Application






From Project

Back to project page student_travel_app.

License

The source code is released under:

Apache License

If you think the Android project student_travel_app 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.piasy.simpletravel;
/*from   ww w  . ja  v a2 s . c  om*/
import android.annotation.SuppressLint;
import android.app.Application;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.widget.Toast;

import com.baidu.location.LocationClient;
import com.baidu.mapapi.SDKInitializer;
import com.piasy.simpletravel.controller.Controller;
import com.piasy.simpletravel.model.Constant;

public class SimpleTravelApplication extends Application
{
    private static SimpleTravelApplication mInstance = null;
  private SDKReceiver mReceiver;
  private LocationClient locationClient = null;
    
  @SuppressLint("HandlerLeak")
  @Override
    public void onCreate() 
  {
    Log.i(Constant.LOG_LEVEL_INFO, "app oncreate");
      super.onCreate();
      mInstance = this;
      
      SDKInitializer.initialize(this);
      Controller myController = Controller.getController();
    myController.setAPP(mInstance);
      Handler toastHandler = new Handler()
    {
      public void handleMessage(Message msg)
      {
        Toast.makeText(mInstance, (String) msg.obj, Toast.LENGTH_LONG).show();
      }
    };
    Controller.setToastHandler(toastHandler);
    myController.setActivityHandler(handler);
    
    //register SDK broadcast receiver
    IntentFilter iFilter = new IntentFilter();
    iFilter.addAction(SDKInitializer.SDK_BROADTCAST_ACTION_STRING_PERMISSION_CHECK_ERROR);
    iFilter.addAction(SDKInitializer.SDK_BROADCAST_ACTION_STRING_NETWORK_ERROR);
    mReceiver = new SDKReceiver();
    registerReceiver(mReceiver, iFilter);
    
    locationClient = new LocationClient(this);
    myController.setLocationClient(locationClient);
  }
  
  public static SimpleTravelApplication getInstance() 
  {
    return mInstance;
  }
    
  //TODO will be called?
  @Override
  public void onTerminate()
  {
    Log.i(Constant.LOG_LEVEL_DEBUG, "app onDestroy");
    super.onTerminate();
    unregisterReceiver(mReceiver);
  }
    
    @SuppressLint("HandlerLeak")
  Handler handler = new Handler()
  {
    public void handleMessage(Message msg)
    {
      Log.d(Constant.LOG_LEVEL_DEBUG, "get info at search activity : " + (String)msg.obj);
    }
  };
  
  /**
   * Broadcast receiver, listening for SDK key error, and Internet error
   */
  public class SDKReceiver extends BroadcastReceiver 
  {
    public void onReceive(Context context, Intent intent) 
    {
      String s = intent.getAction();
      Log.d(Constant.LOG_LEVEL_DEBUG, "action: " + s);
      if (s.equals(SDKInitializer.SDK_BROADTCAST_ACTION_STRING_PERMISSION_CHECK_ERROR)) 
      {
        Toast.makeText(mInstance, "key ?????! ?? AndroidManifest.xml ????? key ??",
            Toast.LENGTH_LONG).show();
      } 
      else if (s.equals(SDKInitializer.SDK_BROADCAST_ACTION_STRING_NETWORK_ERROR)) 
      {
        Toast.makeText(mInstance, "????", Toast.LENGTH_LONG).show();
      }
    }
  }
}




Java Source Code List

com.piasy.simpletravel.AllPlanActivity.java
com.piasy.simpletravel.HotelDetailActivity.java
com.piasy.simpletravel.LaunchActivity.java
com.piasy.simpletravel.MapViewActivity.java
com.piasy.simpletravel.MyListViewAdapter.java
com.piasy.simpletravel.PopMenu.java
com.piasy.simpletravel.ScrollRefreshListView.java
com.piasy.simpletravel.SearchActivity.java
com.piasy.simpletravel.SettingActivity.java
com.piasy.simpletravel.SignupActivity.java
com.piasy.simpletravel.SimpleTravelApplication.java
com.piasy.simpletravel.SingledayPlanActivity.java
com.piasy.simpletravel.SpotDetailActivity.java
com.piasy.simpletravel.controller.Controller.java
com.piasy.simpletravel.dao.DBHelper.java
com.piasy.simpletravel.dao.DBManager.java
com.piasy.simpletravel.model.CommitModule.java
com.piasy.simpletravel.model.Constant.java
com.piasy.simpletravel.model.Flag.java
com.piasy.simpletravel.model.HotelSeacher.java
com.piasy.simpletravel.model.ListViewItems.java
com.piasy.simpletravel.model.LocationModule.java
com.piasy.simpletravel.model.PlanGenerator.java
com.piasy.simpletravel.model.RouteEntry.java
com.piasy.simpletravel.model.Setting.java
com.piasy.simpletravel.model.SignupModule.java
com.piasy.simpletravel.model.SpotsSeacher.java
com.piasy.simpletravel.model.VerifyModule.java
com.piasy.simpletravel.util.Util.java
dao.DBManager.java
driver.Driver.java
model.CommitHandler.java
model.Constant.java
model.QueryHandler.java
model.Setting.java
model.SignupHandler.java
model.VerifyHandler.java
parser.Driver.java
parser.HotelSeacher.java
util.Util.java