Wednesday, March 14, 2012

Always show zoom controls on a MapView in Android

 Always show zoom controls on a MapView in android.
problem:
i want show zoom controls on a Mapview always.
Solution:
 below  the code for get zoom controls always in mapview 2 way.
         mapView = (MapView) findViewById(R.id.mapview);
          mapView.setBuiltInZoomControls(true);
          mapView.getZoomButtonsController().setAutoDismissed(false);
                            
or

<ZoomControls android:id="@+id/zoomcontrols" android:layout_width="wrap_content" android:layout_height="wrap_content" />    
 ZoomControls zoomControls = (ZoomControls) findViewById(R.id.zoomcontrols);      zoomControls.setOnZoomInClickListener(new View.OnClickListener() {             
 @Override                  
public void onClick(View v) {                         
 mapController.zoomIn();               
  }        
 });        
 zoomControls.setOnZoomOutClickListener(new View.OnClickListener() {              
@Override               
  public void onClick(View v) {                        
 mapController.zoomOut();                
 }       
  });  

Monday, March 12, 2012

Android StatusBar Notification with Badge icon

Android Status Bar Notification with Badge icon.

Now you can display status bar notification with badge icon in android .

Source code :
 Notification notification = new Notification(R.drawable.ic_launcher,  "Notify",System.currentTimeMillis()); 
  notification.setLatestEventInfo(NotificationActivity.this, 
  "notify","Description", 
  PendingIntent.getActivity(this.getBaseContext(), 0, intent, 
  PendingIntent.FLAG_CANCEL_CURRENT)); 
      notification.number = 5;
      mManager.notify(APP_ID, notification);  


Screen shot:



 Below link i attached source code for this one you can download it.

DOWNLOAD SOURCE CODE

Saturday, March 10, 2012

Voice Navigation Application


VOICE NAVIGATION with Nearest  Restaurant , Petrol pump, Hotel .. etc(based on current location)
I am planning to sale this project anybody want contact me : iamvijayakumar@gmail.com
*When you are moving on the track it will come voice alert (ex: turn left after 1 km pass taj hotel).
Below screen shot of project.
 Screen 1 : Enter valid your travel location            Screen 2: loading..

















screen 3: locating your current location with that bus marker

screen 4: your s and d your travel path , bus marker is your current location , block marker is nearest petrol pump, restaurant.

screen 5 and 6: onclick block marker is's displaying what is there that position.

Estimate time and  Remaining distance of (your ramaning travel distance and estimate time)

When you are on the track it will alert voice navigation (ex: next you have turn left pass Taj hotel)
















cool  and thanks..

Thursday, March 8, 2012

Android Calculate distance between two geo location In KM

Android: calculate distance between two geo location in KM.

Below i added code for distance between two geo location in KM

Just you have to pass Start lat , lng and Destination lat ,lag value.

Screen Shot

Source Code :

    public double CalculationByDistance(GeoPoint StartP, GeoPoint EndP) {
       
        double lat1 = StartP.getLatitudeE6()/1E6;
  
        double lat2 = EndP.getLatitudeE6()/1E6;
  
        double lon1 = StartP.getLongitudeE6()/1E6;
  
        double lon2 = EndP.getLongitudeE6()/1E6;
  
        double dLat = Math.toRadians(lat2-lat1);
  
        double dLon = Math.toRadians(lon2-lon1);
  
        double a = Math.sin(dLat/2) * Math.sin(dLat/2) +
  
        Math.cos(Math.toRadians(lat1)) * Math.cos(Math.toRadians(lat2)) *
  
        Math.sin(dLon/2) * Math.sin(dLon/2);
  
        double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));

//6378.1 is gravity of earth
        return  c*6378.1;
  
     }


You can Download SOURCE CODE HERE

Check out this may be help you

Related Posts Plugin for WordPress, Blogger...