Wednesday, May 30, 2012

How to play embed you tube video in web view

How to play embed you tube video in web view  

Note: this is applicable in HTML-5 browser supported devices only 

myWebView = (WebView) findViewById( R.id.webview_compontent );

String playVideo= "<html><body>Youtube video .. <br> <iframe class=\"youtube-player\" type=\"text/html\" width=\"640\" height=\"385\" src=\"http://www.youtube.com/embed/bIPcobKMB94\" frameborder=\"0\"></body></html>"

myWebView.loadData(playVideo, "text/html", "utf-8");

Saturday, May 26, 2012

30 helpful Android development Tips/Tricks


30 helpful Android development Tips/Tricks


Hello All,

  1. #AndroidDev #AndroidTip: To resolve this issue “Failed to install *.apk on device timeout Launch canceled! , increase ADB connection timeout
  2. #AndroidDev #AndroidTip: use setError() to display error message for your EditText
  3. #AndroidDev #AndroidTip => To Block the default animation for startActivity() For ex: myIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
  4. #AndroidDev #AndroidTip: Android Action Bar Style Generator http://jgilfelt.github.com/android-actionbarstylegenerator
  5. #AndroidDev #AndroidTip create library with reusable code and reference it in future projects.
  6. #AndroidDev #Tip #PureAndroid Don’t use right-pointing carets on line items http://developer.android.com/design/media/migrating_ios_settings.png
  7. #AndroidTip #AndroidDev 10 amazing Android development tips http://www.netmagazine.com/features/10-amazing-android-development-tips
  8. #AndroidDev #Tips => Define these attributes for displaying multiline EditText => android:singleLine=”false”, android:lines=”5″
  9. #AndroidDev #Tip => Follow Dashboard design pattern. Easy to implement and handle Navigation.
  10. #AndroidDev #Tip – Before starting with android app development, should read Android Building Blocks http://developer.android.com/design/building-blocks/index.html
  11. #AndroidDev #Tip => You can create your custom views by extending View class.
  12. #AndroidDev #Tip use android:weight=”1″ and android:layout_width=”0″ to define equal width of widgets inside LinearLayout.
  13. #AndroidDev #Tip => With Android 4.0 you cant use http connection or make web call without using a Thread (with a runnable, AsyncTask )
  14. #AndroidDev #Tips: Tutorial , Tips/Trick for Android http://stackoverflow.com/questions/3405695/tutorial-tips-trick-for-android
  15. AndroidDev #Java #Tip What should be the package name of android app? http://stackoverflow.com/questions/8075162/what-should-be-the-package-name-of-android-app
  16. #AndroidDev #Tip: GraphView Library for Android to programmatically create flexible and nice-looking diagramms http://www.jjoe64.com/p/graphview-library.html?spref=tw
  17. #AndroidDev #Tip => how to limit seekbar http://stackoverflow.com/questions/3490951/how-to-limit-seekbar
  18. #AndroidDev: Do you know? => Android: maximum length of url http://stackoverflow.com/questions/10172566/android-maximum-length-of-url
  19. #AndroidDev #Tips => RT @piyushnp How To Create a Android App With ICS UI That Works With Gingerbread and Froyo? http://stackoverflow.com/questions/9886523/how-to-create-a-android-app-with-ics-ui-that-works-with-gingerbread-and-froyo
  20. #AndroidDev #Tip – Switch widget is available from API 14 http://developer.android.com/reference/android/widget/Switch.html
  21. #AndroidDev #Tip – How to design tab icons? http://developer.android.com/guide/practices/ui_guidelines/icon_design_tab.html
  22. #AndroidDev rating bar padding problem http://code.google.com/p/android/issues/detail?id=2324
  23. #AndroidDev Anyone ever seen this exception when loading bitmaps in Android?… http://developer.android.com/training/displaying-bitmaps/index.html #BitmapVMSizeExceed
  24. #AndroidDev #Tip : To capture screen shot from real android device, simply Press Home button + Back key
  25. #AndroidDev #Tip : use android:installLocation=”auto” to enable move to SD-card feature for Android app http://www.technotalkative.com/android-enable-the-move-to-sd-card-feature/
  26. #AndroidDev #Tip : Use SimpleDateFormat class to change format of date/time.
  27. #AndroidDev #Tip: How to view the SQLite database on your Android Emulator http://blog.kwyps.com/2011/07/how-to-view-sqlite-database-on-your.html
  28. #AndroidDev #Tip: you can check the status of AsyncTask by using getStatus() method, or like AsyncTask.Status.FINISHED
  29. #Android tip: Stop developing countdown algorithms, use the built-in CountDownTimer (http://developer.android.com/reference/android/os/CountDownTimer.html). #android #androiddev
please share your feedbacks/reviews 

Tuesday, May 15, 2012

Taking Android to Work


Taking Android to Work

