Posts

Showing posts from May, 2013

Custom Dialog Tutorial

Image
Create custom dialog view in android tutorial.
MainActivity.java

package com.customdialognew;

import android.app.Activity;
import android.app.Dialog;
import android.os.Bundle;
import android.view.Menu;
import android.view.Window;
import android.widget.TextView;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);



        Dialog alert = new Dialog(this);
        alert.requestWindowFeature(Window.FEATURE_NO_TITLE);
        alert.setContentView(R.layout.title);
        TextView msg = (TextView)alert.findViewById(R.id.textView1);
        msg.setText("Hello Friends.\nIP address : 111.111.1.111");
        alert.show();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

}


activ…

Android Video Capture Tutorial

Image
Tutorial for Capture video in android device.

AndroidVideoCapture.java

package com.exercise.AndroidVideoCapture;

import java.io.IOException;

import android.app.Activity;
import android.content.Context;
import android.hardware.Camera;
import android.media.CamcorderProfile;
import android.media.MediaRecorder;
import android.os.Bundle;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.Toast;

public class AndroidVideoCapture extends Activity{

    private Camera myCamera;
    private MyCameraSurfaceView myCameraSurfaceView;
    private MediaRecorder mediaRecorder;

    Button myButton;
    SurfaceHolder surfaceHolder;
    boolean recording;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        recording = false;

        setContentView(R.layout.main);

        //Get Camera f…

Analog Clock Widget Tutorial

Image
create custom analog clock widget in this tutorial.
Widget.java

package sandy.Tutorials.Widgets.AnalogClock;

import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.widget.RemoteViews;

public class Widget extends AppWidgetProvider
{   
    public void onReceive(Context context, Intent intent)
    {
        String action = intent.getAction();
        if (AppWidgetManager.ACTION_APPWIDGET_UPDATE.equals(action))
        {

            RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget);

            Intent AlarmClockIntent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER).setComponent(new ComponentName("com.android.alarmclock", "com.android.alarmclock.AlarmClock"));
            PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, AlarmClockIntent, …

Animated Text Tutorial

Image
Text animation tutorial. text animation in round shape if you need to change shape little-bit changes required.
MainActivity.java
package com.example.animae.text;

import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Path.Direction;
import android.os.Bundle;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.RotateAnimation;

public class MainActivity extends Activity {

 int colorAlpha=getTitleColor();;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(new GraphicsView(this));
    }
    private static class GraphicsView extends View {
        private static final String AnimatedTxt =
            "devloped by Sandip Chaniyara (Sandy)";

        private Animat…

Android SQLite Tutorial

Example of SQLite Database for android.
AndroidSQLiteTutorialActivity.java
package com.androidhive.androidsqlite; import java.util.List; import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
public class AndroidSQLiteTutorialActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        DatabaseHandler db = new DatabaseHandler(this);

        /**
         * CRUD Operations
         * */
        // Inserting Contacts
        Log.d("Insert: ", "Inserting ..");
        db.addContact(new Contact("Sandy", "9100000000"));
        db.addContact(new Contact("Darshak", "9199999999"));
        db.addContact(new Contact("Keyur", "9522222222"));
        db.addContact(new Contact("Raj", "9533333333"));

        // Reading a…

Strobe Light Demo

This demo example used to Camera Flash light effect(StrobeLight).
StrobeLightConfig.java

package com.stwalkerster.android.apps.strobelight;

import android.app.Activity;
import android.content.Intent;
import android.hardware.Camera;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.ImageButton;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;

public class StrobeLightConfig extends Activity {

    boolean check = false;

    Camera sandy;
    StrobeRunner runner;
    Thread bw;
    ImageButton btnClick;

    public final Handler mHandler = new Handler();

    public final Runnable mShowToastRunnable = new Runnable() {
        public void run() {

        }
    };

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

        btnClick = (ImageButton) findViewById(R.id.btnSwitch);


       …