Pages

Showing posts with label design. Show all posts
Showing posts with label design. Show all posts

Friday, May 13, 2016

Android Developers Backstage Episode 9 Design

Tor and Chet make a startling break with ancient tradition and talk to a real, live designer in this episode: Christian Robertson from the Android User Experience team. Tune in to hear about the Roboto font that Christian created and about font design in general, plus design tips for layout, visual rhythm, and other Android designities.

Design: Its the new Develop.

Relevant links:
Android Design: https://developer.android.com/design/index.html
Android Style Guide: http://developer.android.com/design/style/index.html
Android Asset Studio: http://romannurik.github.io/AndroidAssetStudio/
Roboto: http://www.google.com/fonts/specimen/Roboto

Christian: https://plus.google.com/110879635926653430880/posts
Tor: google.com/+TorNorbye
Chet: google.com/+ChetHaase

Subscribe to the podcast in your favorite player or at http://feeds.feedburner.com/blogspot/AndroidDevelopersBackstage
Or just download the mp3 directly: http://storage.googleapis.com/androiddevelopers/android_developers_backstage/Android%20Developers%20Backstage%20Ep9%20Design.mp3
Read More..

Saturday, April 16, 2016

Episode 30 Android Design Library

This time, Tor and Chet are joined by Chris Banes (again!) to talk about the new Android Design Library, which was released at Google I/O 2015. Listen in to find out all about CoordinatorLayout, FAB, Snackbar, and more, more, more!

Subscribe to the podcast feed or download the audio file directly.

Relevant Links:
Chriss blog
Android Design Library Demo
Android Design Support Library (Android Developers Blog)

Chris: google.com/+ChrisBanes
Tor: google.com/+TorNorbye
Chet: google.com/+ChetHaase

Read More..

Wednesday, April 6, 2016

Android Studio Game Development Concepts and Design

Android Studio Game Development: Concepts and Design

This one of a kind short book walks any Android developer through the process of creating mobile games using the new Android Studio IDE. Android Studio offers a myriad of tools for developers such as enhanced intellisense and device emulation. This book provides a quick and easy to read format; introduces the reader to these key tools and gives them the knowledge they need to develop games in Android Studio.

What You’ll Learn
  • How to create projects in Android Studio
  • How to use the SDK manager to keep your Android SDK current
  • How to commit and get projects to and from Git hub
  • How to use OpenGL ES to load images
  • How to react to player input
  • How to debug your games using Android Studio
Audience

This book is for those who may be new to game development who have some experience with Android Studio IDE and Android.  To learn about Android Studio, check out Learn Android Studio IDE by Gerber and Craig (Apress).

Read More..

Sunday, March 27, 2016

BBM Material Design Terbaru for Android

BlackBerry Messenger atau yang biasa disebut BBM adalah aplikasi messenger Android & iOS yang paling populer saat ini. Untuk menjaga popularitasnya, pihak BlackBerry tiada henti-hentinya meng-update dan menambah fitur baru pada BBM. Baru-baru ini, BBM ini telah dirilis, namun masih versi Beta dan belum tersedia di Play Store. Pada versi terbaru ini, BlackBerry mengubah total tampilan BBM menjadi Material Design, mirip dengan tampilan Android 5.0 Lollipop. Beberapa fitur baru juga tersedia di BBM Material Design ini, seperti edit message, private chat, dan publish in feed. Penasaran dengan tampilan BBM Material Design? Silahkan lihat screenshot di bawah ini, hehe.
Screenshot
BBM Material Design Terbaru for AndroidBBM Material Design Terbaru for AndroidBBM Material Design Terbaru for Android
Download :
  • BBM Material Design Terbaru for Android [Server 1]
  • BBM Material Design Terbaru for Android [Server 2]
  • BBM Material Design Terbaru for Android [Server 3]
    Password  :  www.bagas31.com   |   Status  :  Tested (Samsung Galaxy Ace 3 GT-S7270)