Fred Chung, Andrew Stadler, Gabriel Cohen
More and more people are bringing Android devices into enterprise environments. This talk will cover general enterprise adoption considerations and related Android features. We will also provide an overview of security issues, managed internal app development, corporate app directories, and an in-depth look at a sample implementation of device management policies.
Level: 201
Track: Android
Time: May 11, 04:15PM – 05:15PM
Room: Room 11

Memory management for Android Apps


Memory management for Android Apps

Patrick Dubroy
Android apps have more memory available to them than ever before, but are you sure you're using it wisely? This talk will cover the memory management changes in Gingerbread and Honeycomb (concurrent GC, heap-allocated bitmaps, "largeHeap" option) and explore tools and techniques for profiling the memory usage of Android apps.
Level: 301
Track: Android
Time: May 11, 04:15PM – 05:15PM
Room: Room 9

Honeycomb Highlights


Honeycomb Highlights

Romain Guy, Chet Haase
Android's "Honeycomb" release includes a large number of new features, capabilities, and APIs to access them. This session gives a high-level view of everything that's new, with special focus on how this affects developers' lives and what they should be paying attention to.
Level: 101
Track: Android
Time: May 10, 10:15AM – 11:15AM
Room: Room 11

Don’t just build a mobile app. Build a business.


Don’t just build a mobile app. Build a business.

Wayne Pan
Learn how to build a business on mobile apps so you can quit your day job. Walk away with an understanding of app business basics and how to use house ads for app promotion, mediation to optimize in-app advertising revenues and analytics to measure real ROI.
Level: 201
Track: Android
Time: May 10, 01:15PM – 02:15PM
Room: Room 11

Designing and Implementing Android UIs for Phones and Tablets


Designing and Implementing Android UIs for Phones and Tablets

Roman Nurik, Adam Powell, Richard Fulcher, Christian Robertson, Matias Duarte
There are a large number of Android tablet devices starting to ship. This session discusses the new APIs and tools available to developers for use in constructing apps that work well on them, and provides guidance on creating good user experience for users of these devices.
Level: 201
Track: Android
Time: May 11, 12:30PM – 01:30PM
Room: Room 11

Best Practices for Accessing Google APIs on Android


Best Practices for Accessing Google APIs on Android

Integration with Google APIs (such as Buzz, Latitude and Translate) can enrich many Android applications. In this session, we will demonstrate how to do so easily, efficiently and securely using the Google API Client for Java. We’ll walk you through how to authenticate for the APIs using AccountManager, how to reduce the client library size and several other Android-specific optimizations.
Level: 201
Track: Android
Time: May 10, 11:30AM – 12:30PM
Room: Room 9

Android Protips: Advanced Topics for Expert Android App Developers


Android Protips: Advanced Topics for Expert Android App Developers

Writing an app is easy, but with 100k competitors you need to do better than launch and cross your fingers. I'll demonstrate how to use advanced Android techniques to take a good app and transform it into a polished product. Features advanced coding tips & tricks, design and implementation patterns, and insight into some of the lesser known API features. This is an advanced session designed to help experienced developers.
Level: 301
Track: Android
Time: May 10, 11:30AM – 12:30PM
Room: Room 11

Android Market for Developers


Android Market for Developers

There are few things developers care more about than Android Market and, during the year since Google IO 2010, we have been investing huge amounts of efforts in expanding and improving it. This presentation walks through what's new, with a particular focus on where developers can take action to improve their apps' Market performance.
Level: 101
Track: Android
Time: May 11, 10:45AM – 11:45AM
Room: Room 11

Google Chrome: Day 2 Keynote from Google I/O


Google Chrome: Day 2 Keynote from Google I/O

Day kicked off with the announcement that Chrome is now at 160M active users, up from 70M last year. Watch for more announcements from the Chrome Web Store, Angry Birds, Chromebooks and Chrome In-App Payments.
Level: 101
Track: Keynote
Time: May 11, 09:30AM – 10:30AM
Room:

3D Graphics on Android: Lessons learned from Google Body


3D Graphics on Android: Lessons learned from Google Body

Google originally built Google Body, a 3D application that renders the human body in incredible detail, for WebGL-capable browsers running on high-end bPCs. To bring the app to Android at a high resolution and frame rate, Nico Weber and Won Chun had a close encounter with Android's graphics stack. In this session Nico will present their findings as best practices for high-end 3D graphics using OpenGL ES 2.0 on Android. The covered topics range from getting accelerated pixels on the screen to fast resource loading, performance guidelines, texture compression, mipmapping, recommended vertex attribute formats, and shader handling. The talk also touches on related topics such as SDK vs NDK, picking, and resource loading.
Level: 101
Track: Android
Time: May 11, 04:15PM – 05:15PM
Room: Room 8

Accelerated Android Rendering


Accelerated Android Rendering

Android 3.0 introduced a new hardware accelerated 2D rendering pipeline. In this talk, you will be introduced to the overall graphics architecture of the Android platform and get acquainted with the various rendering APIs at your disposal. You will learn how to choose the one that best fits your application. This talk will also deliver tips and tricks on how to use the new hardware accelerated pipeline to its full potential.
Level: 201
Track: Android
Time: May 11, 10:45AM – 11:45AM
Room: Room 9

