Tag Archives: id

How to crop an Image in Android?

By | December 15, 2012

This is a sample program that launches the camera and crop the captured image. Check this link to another crop image example. http://www.coderzheaven.com/2011/03/15/crop-an-image-in-android/ This is the layout xml. activity_main.xml [xml] <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margin="3dp" android:text="@string/intro" android:textStyle="bold" /> <Button android:id="@+id/capture_btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/capture" /> <ImageView android:id="@+id/picture" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="5dp" android:contentDescription="@string/picture"… Read More »

How to load a spinner with values from SQlite Database in android?

By | November 18, 2012

Here is a simple example showing how to load a database values in a spinner in android. OK we will start. This is the layout for the spinner row. spinner_row.xml [xml] <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation = "vertical" android:id="@+id/tv" android:layout_margin="10dp"> </TextView> [/xml] This is the layout for the interface. activity_main.xml [xml] <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"… Read More »

How to create a Slide from Left animation while deleting a row from a ListView in Android?

By | September 12, 2012

Hello all…… I have written a lost of posts on Listviews. You can see that by just searching Listviews in my site. Today I will show you how to create a slide out animation while we delete a row from a ListView. So this is the xml that contains the ListView. Let it be in the main.xml main.xml… Read More »

How to move a body manually in Box2D? or Give a force to a body in Box2D, iPhone.

By | April 28, 2012

This is a sample code to move a body in Box2D . First you have to make a body with variable name “moving_rec” and call the below function in a schedular at regular intervals. -(void) moveBody{ b2Vec2 force = b2Vec2(0,0); force = b2Vec2(0,3); //Giving the x an y to negative will move the body in opposite direction. moving_rec->SetLinearVelocity(force);… Read More »

Using Tabbars in ANDROID, A Simple Example……….

By | April 22, 2012

This is a simple example showing how to use tabbars in ANDROID. First create a new project and copy this code to it. [java] package com.coderzheaven; import android.app.TabActivity; import android.content.Intent; import android.os.Bundle; import android.widget.TabHost; import android.widget.TabHost.TabSpec; public class tabbar extends TabActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);… Read More »

Using of CCWaves in iPhone

By | April 20, 2012

CCWaves is one of the interesting functionalities in Cocos2D iphone. Check out this following snippet to see how it works. [java] id my_wavesAction = [CCWaves actionWithWaves:7 amplitude:25 horizontal:NO vertical:YES grid:ccg(15,10) duration:10]; [my_sprite runAction: [CCRepeatForever actionWithAction:my_wavesAction n]]; [/java] Please leave your valuable comments on this post………………….

Date and TimePicker in ANDROID.

By | April 12, 2012

The following code simply allows you to select a date and time using the datepicker and timepicker in ANDROID. [java] package AndroidDatePicker.pack; import java.util.Calendar; import android.app.Activity; import android.app.DatePickerDialog; import android.app.Dialog; import android.app.TimePickerDialog; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.DatePicker; import android.widget.TimePicker; import android.widget.Toast; public class AndroidDatePicker extends Activity { private int myYear, myMonth, myDay, myHour, myMinute; static… Read More »

Switch Images in ANDROID.

By | April 7, 2012

Hi all …….. Ofter we have trouble with loading continous images in ANDROID from our application directory. The reason is that all resources have a unique resource ID which we need to get to load these resources. The following example shows how to get these unique identifier from the “path” of the resource. For example Here I have… Read More »

How to remove duplicates from NSMutableArray ?

By | May 21, 2011

Hi, For removing or deleting duplicates from a NSMutableArray , use the following lines of code. It will simply check for duplicates elements and get it deleted or removed. [c] NSArray *tempArr= [urArray copy]; NSInteger idx = [tempArr count] – 1; for (id object in [tempArr reverseObjectEnumerator]) { if ([urArray indexOfObject:object inRange:NSMakeRange(0, index)] !=NSNotFound) { [urArray removeObjectAtIndex:idx]; }… Read More »

How to send email from and ANDROID Application programatically?

By | May 16, 2011

Hello all…….. In today’s post I will show you send mail from an android application progrmatically.. Let’s go to the code fast…… This is the code in the mail java file…. [java] package com.coderzheaven; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class sendMailDemo extends Activity { Button send;… Read More »

ANDROID Tabbars Example……..

By | May 9, 2011

This is a simple example showing how to use tabbars in ANDROID. First create a new project and copy this code to it. [java] package com.coderzheaven; import android.app.TabActivity; import android.content.Intent; import android.os.Bundle; import android.widget.TabHost; import android.widget.TabHost.TabSpec; public class tabbar extends TabActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);… Read More »

Using Tabbars in ANDROID, A Simple illustration……….

By | May 9, 2011

This is a simple example showing how to use tabbars in ANDROID. First create a new project and copy this code to it. [java] package com.coderzheaven; import android.app.TabActivity; import android.content.Intent; import android.os.Bundle; import android.widget.TabHost; import android.widget.TabHost.TabSpec; public class tabbar extends TabActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);… Read More »

Using Tabbars in ANDROID, A Simple Example……….

By | May 9, 2011

This is a simple example showing how to use tabbars in ANDROID. First create a new project and copy this code to it. [java] package com.coderzheaven; import android.app.TabActivity; import android.content.Intent; import android.os.Bundle; import android.widget.TabHost; import android.widget.TabHost.TabSpec; public class tabbar extends TabActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);… Read More »

Listening incoming sms message in Android

By | May 1, 2011

