Sunday, October 27, 2013

How can I make the Android emulator show the soft keyboard?

Question:
I'm debugging an issue with the soft keyboard display not displaying when it should. However, I don't have a device handy for testing. The problem is that the emulator never shows the soft keyboard.
Some skins have a keyboard constantly displayed on the right, some don't, but none that I've tried so far has ever shown a keyboard on the device screen. For what it's worth, this is using the latest version of the emulator (Android emulator version 18.0 (build_id MASTER-306762)), running on OSX 10.7.
Is there some setting that I missed?

Answer:
I found out how to do this on the emulator itself. All you need to do it go to \
settings -> Language & Input -> Go to the "Keyboard & Input Methods -> click Default
This will bring up a Dialog in which case you can then disable the Hardware Keyboard by switching the hardware keyboard from on to off. This will disable the Hardware keyboard and enable the softkeyboard.

Basic setup for Microsoft Remote Desktop and Remote Desktop Client for Android



Setup in the video:
- Windows 8.1 Pro running on a slow and outdate Netbook, BenQ Joybook Lite U101 with Aton N270, connect router with cable.
- HTC One X running Android 4.2.2, connect via WiFi.
- HTC Fly running Android 3.2.1, connect via WiFi.


Before establish connection between host PC and remote client app, you have to setup in both PC side and client side.

Set up your Remote Desktop in host PC. (This example running Windows 8.1 Pro)

- Enter "Remote Desktop" in Search, select "Select users who can use remote desktop".


- Under Remote tab, enable "Allow remote connections to this computer" under Remote Desktop. Click the "Select Users" button.


remark: what type of connection should be allowed?

Network Level Authentication (NLA) is an authentication method that completes user authentication before you establish a full connection and the sign-in screen appears. This can help protect the remote PC from hackers and malware.
  • To prevent anyone from connecting to your PC using Remote Desktop or RemoteApp and Desktop Connections, pick Don’t allow remote connections to this computer.
  • If you don't know which version of Remote Desktop Connection other people are using, pick Allow remote connections to this computer.
  • If you know that the people who will connect to your PC are running Windows 7 or Windows 8 on their PCs, check the Only allow connections from computers running Remote Desktop with Network Level Authentication (recommended) box.
Reference: What types of Remote Desktop connections should I allow?

- Click "Add" button.


- Select "Users" in Select the object type. Enter object name and click "Check Names", to get the selected object.


- OK.


- and OK.


 Install and start "Microsoft Remote Desktop" for Android.

Set up your Remote Desktop Client in Android side.

- Select "Remote Desktops" and click the "+".


- Enter Connection, IP address in PC name, User name and Password. And click the check mark on upper-right.


Read the Official FAQ.

Project Shield - Using Google's infrastructure to protect freedom of expression

Project Shield is an initiative to use Google's infrastructure to protect free expression online. The service currently combines Google's DDoS mitigation technologies and Page Speed Service (PSS), which allow websites to serve their content through Google to be better protected from DDoS attacks. The service is currently seeking 'trusted testers' and people with sites that serve media, elections and human rights-related content are invited to apply for an invite atg.co/projectshield

Sharpen bitmap using Convolution

The previous exercise "Blur bitmap using Convolution". By changing the matrix of Convolution class, we can use it to sharpen bitmap.

 class Convolution {

// matrix to sharpen image
int[][] matrix = { { 0, -1, 0 }, { -1, 5, -1 }, { 0, -1, 0 } };
...


Sharpen bitmap using Convolution

Getting Started with Remote Desktop Client on mobile

Microsoft release Remote Desktop Client for Android and iOS recently. Users can use the Microsoft Remote Desktop Client to connect to a remote PC and your work resources from almost anywhere.

Download here:
for Android from Google Play
for iOS from iTune




***To establish connection between Microsoft Remote Desktop Client to connect between remote PC, you have to do some setup. Refer to the document: Microsoft Remote Desktop Clients.

Very nice intro at updated Google Maps Android API v2 documentation page

Google Maps Android API v2 documentation page updated with very nice interactive intro:)