Android: Momentum, Mobile and More at Google I/O


Android: Momentum, Mobile and More at Google I/O

Thanks to the ecosystem of manufacturers, developers and carriers, the platform has grown exponentially--100M activated Android devices. Read more on the official blog post at http://goo.gl/XZkAo
Level: 101
Track: Keynote
Time: May 10, 09:00AM – 10:00AM
Room:

Android + App Engine: A Developer's Dream Combination


Android + App Engine: A Developer's Dream Combination

This talk will introduce App Engine Tooling for Android. A complete set of Eclipse-based Java development tools for building Android applications that are backed by App Engine. With these tools developers can focus on building fantastic Android applications using common tools and techniques that span the client and server parts of the application AND make it extremely simple to deploy the server side to App Engine. This talk walks through building a fantastic cloud based android application.
Level: 201
Track: Android
Time: May 10, 03:45PM – 04:45PM
Room: Room 9

Android Development Tools


Android Development Tools

This talk provides an in-depth look at the Android development tools, along with tips & tricks for getting the most out of them. From project support, to source editing and visual editors, to emulator execution and debugging and profiling, this talk will help you get more productive with Android development. The main focus is on Eclipse, but we will discuss other complementary tools as well. This is a demo-oriented talk, and our goal is to show the available features, and how they fit into the workflow.
Level: 201
Track: Android
Time: May 11, 03:00PM – 04:00PM
Room: Room 11

Turbo-charge your UI: How to Make your Android UI Fast and Efficient


Turbo-charge your UI: How to Make your Android UI Fast and Efficient

Learn practical tips, techniques and tricks for making your Android applications fast and responsive. This session will focus on optimizations recommended by the Android framework team to make the best use of the UI toolkit.

Session Video

Monday, May 14, 2012

Drag and Drop UI element


Drag and Drop UI element



The project describes how to implement an application which allows you to drop and drag UI elements.
Underlying Algorithm:
Basic description of algorithm in step by step form:
1.) Create a Project DragNew
2.) Open and insert following in main.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:orientation="vertical"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:id="@+id/vg"
   >
 
<ImageView android:id="@+id/img" android:layout_width="wrap_content"android:layout_height="wrap_content" android:src="@drawable/elmer" />
</LinearLayout>
3.) Open and insert following in your strings.xml:
<resources>
    <string name="hello">Drag and Drop, MyActivity!</string>
    <string name="app_name">Drag and Drop</string>
    <string name="drag">drag</string>
</resources>
4.) Add some image in your drawable folder.
5.) Run the application. It allows you to drag and drop the element drawn on screen from one place to another.
Steps to Create:
1.) Open Eclipse. Use the New Project Wizard and select Android Project Give the respective project name i.e. DragNew. Enter following information:
Project name: DragNew
Build Target: Android 2.3.1
Application name: DragNew
Package name: com.sample.dragdrop
Create Activity: MyActivity
On Clicking Finish DragNew code structure is generated with the necessary Android Packages being imported along with DragNew.java. DragNew class will look like following:
package com.sample.dragdrop;
import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
public class MyActivity extends Activity {
        private View selected_item = null;
        private int offset_x = 0;
        private int offset_y = 0;
 
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        ViewGroup vg = (ViewGroup)findViewById(R.id.vg);
        vg.setOnTouchListener(new View.OnTouchListener() {
                     
                        @Override
                        public boolean onTouch(View v, MotionEvent event) {
                                switch(event.getActionMasked())
                                {
                                        case MotionEvent.ACTION_MOVE:
                                                int x = (int)event.getX() -offset_x;
                                                int y = (int)event.getY() -offset_y;
                        int w = getWindowManager().getDefaultDisplay().getWidth()- 100;
                        int h =getWindowManager().getDefaultDisplay().getHeight() - 100;
                        if(> w)
                            x = w;
                        if(> h)
                            y = h;
                                         LinearLayout.LayoutParams lp = newLinearLayout.LayoutParams(
                                        new ViewGroup.MarginLayoutParams(
                                                        LinearLayout.LayoutParams.WRAP_CONTENT,
                                                        LinearLayout.LayoutParams.WRAP_CONTENT));
                                         lp.setMargins(x, y, 0, 0);
                                                selected_item.setLayoutParams(lp);
                                                break;
                                        default:
                                                break;
                                }
                                return true;
                        }
   });
       ImageView img = (ImageView)findViewById(R.id.img);
        img.setOnTouchListener(new View.OnTouchListener() {
                     
                        @Override
                        public boolean onTouch(View v, MotionEvent event) {
                                switch(event.getActionMasked())
                                {
                                        case MotionEvent.ACTION_DOWN:
                                                offset_x = (int)event.getX();
                                                offset_y = (int)event.getY();
                                                selected_item = v;
                                                break;
                                        default:
                                                break;
                                }
                               
                                return false;
                        }
                });
    }
}
Output – The final output
If you want to only move image and not view check this code DragDrop
Share and Enjoy