Posts

Animation Tutorial

Image
Animation Image Used in Android Tutorial GIF Image used in Android Application. for that you need to use following code implementation in your android project.


That is the UI of this tutorial demo for Android.


public AnimationView(Context context,AttributeSet attrs) { super(context,attrs); setFocusable(true); java.io.InputStream is; is = context.getResources().openRawResource(R.drawable.th_welcome); if (DECODE_STREAM) { mMovie = Movie.decodeStream(is); } else { byte[] array = streamToBytes(is); mMovie = Movie.decodeByteArray(array, 0, array.length); } }
Other things to draw Canvas can be used the following code.

@Override public void onDraw(Canvas canvas) { long now = android.os.SystemClock.uptimeMillis(); if (mMovieStart == 0) { // first time mMovieStart = now; } if (mMovie != null) { int dur = mMovie.duration(); if (dur == 0) { dur = 3000; } …

Custom Gallery View

Image
Custom View for Gallery Demo in Android.Declare following variables.private ImageView selectedImageView; private ImageView leftArrowImageView; private ImageView rightArrowImageView; private Gallery gallery; private int selectedImagePosition = 0; private List<Drawable> drawables; private GalleryImageAdapter galImageAdapter;
Screen-Snap  private void setupUI() { selectedImageView = (ImageView) findViewById(R.id.selected_imageview); leftArrowImageView = (ImageView) findViewById(R.id.left_arrow_imageview); rightArrowImageView = (ImageView) findViewById(R.id.right_arrow_imageview); gallery = (Gallery) findViewById(R.id.gallery); leftArrowImageView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (selectedImagePosition > 0) { --selectedImagePosition; } gallery.setSelection(selectedImagePosition, false); } }); rightArrowImageView.setOnClickListener(new OnClickListener() { @Override public void…

Swap3D

Image
Swap Views in 3D.
3D flip makes a nice effect. It seems like there is no good android implementation on the internet that shows how to make two generic view flip with each other.




Like this you flip your views as per your requirements.

Rotation.java ===================================== package com.sandy.swap3d; import android.view.animation.Animation; import android.view.animation.Transformation; import android.graphics.Camera; import android.graphics.Matrix; public class Rotation extends Animation { private final float mFromDegrees; private final float mToDegrees; private final float mCenterX; private final float mCenterY; private final float mDepthZ; private final boolean mReverse; private Camera mCamera; public Rotation(float fromDegrees, float toDegrees, float centerX, float centerY, float depthZ, boolean reverse) { mFromDegrees = fromDegrees; mToDegrees = toDegrees; mCenterX = centerX; mCenterY = ce…

Time and Date Piker

Image
Time and Date piker both are in single dialog.
Android provides controls for the user to pick a time or pick a date as ready-to-use dialogs. Each picker provides controls for selecting each part of the time (hour, minute, AM/PM) or date (month, day, year). Using these pickers helps ensure that your users can pick a time or date that is valid, formatted correctly, and adjusted to the user's locale.



We recommend that you use Dialog Fragment to host each time or date picker. The Dialog Fragment manages the dialog life-cycle for you and allows you to display the pickers in different layout configurations, such as in a basic dialog on handsets or as an embedded part of the layout on large screens.



Note: The code samples below show how to create dialogs for a time picker and date picker using the support Library APIs for Dialog Fragment. If your app's minsdkVersion is 11 or higher, you can instead use the platform version of Dialog Fragment.

Time Piker
Define the onCreateDialog() me…

StartAppDemo

Image
StartApp Advertisement tutoril for android applications.
Simple Demo that show how the StartApp SDK works.We have found a new way to generate some money from this free app. using this new search tool, we can keep creating apps and give them to you completely free forever!   This search is from our search partner and give you access to great web search via a search icon, bookmark link and homepage. You may remove them at your choice.


Have you found a strange search icon on your home screen?
 Have you found a strange browser search home page?
 Have you found a strange bookmark links?

 Don't worry, it's nothing dangerous. This application tells you what is StartApp and how it works.





you use following code for that class.



.JAVA code ================================================================
private HtmlAd htmlAd = null;
    Button btn;

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

Capture On Surface Pro

Image
Surface cameras Surface has not just one, but two integrated LifeCam cameras. You can use the front camera to have a video chat with a friend, or the rear-facing camera to record meetings and events hands-free. You can also use either camera to take photos.







A privacy light appears on Surface when either camera is active, so there are no surprises. Both cameras are fixed focus, so you don’t need to worry about focusing. The cameras capture video in 720p HD, with a 16:9 aspect ratio.
Both cameras take photos and record videos. The rear camera is angled to point straight ahead when Surface is resting on its kickstand or when you hold your Surface at a viewing angle that’s comfortable for your wrists.






The front camera points up at your face for optimal video calling.



Surface cameras FAQHere are answers to some common questions about using the two Surface cameras and the built-in Camera app.
How do I get started using the cameras?Why can I take photos but not videos (or the reve…

Horizontal ListView Tutorial

This is a ListView but it is Horizontal scrolling preferred. It containing image,button,and textView.
Get Reference from DEV-SMART, Origional post http://www.dev-smart.com/archives/34 here.

HorizontalListView.java

package com.sandy.demo;

import java.util.LinkedList;
import java.util.Queue;

import android.content.Context;
import android.database.DataSetObserver;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.GestureDetector.OnGestureListener;
import android.view.MotionEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListAdapter;
import android.widget.Scroller;

public class HorizontalListView extends AdapterView<ListAdapter> {

    public boolean mAlwaysOverrideTouch = true;
    protected ListAdapter mAdapter;
    private int mLeftViewIndex = -1;
    private int mRightViewIndex = 0;
    protected int mCurrentX;
    protected int mNextX;
    private int mMaxX = Integer.MAX_VALUE;
    private in…