Google Maps Android API v2 documentation page



Visit: https://developers.google.com/maps/documentation/android/

USB On the Go, for HTC



If your Android support USB OTG, you can access USB Storage via USB OTG cable. (Please notice that not all devices support this feature)

Here is a post describe using of USB On the Go for HTC device from HTC Blog: http://blog.htc.com/usb-otg/

  • First, get your USB OTG cable ready
  • Plug your USB drive into the USB port on the cable, then plug the cable into your phones microUSB port.
  • Now you can access the data on your USB drive through your HTC smartphone. Using USB OTG, you can use apps like Gallery, Music and Polaris Office to easily access files on your USB drive and your smartphone.
  • When you’re done, you can quickly check available storage on your USB drive by going to Setting > Storage on your HTC phone.  Also, don’t forget to unmount your USB drive when you’re finished.

Some example of simple styled button

Some example of simple styled button


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:autoLink="web"
android:text="http://android-er.blogspot.com/"
android:textStyle="bold" />

<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Default Button" />

<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_launcher"
android:text="Button with background of drawable, no CLICK visual effect" />

<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#550000ff"
android:text="Button with background of color, no CLICK visual effect" />

<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawableRight="@drawable/ic_launcher"
android:text="Button with drawableRight" />

<ImageButton
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />

<Button
style="?android:attr/borderlessButtonStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Button with borderlessButtonStyle (for API 11+)" />

<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:shadowColor="#000000"
android:shadowDx="5"
android:shadowDy="5"
android:shadowRadius="10"
android:text="Button with shadow on Text" />

<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:shadowColor="#000000"
android:text="Button with Styled Text"
android:textStyle="bold|italic" />

</LinearLayout>

Learn OpenGL ES: For Mobile Game and Graphics Development


Release date: August 30, 2013 | ISBN-10: 1430250534 | ISBN-13: 978-1430250531 | Edition: 1

Want to create sophisticated games and graphics-intensive apps? Learn OpenGL ES gets you started immediately with OpenGL ES.  After mastering the basics of OpenGL ES itself, you will quickly find yourself writing and building game apps, without having to learn about object oriented programming techniques.

This book demonstrates the use of a powerful open-source modeling tool, Blender. You will be guided, step by step, through the development of Tank Fence, a dynamic, interactive 3D game. Along the way you'll gain skills in building apps with Eclipse and the Android SDK or NDK, rendering graphics using hardware acceleration, and multithreading for performance and responsiveness. iOS developers will also find this book's information invaluable when writing their apps.

You'll learn everything you need to know about:
  • Creating simple, efficient game UIs
  • Designing the basic building blocks of an exciting, interactive 3D game
  • Pulling all the elements together with Blender, a powerful open-source tool for modeling, animation, rendering, compositing, video editing, and game creation
  • Taking the next big step using custom and inbuilt functions, texturing, shading, light sources, and more
  • Refining your mobile game app through collision detection, player-room-obstacle classes, and storage classes
  • Doing all this efficiently on mobile devices with limited resources and processing
What you’ll learn
  • How to install and use OpenGL ES 2.0 on Android
  • GLSL ES Fundamentals
  • State Management
  • Modeling 3D Objects Using Blender
  • Using the Perl Mesh Parser
  • Vertex Buffer Objects
  • Using Color Masks
  • sampler2D and samplerCube Uniforms
  • Multi-Texturing
  • Lambert Illumination Model
  • Implementing the Lighting Equation
  • Design, write, and build Tank Fence, an interactive 3D game
Who this book is for

Learn OpenGL ES is ideal for mobile game and interactive app developers who want to know more about the OpenGL ES engine and and use it to build more sophisticated, graphically-rich games and other apps. While the code is developed on Android, iOS developers will also find this book invaluable.

