Tag Archives: String
Android listView with icons
In this post, we will have a list whose rows are made up of image, Here we just supply data to the adapter and helping the adapter to create a View objects for each row The output will be For this first create a xml file to hold the listview The next objective is to… Read More »
How to read a folder in the assets directory and read files from it in android?
File reading is important in android. For the put the files in the assets folder. We can able to read foldername filename Contents of the file First we read the name of the folder. “folder_array” contains all the names of the folder Then if the path is set to Then the list of file name… Read More »
Using ButtonBar in Adobe AIR/FLEX, A simple Example
Hello………. A button Bar is a convenient way to place your buttons in an application. It saves a lots of space in your application interface. Take a look at the following example which shows how to use the ButtonBar. An itemClickEvent is attached to each button in the ButtonBar. You can place as many buttons… Read More »
Creating Exceptions in JAVA
This is a simple custom exception in java. That is, we can create an exception by extending the exception class. The “throw new MyExcep” will throw an exception and the error message we specified will be displayed import java.lang.Exception; @SuppressWarnings(“serial”) class MyExcep extends Exception { MyExcep(String Errormsg) { super(Errormsg); // call Exception class error message… Read More »
String Functions in C
Let’s now briefly discuss about four essential String function used in C. We are going to discuss about a) strlen() b) strcpy() c) strcat() d) strcmp() Codes speak louder than words! Let’s see what these functions do in a simple C Program. #include main() { char stringOne[15] = “CoderzHeaven”; char stringTwo[] =”Codes”; char stringThree[15]; int… Read More »
Abstract Class in java
This example shows how a simple java abstract class works Here “Shape” is the abstract class abstract class Shape { abstract void initial(); // methods only defined….. abstract void display(); } class cube extends Shape { void initial() // Abstract Methods defined…. { System.out.println(“Hello !! “); } void display() { System.out.println(“How are you?”); } }… Read More »
Java Exception
Simple java program to show how exception works public class exception { public static void main(String[] args) { try { int a = 10; int b = 10/0; } catch(ArithmeticException e) { System.out.println(“Exception Caught ” + e); } } } The output will be like you expect Exception Caught java.lang.ArithmeticException: / by zero
Working with SQLite Database in ANDROID.
Below is a straight forward example of how to deal with SQLite database in ANDROID. Go ahead and copy and paste the following code to your java file. The example has one database and performs functions like insert delete and listing of values in a textView. In the XML file set up a TableLayout with… Read More »
Dynamically Load images in ANDROID? OR Load image in ANDROID using a string path.
With the following code you can load images in your drawable folder dynamically by giving the filename as a String. For that you have to use getResources().getIdentifier which has parameters as the “path”,”drawable” and the “package name”. This returns a unique resource ID which can be used to set the image for a ImageView using… Read More »
Play all songs from your raw directory in ANDROID continuously.
In ANDROID all resource has a unique resource ID which we get by passing the song name to the function below playSong(). The function getAllResourceIDs() will convert this String which is the name of the song to the unique resource ID which can then be used to play the song. setOnCompletionListener() will be executed when… Read More »
Trim() function in ActionScript(Adobe AIR , FLEX etc)…
The function for trim in ActionScript is defined inside StringUtil Class. Checkout the following function. public function stringTrim(result:String):String{ result = StringUtil.trim(result); trace(result); return result; } Please post your valuable comments if the post was useful. The function for trim in ActionScript is defined inside StringUtil Class. Checkout the following function. public function stringTrim(result:String):String{ result =… Read More »
Access a remote database from Adobe AIR or FLEX.
Access a remote database from Adobe AIR or FLEX. Many often you need to access online database from your application. For doing it in Adobe AIR of FLEX you need HttpService. The following example shows how to access an online database from an AIR Application. Note that you cannot return an array from a remote… Read More »
The RatingBar in ANDROID
Simply copy and paste the following code to see how to use the RatingBar in ANDROID.
Pass a variable from one window to another in Adobe AIR?
We often need to access another window variable in the current window. The following example shows how to access a variable from one window in the next window. The logic is to create an object of next window in the current window and assign the value of variable in the current window itself so that… Read More »
How to get the ANDROID SDK Version? How to get your Phone's IP Address in ANDROID? Also how to get your phone number from the phone?
Please checkout the “LogCat” for the output. If you don’t know about Logcat In Eclipse “Go to Window->showView and search for Logcat”.
How to get the ANDROID SDK Version? How to get your Phone’s IP Address in ANDROID? Also how to get your phone number from the phone?
Please checkout the “LogCat” for the output. If you don’t know about Logcat In Eclipse “Go to Window->showView and search for Logcat”.
How to get the ANDROID SDK Version? How to get your Phone’s IP Address in ANDROID? Also how to get your phone number from the phone?
Please checkout the “LogCat” for the output. If you don’t know about Logcat In Eclipse “Go to Window->showView and search for Logcat”.
How to use Webview in ANDROID together with javascript?
The following java code helps you to show a webpage in ANDROID and enable javascript.
How to access a remote php file from ANDROID?
For working on the localhost use 10.0.2.2 and for remote use the IP or domain name of the server. The following code does this.
Detect when the ANDROID Screen Goes Off ?
This is the main Java file that extends activity. Create a file named ScreenON_OFF_ACTIVITY.java and place the below code in it. This is the class that extends the Broadcast receiver class that receives the notifications. create a java file and name it ScreenReceiver.java and place the following code in it. This the class that updates… Read More »
Get my Telephone number in ANDROID
Gets the phone number the app is running on. It needs a permission so add the line uses-permission android:name=”android.permission.READ_PHONE_STATE” to the manifest.xml