BlueChess : Two Player Chess Game in J2ME, My minor project @ IOE
Here is the download link for BlueChess : Two Player Chess Game
http://www.4shared.com/file/JWiI8Cce/BlueChess_Bluetooth_two_player.html
http://www.4shared.com/file/JWiI8Cce/BlueChess_Bluetooth_two_player.html
XML parsing using SaxParser with complete code
SAX parser use callback function (org.xml.sax.helpers.DefaultHandler) to informs clients of the XML document structure. You should extend DefaultHandler and override few methods to achieve xml parsing.
The methods to override are
The following example demonstrates the uses of DefaultHandler to parse and XML document. It performs mapping of xml to model class and generate list of objects.
The methods to override are
- startDocument() and endDocument() – Method called at the start and end of an XML document.
- startElement() and endElement() – Method called at the start and end of a document element.
- characters() – Method called with the text contents in between the start and end tags of an XML document element.
The following example demonstrates the uses of DefaultHandler to parse and XML document. It performs mapping of xml to model class and generate list of objects.
Android hide soft keyboard code
Working code for hiding the soft keyboard in Android :
This can be used to suppress the keyboard until the user actually touched the edittext view.
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
This can be used to suppress the keyboard until the user actually touched the edittext view.
Java-Open/Launching any file with its default handler with start utility in windows
Java-Open/Launching any file with its default handler with start utility in windows
String cmd = "cmd.exe /c start ";
String file = "c:\\version.txt";
Runtime.getRuntime().exec(cmd + file);
Android Code: Latitude and Longitude of the mobiledevice
We should use the
LocationManager
.LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
double longitude = location.getLongitude();
double latitude = location.getLatitude();
The call to
getLastKnownLocation()
doesn't block - which means it will return null
if no position is currently available - so you probably want to have a look at passing a LocationListener
to therequestLocationUpdates()
method instead, which will give you asynchronous updates of your location.private final LocationListener locationListener = new LocationListener() {
public void onLocationChanged(Location location) {
longitude = location.getLongitude();
latitude = location.getLatitude();
}
}
lm.requestLocationUpdates(LocationManager.GPS, 2000, 10, locationListener);
Required Permission :
You'll need to give your application the
ACCESS_FINE_LOCATION
permission if you want to use GPS.<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
You may also want to add the
ACCESS_COARSE_LOCATION
permission for when GPS isn't available and select your location provider with the getBestProvider()
method.My first Android project in Eclipse: Multiplication Table Generator App using TextWatcher and OnClickListener
After removing the configuration errors that came during running the auto generated Hello World project, I decided to write a Multiplication Table Generator App on Android platform. This is my first android app other than HelloWorld. In this article, I am going to explain how I created the App. It describes the use of TextWatcher and OnClickListener interfaces for event handling.
Multiplication Table Generator contains the EditText-ipNumberTxt component for reading user input – a number. It contains two Buttons '+' and '–' to increment/decrement the number in EditText. The generated output is displayed in TextView-outputTXT. The multiplication table is generated on afterTextChanged event of EditText field.
Multiplication Table Generator contains the EditText-ipNumberTxt component for reading user input – a number. It contains two Buttons '+' and '–' to increment/decrement the number in EditText. The generated output is displayed in TextView-outputTXT. The multiplication table is generated on afterTextChanged event of EditText field.
The download link for complete project
is given at end of article.
Subscribe to:
Posts
(
Atom
)