Table of Contents
1. Why OpenGL ES?
2. UI for games: Keep it simple
3. First Steps:  Mobile Game App Development
4. 3D Modeling
5. Functions, Shading, Light Source and Objects
6. Carrying Further: Collision Detection


Beginning Android C++ Game Development

Beginning Android C++ Game Development introduces general and Android game developers like you to Android's powerful Native Development Kit (NDK). The Android NDK platform allows you to build the most sophisticated, complex and best performing game apps that leverage C++.  In short, you learn to build professional looking and performing game apps like the book's case study, Droid Runner.In this book, you'll learn all the major aspects of game design and programming using the Android NDK and be ready to submit your first professional video game app to Google Play and Amazon Appstore for today's Android smartphones and tablet users to download and play.

The techniques contained in this book include building a game engine, writing a renderer, and building a full game app with entities, game levels and collisions. As part of the tutorial you'll also learn about inserting perspectives using cameras and including audio in your game app.

What you’ll learn

  • How to build your first real-world quality game app for Android smartphones and tablets using the power of the Android C++ APIs as found in the NDK
  • How to do professional level, quality game design, starting the Droid Runner case study that's used throughout this book to illustrate the key concepts
  • How to build a game engine
  • How to write a renderer
  • How to build the Droid Runner game app with entities, game levels and collisions
  • How to insert perspectives using cameras and more
  • How to create or integrate audio into your game app
  • How to submit to the Android app stores like Google Play and Amazon Appstore

Who this book is for

This book is for game developers looking to get into Android development for the first time, as well as Android game developers who have never used the Native Development Kit (NDK).

Table of Contents

Section 1 : An Introduction to Android and Game Programming
1. An Introduction To Game Development
2. An Introduction to the Android Game Development Ecosystem.
(A First Game:  HelloDroid)
3. Game Design For Beginners - Droid Runner
(Case Study begins: Droid Runner)
4. Building a Game Engine
5. Writing a Renderer

Section 2 : Building Droid Runner Game App
6. Game Entities
7. Building Game Levels With Collision
8. Virtual Cameras
9. Lighting and Materials
10. Game Audio
11. Self-Publishing 101

Appendices:
A. Developing with the Android NDK and Eclipse.
B. Android Hardware
C. C++ and Design Patterns
D. C++ Math 

 

Connecting your Android App to Azure Mobile Services (including Android Dev Tools setup)




Chris Risner and Nick Harris have  a set of excellent Mobile Services videos in the Windows Azure area of Channel 9 here.

The video in this post is for those of you who have no experience with the Android Development Tools (ADT). You'll get some errors with the latest build of the ADT unless you follow the ADT setup instructions in this video.

I'd suggest following along with this video to set up the ADT and then watching Chris and Nick's excellent set of Mobile Services videos to extend your knowledge.

Source: http://channel9.msdn.com/posts/Connecting-your-Android-App-to-Azure-Mobile-Services-including-Android-Dev-Tools-setup 

Learn how to use the Android NDK, by creating an image processing application

The Android Software Developer Kit (SDK) used by the majority of Android application developers requires the use of the Java™ programming language. However, there is a large body of C language code available online. The Android Native Developer Kit (NDK) permits an Android developer to reuse existing C source code within an Android application. The tutorial,Reuse existing C code with the Android NDK by IBM 12 Apr 2011, introduce how to create an image processing application in the Java programming language that uses C code to perform basic image processing operations.

The tutorial is available in PDF format (773 KB | 42 pages) also.

Reuse existing C code with the Android NDK
Reuse existing C code with the Android NDK

Android Design for UI Developers

Google I/O 2013 tutorial, Android Design for UI Developers:

In this tutorial video, will explore the arsenal of tools available to Android UI engineers that let developers implement some of these important guidelines, including responsive design with multi-pane layouts, metrics and layout grids, and core navigation components.

Enable Developer Options for devices with Android 4.2 and higher

