background preloader

Android

Facebook Twitter

Android Development - Bounce Animation | Musings of the Bare Bones Coder. In this brief post I’ll go over how to implement a bare bones bounce animation on some hard-coded text in an Android app. To achieve this effect, we will be using both a translate animation class and a bounce interpolator class, both provided by the Android SDK. [Edit:] Some readers wanted to see what this effect looked like, and I was thinking the same thing when I first published this.

So below is a sample of what the effect looks. The Setup To demonstrate a simple bounce animation, we will capture any touch events and “bounce” some hard-coded text to the touched location with a horizontal offset of 100. To start out, we’ll create our own View to work with, called BounceView. First we create a new Android application, and then add a new class file. The touch event is where we will capture the location where we will insert our bounce animation. Capturing Touch Events In the touch event, we will save off the touched coordinates for use in the draw event. Drawing It The Final Result Next Steps. Android Development Tutorial. Using a Slide Transition with the Android ViewFlipper « Kevin Rohling's Blog. Github Repo If your app only has one View, your app is probably pretty boring. However, if you’re building an interesting app you’ll probably have to switch between multiple Views, maybe go back and forth and have some nice animations.

You could write your animations and manually do the transitioning yourself but once you get more than 2 or so Views that’s gonna get tough to keep up with (and messy!). Fortunately the ViewFlipper solves this problem quite nicely. Step 1. Let’s start all the way at the beginning, File -> New Android Project. Step 2. Once you get your project set up you’ll need to add a ViewFlipper to main.xml. Main.xml 1<? Step 3. Next in MainActivity ‘s onCreate method, wire up ClickHandlers to the Buttons and use the ViewFlipper’s showNext() and showPrevious() methods to move between Views.

MainActivity Step 4. Now, if all you wanted was a simple transition between Views you could stop now. View_transition_in_left.xml 1<? View_transition_in_right.xml 1<? View_transition_out_left.xml. How to see if wifi is connected in android. How to use HttpURLConnection POST data to web server? HttpComponents HttpClient Examples. HttpClient Tutorial. How do I obtain crash-data from my Android application. Android pinch zoom. View - Android Development: How Can I Make An EditText Plain So It's Just A White Square.

Android - How to create EditText with rounded corners. How to use Multi-touch in Android 2: Part 6, Implementing the Pinch Zoom Gesture. Welcome to the last installment in the Android multi-touch series! The purpose of this series is to show you how to develop multi-touch programs for Android-based phones, tablets, and other devices. It was excerpted with permission from Hello, Android! (3rd edition), published by the Pragmatic Bookshelf. Over the course of this series we've been working on a simple image viewer that lets you move and zoom a picture on the screen with touch gestures. This part wraps up the example with the code that implements multi-touch pinch zooming. All source code can be downloaded from the book web site. Implementing the Pinch Zoom Gesture The pinch zoom gesture is similar to the drag gesture, except it starts when the second finger is pressed to the screen (ACTION_POINTER_DOWN).

From Touchv1/src/org/example/touch/Touch.java: When we get the down event for the second finger, we calculate and remember the distance between the two fingers. Now let’s define the spacing( ) and midPoint( ) methods. Installing HTC Incredible Android SDK Drivers | In order to debug on your new HTC Incredible smartphone on Windows 7, you need to install USB drivers from Google. Well, it turns out that the phone is too new for Google to have included support for the Incredible in their driver package. Here is how I got it all working though. It may or may not work for you. 1.) Install the Android SDK and download the USB drivers into a folder inside your SDK as Google tells you to do. 2.) Find the section labeled [Google.NTx86] . ; ;HTC Incredible %SingleAdbInterface% = USB_Install, USB\VID_0BB4&PID_0C9E %CompositeAdbInterface% = USB_Install, USB\VID_0BB4&PID_0C9E&MI_01 Find the section [Google.NTamd64]. On your Incredible, go to Settings->Applications->Development and turn on USB debugging.

