Nov 26, 2014

fplutil - libraries and tools help developing for Android and other platforms

fplutil is a set of small libraries and tools that can be useful when developing applications for Android and other platforms.

Components
  • build_all_android is an all-in-one build script that allows you to build, install and run native (C/C++) Android apps from the command line. This is ideal for build automation, but can also be in a developer’s compile/run loop.
  • buildutil performs the configuration, build and archive steps of Android and Linux C/C++ applications using a suite of Python modules. This suite of modules can automate builds in a continuous integration environment.
  • android_ndk_perf is a desktop tool that enables native (C/C++) developers to measure the CPU utilization of their applications on Android, guiding their optimization efforts.
  • libfplutil enables C/C++ developers to write traditional applications (like Hello World) using "main()" and "printf()" on Android.
Visit: http://google.github.io/fplutil/



Nov 24, 2014

Customize Toast to show longer duration

This example show how to customize Toast to show longer duration, by using CountDownTimer to call toast.show() repeatly. And also show how to make the toast counting.


package com.example.androidtoastduration;

import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
import android.os.Bundle;
import android.os.CountDownTimer;


public class MainActivity extends ActionBarActivity {
 
 Button text1, text2, text3, text4;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        text1 = (Button)findViewById(R.id.text1);
        text2 = (Button)findViewById(R.id.text2);
        text3 = (Button)findViewById(R.id.text3);
        text4 = (Button)findViewById(R.id.text4);
        
        text1.setOnClickListener(new OnClickListener(){

   @Override
   public void onClick(View v) {
    Toast.makeText(
      MainActivity.this, 
      "LENGTH_SHORT", 
      Toast.LENGTH_SHORT).show();
   }});
        
        text2.setOnClickListener(new OnClickListener(){

   @Override
   public void onClick(View v) {
    Toast toast = Toast.makeText(
      MainActivity.this, 
      "10 second - Not Work!", 
      Toast.LENGTH_SHORT);
    toast.setDuration(10000); //set duration, not work
    toast.show();
   }});
        
        text3.setOnClickListener(new OnClickListener(){

   @Override
   public void onClick(View v) {
    final Toast toast = Toast.makeText(
      MainActivity.this, 
      "10 second", 
      Toast.LENGTH_SHORT);
    toast.show();
    
    new CountDownTimer(10000, 1000)
             {
                 public void onTick(long millisUntilFinished) {
                  toast.show(); 
                 }
                 
                 public void onFinish() {
                  toast.cancel();
                  
                 }
             }.start();
   }});
        
        text4.setOnClickListener(new OnClickListener(){

   @Override
   public void onClick(View v) {
    final Toast toast = Toast.makeText(
      MainActivity.this, 
      "10 second", 
      Toast.LENGTH_SHORT);
    toast.show();
    
    new CountDownTimer(10000, 1000)
             {
     int count = 10;
     
                 public void onTick(long millisUntilFinished) {
                  toast.show();
                  count--;
                  toast.setText(count + " sec");
                 }
                 
                 public void onFinish() {
                  toast.cancel();
                  
                 }
             }.start();
   }});
    }

}

<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:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:orientation="vertical"
    tools:context="com.example.androidtoastduration.MainActivity" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="android-coding.blogspot.com" />
    
    <Button
        android:id="@+id/text1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="40dp"
        android:textStyle="bold"
        android:text="LENGTH_SHORT" />
    
    <Button
        android:id="@+id/text2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="40dp"
        android:textStyle="bold"
        android:text="10 sec Toast - NOT Work!" />
    
    <Button
        android:id="@+id/text3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="40dp"
        android:textStyle="bold"
        android:text="10 sec Toast" />
    
    <Button
        android:id="@+id/text4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="40dp"
        android:textStyle="bold"
        android:text="10 sec counting Toast" />

</LinearLayout>

Nov 20, 2014

Introduction to Android Auto


Timothy Jordan Introduces Android Auto. Android Auto brings the Android platform to the car in a way that's optimized for the driving experience. It's the same Google platform you already use for phones, tablets, televisions, watches, and more. In fact, all these experiences will often be in the same APK. But now, your app can also extend to the car in a way that's safer and more efficient for the driver. So drivers can stay connected with their hands on the wheel and their eyes on the road.

Using Android Auto is easy. Users go to the Google Play store and download apps that support Android Auto onto their phone.. When they connect their phone to the car, the phone goes into car mode and casts the Android Auto experience to the car's screen. This means that although all the apps and services are actually running on the phone, they're displayed in the car's dash. Users interact with them using the vehicle's controls such as a built-in touchscreen and microphone.

Infolinks In Text Ads