Skip to main content

Posts

Showing posts from August, 2012

Camara Application in Android(Use Hardware Camara)

hi .... write Following code in your project first create camaratest android project....... this example for take image and view in below image view check it........ and enjoy 1) CamaratestActivity.java   package com.in.test; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.hardware.Camera; import android.hardware.Camera.PictureCallback; import android.hardware.Camera.ShutterCallback; import android.os.Bundle; import android.os.Handler; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageView; /*  * O@K tech...  */ public class CamaratestActivity extends Activity implements SurfaceHolder.Callback ,OnClickListener { Camera camera; SurfaceView surfaceview;     SurfaceHolder mHolder ;     Button btnSnap;     ImageView mPic; /** Called when the activi

Media Player Programming in Android

Hi Friends. This is Small Media Player (Start and Stop) Application 1) First Create Android Project.(mediap) 2) Create raw  Folder in res Folder      now copy paste one .mp3 file in raw folder show in above image res/raw/a.mp3 3) Now Edit main.xml  see in Bellow main.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:text="@string/hello" />     <LinearLayout         android:layout_width="fill_parent"        android:layout_height="fill_parent"         android:orientation="horizontal">         <Button             android:

How to add a menu in a programmatic manner in Android

Hello Friends. Follow Below Step for Create Programmatic Menu in Android. Here Use  onCreateOptionsMenu(Menu menu) Override method. 1) First Create Simple Android Project (menudemo) 2) Now edit string.xml(Path:- res/values/string.xml)   <?xml version="1.0" encoding="utf-8"?> <resources>  <string name="hello">Hello World, MenudemoActivity!</string>     <string name="app_name">Menudemo</string>     <string name="HomeOption">Home</string> <string name="Oak">a@k</string> </resources> Here above Code for Manualy create String Home and a@k. 3) Edit  MenudemoActivity.java (this is Android Activity)  import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; public class MenudemoActivity extends Activity {     /** Called when the activity is first create

Create Simple Widget in Android

Hi . Here we Discuss about how to create Simple Widget in android... Here use AppWidgetProvider class .   First Create Simple android project name is widget. 1) res/layout/main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="fill_parent" android:orientation="vertical"     android:layout_gravity="center"     android:background="@android:color/holo_orange_light"     android:layout_height="wrap_content">     <Button         android:id="@+id/button1"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="welcome" />     <TextView android:id="@+id/widget_textview"     android:layout_height="wrap_content"     android:layout_width="wrap_content"     and

WebApp in Android

First Create Simple Android Project(webapp).   We need WebView in xml for Develop WebApp in Android . So Following Step are Create simple   WebApp in android. 1) res/layout/main.xml   paste following code in main.xml <?xml version="1.0" encoding="utf-8"?> <WebView  xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@+id/webview"     android:layout_width="fill_parent"     android:layout_height="fill_parent" /> 2)webapp.java following Activity is open google.com page in webview. import android.app.Activity; import android.os.Bundle; import android.webkit.WebView; import org.apache.cordova.*; public class webapp extends Activity { @Override public void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.main); WebView wb = (WebView)findViewById(R.id.webview); wb.loadUrl(

Android HelloWorld Example

After install android Create New Android Helloworld Application. 1)  HelloWorld.java package co.in.helloworld; import android.app.Activity; import android.os.Bundle; import android.util.Log; public class HelloWorld  extends Activity {     /** Called when the activity is first created. */     @Override     public void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.main);         System.out.println("Hello World......");             } } 2) res/layout/main.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 Activity

An activity is a single, focused thing that the user can do. Almost all activities interact with the user, so the Activity class takes care of creating a window for you in which you can place your UI with  setContentView(View) . While activities are often presented to the user as full-screen windows, they can also be used in other ways: as floating windows (via a theme with  windowIsFloating  set) or embedded inside of another activity (using  ActivityGroup ). There are two methods almost all subclasses of Activity will implement: onCreate(Bundle)  is where you initialize your activity. Most importantly, here you will usually call  setContentView(int)  with a layout resource defining your UI, and using  findViewById(int)  to retrieve the widgets in that UI that you need to interact with programmatically. onPause()  is where you deal with the user leaving your activity. Most importantly, any changes made by the user should at this point be committed (usually to the  ContentProvider  h