When a new sms message is received by the device, a Broadcast Receiver is registered. For this IntentFilter filter = new IntentFilter(SMS_RECEIVED); registerReceiver(receiver_SMS, filter); should be included . Also sms are sent in PDU’s(Protocol Description Units) format, which act as an encapsulation. Inorder to extract from PDU to byte array messages[i] = SmsMessage.createFromPdu((byte[]) pdus[i]); method is used. When… Read More »

Customizing your button or TextView or another view in ANDROID.

By | April 30, 2011

Beautifying our applications is one of the main features of your application’s success. In ANDROID there are many possible ways to do this. For eg. We need to have different colors for our buttons, However we can give backgrounds for buttons and all. But we can do many by using our custom xml files, like changing colors on… Read More »

jQuery Hide & Show Toggle – An Example

By | April 28, 2011

Hi, Want to try out a simple hide and show toggle using jQuery? The example given below shows how you can simply hide and show a paragraph in html using jQuery. Try it out! [html] &lt;html&gt; &lt;head&gt; &lt;script type=&quot;text/javascript&quot; src=&quot;jquery.js&quot;&gt;&lt;/script&gt; &lt;script type=&quot;text/javascript&quot;&gt; $(document).ready(function(){ $(&quot;#hideMe&quot;).click(function(){ $(&quot;p&quot;).hide(); }); $(&quot;#showMe&quot;).click(function(){ $(&quot;p&quot;).show(); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;Coderz Heaven! Click ‘HideMe’ for… Read More »

jQuery Hide & Show Toggle – An Example

By | April 28, 2011

Hi, Want to try out a simple hide and show toggle using jQuery? The example given below shows how you can simply hide and show a paragraph in html using jQuery. Try it out! [html] &lt;html&gt; &lt;head&gt; &lt;script type=&quot;text/javascript&quot; src=&quot;jquery.js&quot;&gt;&lt;/script&gt; &lt;script type=&quot;text/javascript&quot;&gt; $(document).ready(function(){ $(&quot;#hideMe&quot;).click(function(){ $(&quot;p&quot;).hide(); }); $(&quot;#showMe&quot;).click(function(){ $(&quot;p&quot;).show(); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;Coderz Heaven! Click ‘HideMe’ for… Read More »

jQuery Hide & Show Toggle – An Example

By | April 28, 2011

Hi, Want to try out a simple hide and show toggle using jQuery? The example given below shows how you can simply hide and show a paragraph in html using jQuery. Try it out! [html] &lt;html&gt; &lt;head&gt; &lt;script type=&quot;text/javascript&quot; src=&quot;jquery.js&quot;&gt;&lt;/script&gt; &lt;script type=&quot;text/javascript&quot;&gt; $(document).ready(function(){ $(&quot;#hideMe&quot;).click(function(){ $(&quot;p&quot;).hide(); }); $(&quot;#showMe&quot;).click(function(){ $(&quot;p&quot;).show(); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;Coderz Heaven! Click ‘HideMe’ for… Read More »

How to create and delete a directory in SdCard in ANDROID?

By | April 27, 2011

Hi all…… This is a simple example to create and delete a directory in ANDROID. Here the directly is created in the SDCARD. So first create an SDCARD and start the emulator with the SDCARD. Let’s look at the program. Use can use this program to create or delete a file in ANDROID also. [java] package pack.coderzheaven; import… Read More »

Showing Twitter updates on Blogger/Blogspot

By | April 24, 2011

Hi, If you want to show the latest twitter update of yours in your blogger/blogspot, then use the following steps. 1. Go to your blogger ‘Design’ 2. Click ‘Add A Gadget’ 3. Add ‘HTML/JavaScript’ 4. Paste the following JavaScript code into it and save [html] <div class="twitter-desc"> <ul id="twitter_update_list"><li></li></ul> <script src="http://twitter.com/javascripts/blogger.js" type="text/javascript"></script> <script src="http://twitter.com/statuses/user_timeline/SampleURL.json?callback=twitterCallback2&amp;count=1" type="text/javascript"></script> </div> [/html] 5.… Read More »

Android frame Animation

By | April 23, 2011

A series of frames is drawn one after the other at regular intervals. For this create a xml which contains ImageView for showing the animation [xml] <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" android:orientation="vertical" android:background="#FFFFFF" android:gravity="center_vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageView android:id="@+id/Image" android:layout_gravity="center_horizontal" android:layout_width="wrap_content" android:background="@drawable/d1" android:layout_height="wrap_content"/> <Button android:id="@+id/startFAButtonId" android:layout_width="wrap_content" android:layout_gravity="center_horizontal" android:layout_height="wrap_content" android:text="Start Animation" /> </LinearLayout> [/xml] The main java file is… Read More »

Android dialog with ListView

By | April 21, 2011

For implementing a ListView, we first create a xml which contains a ListView named list.xml [xml] <?xml version="1.0" encoding="utf-8"?> <LinearLayout   xmlns:android="http://schemas.android.com/apk/res/android"   android:layout_width="fill_parent"   android:layout_height="fill_parent">   <ListView     android:id="@+id/listview"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     /> </LinearLayout> [/xml] Next we create a Dialog Object and inflate the above xml and when the listItem is… Read More »

How to start telnet in Windows 7?

By | April 10, 2011

Hello all…… By default telnet is not enabled in Windows Vista and Windows 7. So you need to turn own the option for telnet . For this 1. Open control Panel 2. Programs and features 3. Turn Windows feature On or OFF 4. Check Telnet Client. Now open command prompt and run telnet

Make your own gesture application in ANDROID or How to use gestures in ANDROID?

By | April 5, 2011

Hi all…. In this tutorial I will teach you how to make use of Gestures in ANDROID and make your own application. Follow the below steps exactly to get an idea of how to use gestures. 1. Make a gesture Library. 2. Add your own gestures into it. 3. Export it to your applications and use it. It… Read More »