package example.com.androidprocessors;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
int availableProcessors = Runtime.getRuntime().availableProcessors();
Toast.makeText(MainActivity.this,
"Available Processors: " + availableProcessors,
Toast.LENGTH_LONG).show();
}
}
Friday, March 4, 2016
Get the number of processor cores available to the VM
The method Runtime.availableProcessors() returns the number of processor cores available to the VM, at least 1. Traditionally this returned the number currently online, but many mobile devices are able to take unused cores offline to save power, so releases newer than Android 4.2 (Jelly Bean) return the maximum number of cores that could be made available if there were no power or heat constraints.
Saturday, January 16, 2016
Android Textual Layout (Android Dev Summit 2015)
Recent versions of Android have significant advances in typographic sophistication, including automatic hyphenation, balanced and optimized paragraph layout, OpenType features, support for dozens of scripts around the world, and more. Raph Levien, software engineer and tech lead of Android Text on the Android UI Toolkit team, covers these capabilities and how apps can make best use of them.
View presentation slides here: https://speakerdeck.com/raphlinus/android-textual-layout
Monday, November 23, 2015
What’s New in Android Studio 1.5
Android Studio 1.5 is focused on delivering more stability, with most of the enhancements being made under the hood. It adds new lint checks, the ability to use short names when code-completing custom views, and the memory profiler can now help you detect some of the most commonly known causes of leaked activities.
Android Studio 1.5 is now available to download from the stable release channel.
Find out more from Android Developers Blog: http://goo.gl/oIbJHO
Android Studio 1.5 is now available to download from the stable release channel.
Find out more from Android Developers Blog: http://goo.gl/oIbJHO
Monday, November 9, 2015
What is Cardboard
What is Cardboard and Virtual Reality. This video introduces Cardboard for developers and how to use a phone and a simple box of Cardboard to tap into a new type of immersion with virtual reality.
Watch more episodes of Cardboard here:
https://goo.gl/IAoGGs
Cardboard: How Cardboard Works
Watch more episodes of Cardboard here:
https://goo.gl/IAoGGs
Cardboard: How Cardboard Works
Thursday, November 5, 2015
Google Play services 8.3
Google Play services 8.3 is now out enabling you to build better apps with new functionality for: Sign In, Fused Location Provider, App Invites, and the Wearable Data Layer APIs.
Android and Android Studio: Getting Started
Learn how to get started with Android and Android Studio in this short tutorial. It demontrates how to install Android Studio (Google’s official Android IDE) and create your first Android app. You’ll learn how to download the Java SDK, download and install Android Studio, create a new “Hello World” project, and run your app on an emulator and real Android device.
You’ll also learn a series of Protips from an Android app startup as they go through the process of developing their app in a highly stressful environment. With over 1 billion Android devices already activated, Android represents an incredible opportunity for developers. Installing Android Studio is your first step!
Download the Java Development Kit: http://goo.gl/zXjC
Download Android Studio: http://goo.gl/2qpr
Android USB Drivers for Windows: http://goo.gl/91Y8C
Once you’ve installed Android Studio, learn more about developing Android Apps using these resources:
Android Developer Documentation: http://goo.gl/km7ab
Developing Android Apps Udacity Online Training: https://goo.gl/u1pxZv
Android Design for Developers Udacity Online Training: https://goo.gl/7W2S28
Check out more music from the composer: www.terramonk.com
Thursday, October 15, 2015
Interactive flip ImageView using ObjectAnimator
User touch on buttons to flip the ImageView forward/backward alternatively, around X-axis and Y-axis.
package com.example.androidflipview;
import android.animation.ObjectAnimator;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
public class MainActivity extends AppCompatActivity {
Button buttonFlipX, buttonFlipY;
ImageView imageView;
boolean dirX = true;
boolean dirY = true;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
imageView = (ImageView)findViewById(R.id.image);
buttonFlipX = (Button)findViewById(R.id.buttonflipX);
buttonFlipY = (Button)findViewById(R.id.buttonflipY);
buttonFlipX.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
if(dirX){
dirX = false;
buttonFlipX.setText("Flip X Backward");
ObjectAnimator flip = ObjectAnimator.ofFloat(imageView, "rotationX", 0f, 180f);
flip.setDuration(500);
flip.start();
}else{
dirX = true;
buttonFlipX.setText("Flip X Forward");
ObjectAnimator flip = ObjectAnimator.ofFloat(imageView, "rotationX", 180f, 0f);
flip.setDuration(1000);
flip.start();
}
}
});
buttonFlipY.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
if(dirY){
dirY = false;
buttonFlipY.setText("Flip Y Backward");
ObjectAnimator flip = ObjectAnimator.ofFloat(imageView, "rotationY", 0f, 180f);
flip.setDuration(2000);
flip.start();
}else{
dirY = true;
buttonFlipY.setText("Flip Y Forward");
ObjectAnimator flip = ObjectAnimator.ofFloat(imageView, "rotationY", 180f, 0f);
flip.setDuration(3000);
flip.start();
}
}
});
}
}
<?xml version="1.0" encoding="utf-8"?>
<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"
tools:context=".MainActivity">
a
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="android-coding.blogspot.com"
android:textSize="28dp"
android:textStyle="bold" />
<Button
android:id="@+id/buttonflipX"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Flip X Forward" />
<Button
android:id="@+id/buttonflipY"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Flip Y Forward" />
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@mipmap/ic_launcher" />
</LinearLayout>
Subscribe to:
Posts (Atom)