On devices running Android 4.2 and higher, the Developer options is hidden by default. To enable Developer Options, go to Settings > About phone and tap Build number seven times, the detail steps may various depends on model.

Here is the steps to enable Developer Options on HTC One X running Android 4.2.2:

- Open Settings, select About.


- Open Software information


- Open More


- Tap on Build number 7 times


You are now a developer!
The Developer Options will be in Settings.



Some tips for android-er

October 2013

Saturday, October 26, 2013

Android Tutorial

android-logo
Android, an open source operating system for mobile devices (Smartphone and tablet), led by Google. The Android SDK provides a set of tools and APIs to develop Android applications, using Java. So, if you know Java, Android programming is easy :)
In this series of tutorials, we show you the list of basic tutorials to get you start program Android easily.
Note
All Android tutorials are developed in Eclipse 3.7, and tested with Android 2.3.3.
P.S This is just the initial version of Android tutorials, will keep publishing more in future.

1. Quick Start

Get you start in Android programming.

2. Fundamentals

Some Android basic stuffs.

3. User Interface Controls

Play with Android UI controls.

4. Layouts

Play with Android layout controls.

5. FAQs

Some common asked questions in Android.

    Java - Library Classes

    Java - Library Classes

    This tutorial would cover package java.lang, which provides classes that are fundamental to the design of the Java programming language. The most important classes are Object, which is the root of the class hierarchy, and Class, instances of which represent classes at run time.
    Here is the list of classes of package java.lang. These classes are very important to know for a Java programmer. Click a class link to know more detail about that class. For a further drill, you can refer standard Java documentation.
    SNMethods with Description
    1Boolean
    Boolean
    2Byte
    The Byte class wraps a value of primitive type byte in an object.
    3Character
    The Character class wraps a value of the primitive type char in an object.
    4Class
    Instances of the class Class represent classes and interfaces in a running Java application.
    5ClassLoader
    A class loader is an object that is responsible for loading classes.
    6Compiler
    The Compiler class is provided to support Java-to-native-code compilers and related services.
    7Double
    The Double class wraps a value of the primitive type double in an object.
    8Float
    The Float class wraps a value of primitive type float in an object.
    9Integer
    The Integer class wraps a value of the primitive type int in an object.
    10Long
    The Long class wraps a value of the primitive type long in an object.
    11Math
    The class Math contains methods for performing basic numeric operations such as the elementary exponential, logarithm, square root, and trigonometric functions.
    12Number
    The abstract class Number is the superclass of classes BigDecimal, BigInteger, Byte, Double, Float, Integer, Long, and Short.
    13Object
    Class Object is the root of the class hierarchy.
    14Package
    Package objects contain version information about the implementation and specification of a Java package.
    15Process
    The Runtime.exec methods create a native process and return an instance of a subclass of Process that can be used to control the process and obtain information about it.
    16Runtime
    Every Java application has a single instance of class Runtime that allows the application to interface with the environment in which the application is running.
    17RuntimePermission
    This class is for runtime permissions.
    18SecurityManager
    The security manager is a class that allows applications to implement a security policy.
    19Short
    The Short class wraps a value of primitive type short in an object.
    20StackTraceElement
    An element in a stack trace, as returned by Throwable.getStackTrace().
    21StrictMath
    The class StrictMath contains methods for performing basic numeric operations such as the elementary exponential, logarithm, square root, and trigonometric functions.
    22String
    The String class represents character strings.
    23StringBuffer
    A string buffer implements a mutable sequence of characters.
    24System
    The System class contains several useful class fields and methods.
    25Thread
    A thread is a thread of execution in a program.
    26ThreadGroup
    A thread group represents a set of threads.
    27ThreadLocal
    This class provides thread-local variables.
    28Throwable
    The Throwable class is the superclass of all errors and exceptions in the Java language.
    29Void
    The Void class is an uninstantiable placeholder class to hold a reference to the Class object representing the Java keyword void.