Cara Install :
  1. Download BBM Material Design melalui link di atas
  2. Pindah file yang sudah kamu download tadi ke smartphone Android kamu
  3. Uninstall BBM versi sebelumnya (jika ada)
  4. Install BBM Material Design di smartphone kamu seperti biasa
  5. Jalankan BBM, kemudian login atau sign-up
  6. Selesai!
Note :
  • Jika BBM versi sebelumnya sudah terinstall, uninstall terlebih dahulu sebelum meng-install BBM Material Design ini
  • Disarankan untuk tidak menggunakan koneksi WiFi saat login atau sign-up, supaya status BBM bisa Connected
  • by bagas31
Read More..

Sunday, March 20, 2016

Simulate Location Change in Android Emulator

Start the Emulator
Start a command prompt
Start telnet
Then, type, o localhost 5554
This connects the telnet client to the android emulator (assuming emulator is running locally listening on port 5554. Else this connection fails)
Now type
geo fix 79.000000 13.000000 (or your latitude and longitude)
This sends the location change signal to the emulator.
NOTE: This is useful for applications built using Location APIs in Android and need to work with changes in location
Read More..

Saturday, February 27, 2016

iPhone Like Tab bar in Android

In a previous post we saw how to use the TabHost to create tabs in Android applications. Also we noticed that the Tabs in Android appear at the top of the activity.
but what if we want to give the tabs the look of the iPhone Tab Bar ?

this is possible by wrapping the TabWidget and the FrameLayout in a RelativeLayout container and adding android:layout_alignParentBottom="true" attribute to the TabWidget just like this:
<?xml version="1.0" encoding="utf-8"?>


<TabHost android_layout_width="fill_parent"
android_layout_height="fill_parent"
android_id="@android:id/tabhost"

>
<RelativeLayout
android_layout_width="fill_parent"
android_layout_height="fill_parent"
>
<TabWidget
android_layout_width="fill_parent"
android_layout_height="wrap_content"
android_id="@android:id/tabs"
android_layout_alignParentBottom="true"
/>
<FrameLayout
android_layout_width="fill_parent"
android_layout_height="fill_parent"
android_id="@android:id/tabcontent"
>

</FrameLayout>
</RelativeLayout>
</TabHost>




Read More..

Sunday, February 21, 2016

Android NDK Game Development Cookbook

Android NDK Game Development Cookbook

For C++ developers, this is the book that can swiftly propel you into the potentially profitable world of Android games. The 70+ step-by-step recipes using Android NDK will give you the wide-ranging knowledge you need.

Overview
  • Tips and tricks for developing and debugging mobile games on your desktop
  • Enhance your applications by writing multithreaded code for audio playback, network access, and asynchronous resource loading
  • Enhance your game development skills by using modern OpenGL ES and develop applications without using an IDE
  • Features two ready-to-run Android games
In Detail

Android NDK is used for multimedia applications which require direct access to a systems resources. Android NDK is also the key for portability, which in turn provides a reasonably comfortable development and debugging process using familiar tools such as GCC and Clang toolchains. If your wish to build Android games using this amazing framework, then this book is a must-have.

This book provides you with a number of clear step-by-step recipes which will help you to start developing mobile games with Android NDK and boost your productivity debugging them on your computer. This book will also provide you with new ways of working as well as some useful tips and tricks that will demonstrably increase your development speed and efficiency.

This book will take you through a number of easy-to-follow recipes that will help you to take advantage of the Android NDK as well as some popular C++ libraries. It presents Android application development in C++ and shows you how to create a complete gaming application.

You will learn how to write portable multithreaded C++ code, use HTTP networking, play audio files, use OpenGL ES, to render high-quality text, and how to recognize user gestures on multi-touch devices. If you want to leverage your C++ skills in mobile development and add performance to your Android applications, then this is the book for you.