On your PC, Go to Start->Right-Click My Computer->Manage You should see a device with a warning on it called Other->ADB. After that, I went to the cmd prompt and typed 77 Responses Leave a Comment. Encode - QR codes image generator in java (open source but no GPL) ScanningViaIntent - zxing - Simple scanning on Android, by calling Barcode Scanner via Intent - Multi-format 1D/2D barcode image processing library with clients for Android, Java. Zxing - Multi-format 1D/2D barcode image processing library with clients for Android, Java.

Android to iPhone. Android is an Open Source platform for mobile devices. Initiated by Google, Android has received much attention. Android applications are developed using Java, although a special compiler converts class files to a proprietary, register-based virtual machine that is used on Android devices to execute applications. Android defines its own API for writing mobile applications. With the help of XMLVM it is possible to cross-compile Java-based Android applications to native iPhone applications. The Android application is written in Java and makes use of an Android specific API.

The code below shows an excerpt from the Android Compatibility Library. Package android.widget; public class Button extends View { protected UIButton button; public void setOnClickListener(OnClickListener listener) { final OnClickListener theListener = listener; button.addTarget(new UIControlDelegate() { @Override public void raiseEvent() { theListener.onClick(Button.this); } }, UIControl.UIControlEventTouchUpInside); } } Gesture - How to make an Android view that flips between views on swipe/fling. Horizontal View Swiping with ViewPager. Posted by Rich “geekyouup” Hyndman, inspired by the fact that life just got that little bit easier Updated Dec 12 2012 It has been over a year since the ViewPager launched and in that time it’s been used by many developers to improve the user experience of their applications.

Over the year the APIs have been updated, adding some new features and deprecating some old method signatures. Five methods in PagerAdapter have been deprecated in order to switch from using View in the method signature to using ViewGroup. This makes it more obvious what the parameter refers to, improves the readability of the code and removes the need to constantly cast the Views to ViewGroups. Some official ViewPager resources have also been added: A few ViewPager hints that are worth mentioning as they keep recurring are: Here’s to the next year of paging views. ViewPager was released as part of the Compatibility Package revision 3 and works with Android 1.6 upwards. Android Tutorial: Creating and Using an SD Card in the Emulator - Streamhead. In a previous post, I mentioned how user-friendly Android is for developers.

There’s extensive documentation and information on the architecture, the different components and best practices. However, the documentation has a few blind spots. Many of the tools have little documentation and no usage examples. The information is there, it’s just hidden behind a few layers of Android theory. So I’m going to try and document a few of the basic things that you’ll probably need to know to start developing Android applications.

Only for beginners and intermediate Android developers. The first issue I ran into was trying to load files into the Android emulator. First, you will need to create an SD card image file. Mksdcard -l mysdcard 128M sdcard.img If you want to access the image, the emulator must be running with the image loaded. Next start the emulator and verify that the SD card is loaded. If the DDMS isn’t in the list, click “Other…” and choose it from there. Adb push myfile.mp3 /sdcard/ NumberPicker. DateSlider 1.2 an alternative DatePicker for Android | Codeus Blog. Wheel UI contol. Have you ever seen the iPhone date time picker? Next is the corresponding Android control Poor design... But, fortunately, there is an ability to create own UI controls. So I decided to implement this one. Actually, this time picker is a sample activity that uses my control called NumericWheel.

Activity code: public class TimeActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.time_layout); NumericWheel hours = (NumericWheel) findViewById(R.id.hour); hours.setMaxValue(23); hours.setCaption("hour"); NumericWheel mins = (NumericWheel) findViewById(R.id.mins); mins.setMaxValue(59); mins.setCaption("mins"); Calendar c = Calendar.getInstance(); mins.setValue(c.get(Calendar.MINUTE)); hours.setValue(c.get(Calendar.HOUR_OF_DAY)); } } It is possible also to use the wheel control, for example, to enter PIN code or something like that: Here are used four wheel controls. Android-wheel - Android Picker widget.

Recipe iPhone-like wheel picker for selection (Recipe 883, Revision 3647)