Friday, April 20, 2012

Location Manager Examples


Location Manager Examples
Here theres is a small program regarding location manager and location class 


package com.vinnysoft.ami; 


import java.util.List; 
import java.util.Locale; 


import android.app.Activity; 
import android.content.Context; 
import android.location.Address; 
import android.location.Criteria; 
import android.location.Geocoder; 
import android.location.Location; 
import android.location.LocationListener; 
import android.location.LocationManager; 
import android.os.Bundle; 
import android.widget.TextView; 


public class WhereAmI extends Activity { 
/** Called when the activity is first created. */ 
@Override 
public void onCreate(Bundle savedInstanceState) { 
super.onCreate(savedInstanceState); 
setContentView(R.layout.main); 


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


Criteria crta = new Criteria(); 
crta.setAccuracy(Criteria.ACCURACY_FINE); 
crta.setAltitudeRequired(false); 
crta.setBearingRequired(false); 
crta.setCostAllowed(true); 
crta.setPowerRequirement(Criteria.POWER_LOW); 
String provider = locationManager.getBestProvider(crta, true); 


// String provider = LocationManager.GPS_PROVIDER; 
Location location = locationManager.getLastKnownLocation(provider); 
updateWithNewLocation(location); 


locationManager.requestLocationUpdates(provider, 1000, 0, locationListener); 



private final LocationListener locationListener = new LocationListener() 



@Override 
public void onLocationChanged(Location location) { 
updateWithNewLocation(location); 



@Override 
public void onProviderDisabled(String provider) { 
updateWithNewLocation(null); 



@Override 
public void onProviderEnabled(String provider) { 



@Override 
public void onStatusChanged(String provider, int status, Bundle extras) { 



}; 
private void updateWithNewLocation(Location location) { 
String latLong; 
TextView myLocation; 
myLocation = (TextView) findViewById(R.id.myLocation); 


String addressString = "no address found"; 


if(location!=null) { 
double lat = location.getLatitude(); 
double lon = location.getLongitude(); 
latLong = "Lat:" + lat + "\nLong:" + lon; 


double lattitude = location.getLatitude(); 
double longitude = location.getLongitude(); 


Geocoder gc = new Geocoder(this,Locale.getDefault()); 
try { 
List
addresses= gc.getFromLocation(lattitude, longitude, 1); 
StringBuilder sb = new StringBuilder(); 
if(addresses.size()>0) { 
Address address = addresses.get(0); 
for(int i =0;i sb.append(address.getAddressLine(i)).append("\n"); 
sb.append(address.getLocality()).append("\n"); 
sb.append(address.getPostalCode()).append("\n"); 
sb.append(address.getCountryName()); 

addressString = sb.toString(); 

}catch (Exception e) { 

} else { 
latLong = " NO Location Found "; 

myLocation.setText("your Current Position is :\n" +latLong + "\n " + addressString ); 






add mapview in main.xml file 


give the permission sin android manifest file 

Mozilla Keyboard Shortcuts


Mozilla Keyboard Shortcuts

In this document

Using Shortcuts

This document uses the following format for listing shortcuts:
Example:
CommandWindowsMacLinux
CopyCtrl+CCmd+CCtrl+C
To perform a command, press the buttons listed together at the same time. For example, to copy in Windows, press Ctrl and C at the same time.
Tip: The plus sign (+) means that you must press two keys surrounding the plus sign at the same time. If there is more then one plus sign (such as Ctrl+Shift+C), it means that all three buttons surrounding the plus sign must be pressed at the same time.
Abbreviations:
  • Ctrl = Control key
  • Cmd = Command key on the Macintosh keyboard
Note: Some keyboard shortcuts perform different functions based on cursor location (focus). For example, if you press Home on Windows while viewing a web page, Mozilla will move to the top of the web page. However, if you press Home on Windows while the cursor is in a text field, the cursor will go to the beginning of the text field.

General Mozilla Shortcuts

These shortcuts are available from all Mozilla windows:
CommandWindowsMacLinux
CommandWindowsMacLinux
CopyCtrl+CCmd+CCtrl+C
PasteCtrl+VCmd+VCtrl+V
CutCtrl+XCmd+XCtrl+X
Close WindowCtrl+WCmd+WCtrl+W
Delete Next WordCtrl+DelCtrl+Del
Go Up One PagePage UpPage UpPage Up
Go Down One PagePage DownPage DownPage Down
Go Up One LineUp ArrowUp ArrowUp Arrow
Go Down One LineDown ArrowDown ArrowDown Arrow
UndoCtrl+ZCmd+ZCtrl+Z
RedoCtrl+Shift+ZCmd+Shift+ZCtrl+Shift+Z
FindCtrl+FCmd+FCtrl+F
Find AgainCtrl+G or F3Cmd+GCtrl+G
Find Links As You Type' (apostrophe)' (apostrophe)' (apostrophe)
Find Text As You Type///
Open search engine pageCtrl+Shift+FCmd+Shift+FCtrl+Shift+F
Open Context MenuShift+F10Ctrl+SpaceShift+F10
Open Main Menu (switches to the first drop-down menu at the top of the window. example: "File" in Windows)Alt or F10(Mac OS X: Controlled through keyboard preference in Control Panel)F10
Move to beginning of line (in a text editing field)HomeCmd+Left ArrowCtrl+A
Move to end of line (in a text editing field)EndCmd+Right ArrowCtrl+E
Exit MozillaCtrl+QCmd+QCtrl+Q
Start NavigatorCtrl+1Cmd+1Ctrl+1
Start Mail & NewsgroupsCtrl+2Cmd+2Ctrl+2
Start ComposerCtrl+4Cmd+4Ctrl+4
Start Address BookCtrl+5Cmd+5Ctrl+5
Start IRC ChatCtrl+6Cmd+6Ctrl+6

Navigator Shortcuts

These shortcuts are available from all Navigator windows.

Bookmarks Shortcuts

CommandWindowsMacLinux
Open Manage Bookmarks WindowCtrl+BCmd+BCtrl+B
Add Page to BookmarksCtrl+DCmd+DCtrl+D
File Bookmark (to customize and file a page you are bookmarking)Ctrl+Shift+DCmd+Shift+DCtrl+Shift+D
Bookmark Properties (for selected bookmark in Manage Bookmarks window)Ctrl+ICmd+ICtrl+I

Page Navigation Shortcuts

CommandWindowsMacLinux
CommandWindowsMacLinux
Open History WindowCtrl+HCmd+Shift+HCtrl+H
ReloadCtrl+RCmd+RCtrl+R
Force Reload (not from cache)Ctrl+Shift+RCmd+Shift+RCtrl+Shift+R
BackAlt+Left Arrow or BackspaceCmd+Left ArrowAlt+Left Arrow
ForwardAlt+Right ArrowCmd+Right ArrowAlt+Right Arrow
StopEscEscEsc
HomeAlt+HomeCmd+HomeAlt+Home
Go to Bottom of PageEndEnd
Go to Top of PageHomeHomeHome
Select All Text in Location BarCtrl+L or Alt+DCmd+LCtrl+L or Alt+D
Open Web Page LocationCtrl+Shift+LCmd+Shift+LCtrl+Shift+L
Open Selected Link in a Web PageEnterReturnEnter
Exit MozillaCtrl+QCmd+QCtrl+Q
Move to Next Frame (in web pages using frames)F6Ctrl+Tab or F6 (if F6 is not programmed for another command)F6
Move to Previous Frame (in web pages using frames)Shift+F6Ctrl+Shift+Tab or Shift+F6 (if F6 is not programmed for another command)Shift+F6
New Navigator WindowCtrl+NCmd+NCtrl+N
Move to Next/Previous Link or Form Element in a Web PageTab/Shift+TabTab/Shift+TabTab/Shift+Tab
Open FileCtrl+OCmd+OCtrl+O
Close WindowCtrl+WCmd+WCtrl+W
Save Page AsCtrl+SCmd+SCtrl+S
Save Linked Page (when a link is selected)Shift+EnterOption+EnterShift+Enter
Print PageCtrl+PCmd+PCtrl+P
Go Up One PagePage Up/ Shift+SpacePage Up/ Shift+SpacePage Up/ Shift+Space
Go Down One PagePage Down/SpacePage Down/SpacePage Down/Space
Go Up One LineUp ArrowUp ArrowUp Arrow
Go Down One LineDown ArrowDown ArrowDown Arrow
Turn on/off Caret ModeF7F7 (if F7 is not programmed for another command)F7

Page Viewing Shortcuts

CommandWindowsMacLinux
Full Screen (toggle)F11F11 (may depend on window manager)
Zoom Text SmallerCtrl+- (minus sign)Cmd+- (minus sign)Ctrl+- (minus sign)
Zoom Text LargerCtrl+= (plus sign)Cmd+= (plus sign)Ctrl+= (plus sign)
No Zoom (back to normal/100%)Ctrl+0Cmd+0Ctrl+0
View Page InformationCtrl+ICmd+ICtrl+I
View Page SourceCtrl+UCmd+UCtrl+U

Tabbed Browsing Shortcuts

CommandWindowsMacLinux
New Navigator TabCtrl+TCmd+TCtrl+T
Switch to Next Tab (when using Tabbed Browsing with more then one tab)Ctrl+Tab or Ctrl+Page DownCtrl+Page DownCtrl+Tab or Ctrl+Page Down
Switch to Previous Tab (when using Tabbed Browsing with more then one tab)Ctrl+Shift+Tab or Ctrl+Page UpCtrl+Page UpCtrl+Page Up
Close Tab (Close window if one page open)Ctrl+WCmd+WCtrl+W
Open link in new foreground tabInsertInsert
Open link in new background tabShift+InsertShift+InsertShift+Insert

Sidebar Shortcuts

CommandWindowsMacLinux
Open/Close Sidebar (toggle)F9F9F9
Switch to Next Sidebar PanelAlt+Page DownOption+Page DownAlt+Page Down
Switch to Previous Sidebar PanelAlt+Page UpOption+Page UpAlt+Page Up

Forms Shortcuts

CommandWindowsMacLinux
Move to Next/Previous Item in FormTab/Shift+TabTab/Shift+TabTab/Shift+Tab
Submit FormEnterEnterEnter
Press Selected Button / Select Radio Button)SpaceSpaceSpace
Select an Item from a ListUp Arrow, Down Arrow, or First Letter of Item NameUp Arrow, Down Arrow, or First Letter of Item NameUp Arrow, Down Arrow, or First Letter of Item Name
Check/Uncheck Checkbox (toggle)SpaceSpaceSpace
Open a Drop-Down MenuAlt+Down ArrowOption+Down ArrowAlt+Down Arrow

Mail & Newsgroups Shortcuts

These shortcuts are available from Mail & Newsgroups windows.

General Mail & Newsgroups Shortcuts

CommandWindowsMacLinux
Move to Next Mail Pane (Folder, QuickSearch, Thread, Message Panes)F6F6F6
New MessageCtrl+MCmd+Shift+MCtrl+M

Message List Shortcuts

CommandWindowsMacLinux
CommandWindowsMacLinux
Save Message as FileCtrl+SCmd+SCtrl+S
Open Message (in a new window)Ctrl+OCmd+OCtrl+O
Delete MessageDelDelDel
Undo Delete MessageCtrl+ZCmd+ZCtrl+Z
Select All MessagesCtrl+ACmd+ACtrl+A
Collapse All Threads\ (backslash key)\ (backslash key)\ (backslash key)
Expand All Threads* (asterisk key)* (asterisk key)* (asterisk key)
Message SourceCtrl+UCmd+UCtrl+U
Go to Next MessageFFF
Go to Next Unread MessageNNN
Go to Next Unread ThreadTTT
Go to Previous MessageBBB
Go to Previous Unread MessagePPP
Reply to Message (replies only to sender)Ctrl+RCmd+RCtrl+R
Reply to All in Message (replies to sender and to other email addresses in message)Ctrl+Shift+RCmd+Shift+RCtrl+Shift+R
Forward MessageCtrl+LCmd+LCtrl+L
Edit as New (compose new email using the body and attachments of the selected message)Ctrl+ECmd+ECtrl+E
Mark Message as ReadMMM
Mark Thread as ReadRRR
Mark All Messages in Selected Folder as ReadCtrl+Shift+CCmd+Shift+CCtrl+Shift+C

Message Compose Shortcuts

CommandWindowsMacLinux
Send Message NowCtrl+EnterCmd+EnterCtrl+Enter
Send Message LaterCtrl+Shift+EnterCmd+Shift+EnterCtrl+Shift+Enter

Composer Shortcuts

These shortcuts are available from Composer windows.
CommandWindowsMacLinux
CommandWindowsMacLinux
Save PageCtrl+SCmd+SCtrl+S
Open FileCtrl+OCmd+OCtrl+O
Close PageCtrl+WCmd+WCtrl+W
Find in PageCtrl+FCmd+FCtrl+F
Find AgainCtrl+GCmd+GCtrl+G
Insert/Edit LinkCtrl+LCmd+LCtrl+L
Increase IndentCtrl+[Cmd+[Ctrl+[
Decrease IndentCtrl+]Cmd+]Ctrl+]
Discontinue Text StylesCtrl+Shift+TCmd+Shift+TCtrl+Shift+T
Discontinue LinkCtrl+Shift+KCmd+Shift+KCtrl+Shift+K
Select Row/ColumnCtrl+DragCmd+DragCtrl+Drag
Select Cells(s)Ctrl+Click (drag to select block of cells, or continue clicking to select individual cells)Cmd+Click (drag to select block of cells, or continue clicking to select individual cells)Ctrl+Click (drag to select block of cells, or continue clicking to select individual cells)
Decrease Font SizeCtrl+- (minus sign)Cmd+- (minus sign)Ctrl+- (minus sign)
Increase Font SizeCtrl+= (equal sign)Cmd+= (equal sign)Ctrl+= (equal sign)
Text Style BoldCtrl+BCmd+BCtrl+B
Text Style ItalicCtrl+ICmd+ICtrl+I
Text Style UnderlineCtrl+UCmd+UCtrl+U
Text Style Fixed WidthCtrl+TCmd+TCtrl+T

Help Window Shortcuts

These shortcuts are available from Help windows.
CommandWindowsMacLinux
Open Help and Support Center within Navigator, Mail & Newsgroups, Composer, and Address BookF1Help KeyF1
Navigate Links within Content Pane (right pane)TabTabTab
Switch between Content Pane and Search/Contents/Index/Glossary (toggle)F6F6F6
Navigate Index Terms (while Index Pane is selected)Up/Down ArrowUp/Down ArrowUp/Down Arrow
Scroll Pane (Content, Table of Contents, or Index)Up/Down ArrowUp/Down ArrowUp/Down Arrow
Expand/Collapse Table of Contents Tree StructureLeft/Right ArrowLeft/Right ArrowLeft/Right Arrow
Print PageCtrl+PCmd+PCtrl+P
Go Back to Previous PageAlt+Left Arrow KeyAlt+Left Arrow KeyAlt+Left Arrow Key
Go Forward One PageAlt+Right Arrow KeyAlt+Right Arrow KeyAlt+Right Arrow Key