What you will learn from this book
  • Port popular C++ libraries to Android
  • Write portable multithreaded code
  • Play audio with OpenAL
  • Implement gesture recognition
  • Render text with FreeType
  • Use OpenGL ES to port and abstract APIs from the game code to develop games on a desktop PC
  • Debug mobile applications on your desktop
  • Access Flickr and Picasa web services from C++
  • Extract resources from APK archives
  • Develop Android applications without an IDE
Approach

A systematic guide consisting of over 70 recipes which focus on helping you build portable mobile games and aims to enhance your game development skills with clear instructions.

Who this book is written for

If you are a C++ developer who wants to jump into the world of Android game development and who wants to use the power of existing C++ libraries in your existing Android Java applications, then this book is for you. You need to have basic knowledge of C or C++ including pointer manipulation, multithreading, and object-oriented programming concepts as well as some experience developing applications without using an IDE.

Read More..

Friday, February 12, 2016

Http Connection Using Threads Handlers in Android Part 19

This is about how to invoke an Http Url from an android activity. If you have already written such a program in core java, you will not find anything new in the HTTP connectivity part. However, this tutorial also shows how to communicate between thread using the Message object.


In this tutorial, I plan to download 1 image and 1 text from the internet on the click of respective buttons on the android phone.

NOTE: I have also incidentally used Absolute Layout so that the buttons, the text and the image are all seen on the same screen even after being fetched.

Since fetching data from the internet can be a time-consuming task and a very unpredictable one at that, so, it would best be done in a separate thread rather than the UI/main thread. The basics of this have been discussed in the previous tutorial on Handlers and Threads.

To go to the application code directly, on the click of a button “Get Image”, I want to get an image whose URL is hard-coded in the program. For that first, I must open an HTTP connection to the server and then request for the image.

Hence is the code for opening and making an HTTP Connection:

private InputStream openHttpConnection(String urlStr) {
InputStream in = null;
int resCode = -1;
try {


URL url = new URL(urlStr);
URLConnection urlConn = url.openConnection();

if (!(urlConn instanceof HttpURLConnection)) {
throw new IOException ("URL is not an Http URL");
}

HttpURLConnection httpConn = (HttpURLConnection)urlConn;
httpConn.setAllowUserInteraction(false);
httpConn.setInstanceFollowRedirects(true);
httpConn.setRequestMethod("GET");
httpConn.connect();
resCode = httpConn.getResponseCode();


if (resCode == HttpURLConnection.HTTP_OK) {
in = httpConn.getInputStream();
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return in;
}
I will not be explaining this code much as most of this is based on the java.net package. This code would be exactly same even if we were to write this in regular java code, not meant for android usage. In brief, I have opened a URLConnection, checked if it is an instance of HttpURLConnection, set the parameters required and made the ‘connection’ finally by calling the connect() method. Then, I check if the response code is OK and I get a handle to the input stream.


So, this is a utility method that I will use for fetching image as well as text.

Now, coming to fetching the image. I want to fetch it when the end user clicks on a button “Get Image”. So the code associated with the button click is here:

getImageButton = (Button)findViewById(R.id.Button01);
getImageButton.setOnClickListener( new OnClickListener() {
Override
public void onClick(View v) {
downloadImage(http://www.android.com/media/wallpaper/gif/android_logo.gif);
                              }
               });

So the fetching of the image is in the downloadImage() method, which is given the URL of the android logo. Here is the method:

private void downloadImage(String urlStr) {
progressDialog = ProgressDialog.show(this, "", "Fetching Image...");
final String url = urlStr;
new Thread() {
public void run() {
InputStream in = null;
Message msg = Message.obtain();
msg.what = 1;
try {
in = openHttpConnection(url);
bitmap = BitmapFactory.decodeStream(in);
Bundle b = new Bundle();
b.putParcelable("bitmap", bitmap);
msg.setData(b);
in.close();
} catch (IOException e1) {
e1.printStackTrace();
}
messageHandler.sendMessage(msg);

}
}.start();
This method looks a bit complicated. First, let us look at the basics. If I were not fetching this in a separate thread, I would have just the 3 lines of code that is in Bold and highlighted. Open a connection, fetch the bitmap and close the connection. However, since this is a typical task that is unpredictable in its response time, it is best done in a separate thread of its own. So, before I start a new thread, I let the UI thread to show a ProgressDialog as shown in

progressDialog = ProgressDialog.show(this, "", "Fetching Image...");

Then, I start a new thread. I make the URL string accessible within the new thread by making it a final variable. Since message is an object that I can use for communication between threads, I create a Message object in the thread. Then, I set the message number to 1, so that I can use it later.
Message msg = Message.obtain();
msg.what = 1;
Then, I bundle my bitmap already fetched into a Bundle object that can be sent back in the Message object.
Bundle b = new Bundle();
b.putParcelable("bitmap", bitmap);
msg.setData(b);

Once I close the input stream as in:
 in.close();
the thread has completed the job. So, I notify the main / UI thread through this method and also pass on the Message object:
messageHandler.sendMessage(msg);
This completes the fetching of the image in a separate thread. Now, how do I retrieve the image from the Message object in the main thread?
As soon as the child thread notifies, the method called back in the main thread is the handleMessage(msg) method. It is in this method that I retrieve the bitmap and set it to the ImageView in the UI. Here it goes:


private Handler messageHandler = new Handler() {
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case 1:
ImageView img = (ImageView) findViewById(R.id.imageview01);
img.setImageBitmap((Bitmap)(msg.getData().getParcelable("bitmap")));
break;
case 2:
    ……….
}
progressDialog.dismiss();
}
        };

Within this method, first I check the msg.what variable to see what the type of message I am expecting is. If it is 1, which I had set in downloadImage(..) method, then, I do the required things to get a handle to the ImageView object and then give the bitmap to it.

How do I fetch the data from the msg object? Through getData(). Then I use the key “bitmap” to retrieve the bitmap and cast it to Bitmap before setting it to the ImageView. Finally, I dismiss the progress dialog.

I hope this is clear. This example not only shows HTTP Connection from Android but also the Thread-to-thread communication through handler, message exchange.

In a very similar fashion, I also fetch the text. On click of the Get Text button, here is the code that gets invoked:
getTextButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
downloadText(http://saigeethamn.blogspot.com/feeds/posts/default);
}
         });

The downloadText() code is here:

private void downloadText(String urlStr) {
progressDialog = ProgressDialog.show(this, "", "Fetching Text...");
final String url = urlStr;
new Thread () {
public void run() {
int BUFFER_SIZE = 2000;
InputStream in = null;
Message msg = Message.obtain();
msg.what=2;
try {
in = openHttpConnection(url);
InputStreamReader isr = new InputStreamReader(in);
int charRead;
text = "";
char[] inputBuffer = new char[BUFFER_SIZE];
while ((charRead = isr.read(inputBuffer))>0)
{
//---convert the chars to a String---
String readString =
String.copyValueOf(inputBuffer, 0, charRead);
text += readString;
inputBuffer = new char[BUFFER_SIZE];
}
Bundle b = new Bundle();
b.putString("text", text);
msg.setData(b);
in.close();
} catch (IOException e) {
e.printStackTrace();
}
messageHandler.sendMessage(msg);
}
}.start();
}

And the way the text is handled in the main thread handleMessage(..) method is here:
case 2:
TextView text = (TextView) findViewById(R.id.textview01);
text.setText(msg.getData().getString("text"));
break;
The complete code can be downloaded here

 NOTE: the blog editor is posing major problems in editing - it is jumbling up the whole post esp. when I use the " feature. So, please bear with me if somethings look garbled. I have tried my best to work around the editor problem. This has been noticed only in the last 3 posts of mine. Hope it gets fixed soon.
Thanks for your understanding.
Read More..