Create share and manage custom maps from Drive



Whether you’re planning your next event, mapping out the best route to visit clients, or sharing the location of your food truck with fans, Google My Maps makes it easy to put your world on a custom map. Starting today, you can access My Maps right from Google Drive on your Google Apps account, so it’s even easier to create, find and share your custom maps. Here are some examples:
Jessica owns a food truck and every Thursday she decides her location based on fan votes. She creates a Google Form and posts it online, gathers votes and can lay them all out on one map to find the most popular location.
Shannon is gearing up for her company’s annual conference. This year, with the help of Google Apps Script, she created a Drive folder for each attendee with their tickets, event information and a custom map with event details and their hotel.
Martin is the delivery coordinator for a multi-chain electronics store. He creates My Maps laying out the most efficient routes for all the deliveries. He drops each map into his team’s shared Drive folder, so each driver can access everything they need, from maps to delivery lists, all in one place. Once Martin assigns routes, drivers can use any device to simply search the folder for the right map.
My Maps is also helpful in the classroom to teach kids about explorers like Lewis and Clark, and to plan out your weekend hike. Whatever your needs, Google My Maps—now accessible in Google Drive—makes getting things done that much easier.
Read More..

Episode 36 UX Rules


In this episode, we talk with Rachel Garb from the Android User Experience team. Tune in to hear about interaction design and about how the Android system UI (including the new volume slider UI in Android M) is designed and user-tested.









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

Relevant Links

Material Design Spec
Android Design for Success (Google I/O 2012)
Dont Make Me Think (Steve Krug)
The Inmates are Running the Asylum (Alan Cooper)

Rachel: google.com/+RachelGarb, medium.com/@rachelgarb, @rachelgarb
Tor: google.com/+TorNorbye, @tornorbye
Chet: google.com/+ChetHaase, @chethaase
Read More..

2015 is The Year of Your Launch

Posted by Amir Shevat, Google Developers Launchpad Program Manager

With new events, improved courses and an expanded mentorship network - Startup Launch is now Google Developers Launchpad. We’re changing our program name to emphasize how you can use our resources as a launch pad to scale and monetize your app business. Read on to learn about our upcoming events and how you can apply to participate.

Events: Launchpad Week goes global

Launchpad Week, Launchpad’s weeklong in-person bootcamp for early-stage apps, continues to expand, with new 2015 programs planned in Munich, Mexico City, Helsinki, Bogota, and Sydney, to name a few. We’ll also regularly host these events in Tel Aviv, London, Berlin, and Paris.

We kicked off Launchpad Week in Bengaluru, India and Bordeaux, France last month. 32 startups and 80 experts from these communities gathered at Idiom Design Center and Le Node for a week of product, UX, and technology sprints designed to help transform ideas into validated, scalable businesses.

Featured startups from Bengaluru included iReff, an app that helps pre-paid mobile users find the best recharge plan for their specific needs. In Bordeaux, Google Developer Expert David Gageot volunteered as a tech mentor, helping startups “ship early, ship often” through testing and continuous integration.

Events: Google Developers Summits

For later-stage startups, we’re providing some of the best tech experts to help optimize apps for Material Design, Android TV, and Google Cast at two-day Google Developer Summits. At an event in Buenos Aires, Argentina, last week, we had participants such as game developer Etermax, the team behind Trivia Crack. Similar events happened in Kuala Lumpur, Bangkok, and Bengaluru this month, and we’re looking forward to inviting more startups to this program in London, Tokyo, Tel Aviv, and New York in 2015.

Products: Your app, powered by Google

In 2014, we helped over 5,000 developers in 170 countries get their ideas off the ground by providing the infrastructure back-end that allows developers to build incredible products. For example, our program delivered software architecture reviews and Google Cloud Platform credits to help entrepreneurs in the program build businesses that scale with them. Check out how Fansino is using Google Cloud Platform to let artists interact with their fans.

We’ve also expanded our product offer for early-stage startups to include AdWords promotional offers for new accounts. Whatever your monetization plan, we’re making it easy to get started with tools like the new In-app Billing API and instruction from the AdMob team.

Courses: Upskilling you and your app

Starting this month, we’ll offer a virtual curriculum of how Google products can help your startup. We’re kicking things off with new Launchpad Online videos covering Google Analytics - are you observing how your users use your app? How do different promotional channels perform?

The series continues in April 2015 with AdMob products, and will expand with instruction in implementing material design and conducting user research later in the year.

If you can’t wait, we’ve also built courses together with Udacity to take your technical skills to the next level on topics, including Android, Java, Web Fundamentals, and UX.

Apply to get involved

Apply to Google Developers Launchpad program to take advantage of these offers - g.co/launchpad. Here’s to a great launch!

Read More..

SDK setup error a folder failed to be renamed or moved

During updating your Android SDK components from eclipse (running in windows) you may receive the following error message:
a folder failed to be renamed or moved...

the message suggests that you turn of your anti-virus.
I did so but still recieved the error.
I terminated the adb.exe from the processes but still not solved.

the problem is that the update batch is rin from android.bat file inside tools directory. update requires that this folder is renamed temporarily but since Windows 7 locks it the process halts with this error.
so a workaround for this is to copy the tools folder, paste it in te sdk directory, name it tools_temp for example and run android.bat from this directory.

the update shall go smooth, after finishing delete this temp folder and launch eclipse and it will work fine.

note:
after restarting eclipse you may recieve this error
This Android SDK requires Android Developer Toolkit version 10.xxxxxxxxxx the current version is 9.xxxxxxxxxxxxxx.

this is because the ADT plugin needs to be update after updating software components, go to http://developer.android.com/sdk/eclipse-adt.html and follow the instructions and everything will work after this.
Read More..

Learning Material Design

Learning Material Design

Key Features
  • Master the highly acclaimed Material Design paradigm and give your apps and pages the look that everyone is talking about
  • Get a mix of key theoretical concepts combined with enough practical examples to put each theory into practice so you can create elegant material interfaces with Android Studio and Polymer
  • Written by Kyle Mew, successful author with over a decade of mobile and web development experience, this book has both the touch of a developer as well as an experienced writer
Book Description
Googles Material Design language has taken the web development and design worlds by storm. Now available on many more platforms than Android, Material Design uses color, light, and movements to not only generate beautiful interfaces, but to provide intuitive navigation for the user.

Learning Material Design will teach you the fundamental theories of Material Design using code samples to put these theories into practice.

Focusing primarily on Android Studio, youll create mobile interfaces using the most widely used and powerful material components, such as sliding drawers and floating action buttons. Each section will introduce the relevant Java classes and APIs required to implement these components. With the rules regarding structure, layout, iconography, and typography covered, we then move into animation and transition, possibly Material Designs most powerful concept, allowing complex hierarchies to be displayed simply and stylishly.

With all the basic technologies and concepts mastered, the book concludes by showing you how these skills can be applied to other platforms, in particular web apps, using the powerful Polymer library.

What you will learn
  • Implement Material Design on both mobile and web platforms that work on older handsets and browsers
  • Design stylish layouts with the Material Theme
  • Create and manage cards, lists, and grids
  • Design and implement sliding drawers for seamless navigation
  • Coordinate components to work together
  • Animate widgets and create transitions and animation program flow
  • Use Polymer to bring Material Design to your web pages
About the Author
Kyle Mew has been programming since the early eighties and has written for several technology websites. He has also written three radio plays and two other books on Android development.

Table of Contents
  • Getting Started with Material Design
  • Building a Mobile Layout
  • Common Components
  • Sliding Drawers and Navigation
  • Lists, Cards, and Data
  • Animations and Transitions
  • Material on Other Devices
  • Material Web Frameworks
  • The Materialize Framework
  • Material Design Lite


Read More..

Episode 18 Holidaze

In another exciting departure from ancient ADB tradition, Daniel Sandler takes over the podcast in a [mostly] bloodless coup and interviews Chet and Tor. This results in a very varied conversation about tech presentations, Tools (yay Android Studio 1.0!) and easter eggs.

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

Oh, and this is the picture that Dan proposed for Android Studio auto-fix hints. Imagine that popping up when youre trying to get some code written.













Relevant Links:

Big Android BBQ: http://www.bigandroidbbq.com/
Droidcon London: http://uk.droidcon.com/2014/
Devoxx: http://www.devoxx.be/ (recorded talks: https://parleys.com/channel/5459089ce4b030b13206d2ea/presentations)
Speechless: http://speechlesslive.com/
Android Studio: http://developer.android.com/sdk/index.html
Flappy Droid bug: https://code.google.com/p/android/issues/detail?id=79650

Dan: google.com/+DanSandler
Tor: google.com/+TorNorbye
Chet: google.com/+ChetHaase

Read More..

Introducing the Tech Entrepreneur Nanodegree

Posted by Shanea King-Roberson, Program Manager

As a developer, writing your app is important. But even more important is getting it into the hands of users. Ideally millions of users. To that end, you can now learn what it takes to design, validate, prototype, monetize, and market app ideas from the ground up and grow them into a scalable business with the new Tech Entrepreneur Nanodegree.

Designed by Google in partnership with Udacity, the Tech Entrepreneur Nanodegree, takes 4-7 months to complete. We have teamed up with most successful thought leaders in this space to provide students with a unique and battle-tested perspective. You’ll meet Geoffrey Moore, author of “Crossing the Chasm”, Pete Koomen, co-founder of Optimizely; Aaron Harris and Kevin Hale, Partners at Y-Combinator; Nir Eyal, author of the book “Hooked: How to build habit forming products” and co-founder of Product Hunt; Steve Chen, Co-Founder of YouTube, rapid prototyping company InVision and many more.

All of the content that make up this nanodegree is available online for free at udacity.com/google. In addition, Udacity provides paid services, including access to coaches, guidance on your project, help staying on track, career counseling, and a certificate when you complete the nanodegree.




The Tech Entrepreneur offering will consist of the following courses:

  • Product Design: Learn Google’s Design Sprint methodology, Ideation & Validation, UI/UX design and gathering the right metrics.
  • Prototyping: Experiment with rapid-low and high-fidelity prototyping on mobile and the web using online tools.
  • Monetization: Learn how to monetize your app and how to set up an effective payment funnel.
  • App Marketing: Understand your market, analyze competition, position your product, prepare for launch, acquire customers and learn growth hacks.
  • How to get your startup started: Find out whether you really need venture capital funding, evaluate build vs. buy, and learn simple ways to monitor and maintain your startup business effectively.

Pitch your ideas in front of Venture Capitalists

Upon completion, students will receive a joint certificate from Udacity and Google. The top graduates will also be invited to an exclusive pitch event, where they will have the opportunity to pitch their final product to venture capitalists at Google.

Read More..

Limit EditText to accept signed decimal numbers only in xml and java


layout/activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout


android_layout_width="match_parent"
android_layout_height="match_parent"
android_padding="16dp"
android_orientation="vertical"
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" />

<EditText
android_id="@+id/edittext1"
android_layout_width="match_parent"
android_layout_height="wrap_content"
android_inputType="numberSigned|numberDecimal"/>
<EditText
android_id="@+id/edittext2"
android_layout_width="match_parent"
android_layout_height="wrap_content"/>

</LinearLayout>


MainActivity.java
package com.blogspot.android_er.androiddecimalnumberedittext;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.InputType;
import android.widget.EditText;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

EditText editText1 = (EditText)findViewById(R.id.edittext1);
EditText editText2 = (EditText)findViewById(R.id.edittext2);
editText2.setInputType(InputType.TYPE_CLASS_NUMBER
| InputType.TYPE_NUMBER_FLAG_DECIMAL
| InputType.TYPE_NUMBER_FLAG_SIGNED);
}
}

Read More..

Parsing JSON respone


if we have a JSON web service response like this:
"persons"
[
{
"person"{
"firstName": "John",
"lastName": "Smith",
"age": 25
}
}
{
"person"{
"firstName": "Catherine",
"lastName": "Jones",
"age": 35
}
}
]
this response is a JSON Array with the name "persons", this array consists of "person" JSON Objects.
to parse such a reponse:
public ArrayList<Person> getMessage(String response){
JSONObject jsonResponse;
ArrayList<Person> arrPersons=new ArrayList<Person>;
try {
// obtain the reponse
jsonResponse = new JSONObject(response);
// get the array
JSONArray persons=jsonResponse.optJSONArray("persons");
// iterate over the array and retrieve single person instances
for(int i=0;i<persons.length();i++){
// get person object
JSONObject person=persons.getJSONObject(i);
// get first name
String firstname=person.optString("firstname");
// get last name
String lastname=person.optString("lastname");
// get the age
int age=person.optInt("age");

// construct the object and add it to the arraylist
Person p=new Person();
p.firstName=firstname;
p.lastName=lastname;
p.age=age;
arrPersons.add(p);
}

} catch (JSONException e) {

e.printStackTrace();
}

return arrPersons;
}

notice that we used the methods optJSONArray,optString,optInt instead of using getString,getInt because the opt methods return empty strings or zero integers if no elements are found. while the get methods throw an exception if the element is not found.
Read More..

Table of contents

Table of Contents:
  1. Android Fundamentals - Jargon Explained
  2. Preliminary Step: Eclipse set up / Create Android Project
  3. Android Explicit Intent Example
  4. Android Implicit Intent Example
  5. Invoking Android Pre-packaged Applications
  6. Fetching a result from a called activity
  7. Android Notifications Example
  8. Android Local Service Example
  9. Android Service and Notification Combined Example
  10. Android Remote Service Example
  11. Android Content Provider Example
  12. Android Broadcast Receiver Example
  13. Android SQLite DB Example
  14. Shared Preferences on Android
  15. Google Maps on Android
  16. Location Manager on Android
  17. Simple List View
  18. Custom List View
  19. Android Threads and Handlers
  20. Http Connection Using Threads
  21. Date Time Picker Views
  22. Auto Complete Text View
  23. Spinner View
  24. Gallery View
  25. Image Switcher View
  26. Creating Android UI Programmatically
  27. Android UI - Inflate from XML (Dynamic UI Creation)
  28. ListView of Data from SQLiteDatabase
  29. TabLayout or Tabbed View
  30. Options Menu
  31. Context Menu
  32. New Contacts Content Provider
    Titbits
    1. Simulating an incoming call on the Emulator
    2. Obtain Google Maps API Key
    3. Simulate Location Change in Android Emulator
    4. Updating to Android SDK 2.1
    5. Delete / Remove Applications deployed on the Android Emulator
    6. Disable Chinese / Japanese Characters on Emulator Keyboard
    7. Android Eclipse link Error - New Project
    All Sample code at One place / Alternate Download site for Code
    https://sites.google.com/site/saigeethamn/home/android-tutorial-code-for-download
    Read More..

    One year in and just getting started



    What’s in a name? Last September, when we changed our name from Google Enterprise to Google for Work, it wasn’t just about what we call ourselves – it was about what we stand for. We want to build great products that help you with every aspect of your life  including work (where many waking hours are spent).

    Enterprise is old business. We believe in a new way of working with collaboration at the core. A world where we work how we choose. Where getting stuff done in the office doesn’t feel like traveling back in time. Where our work tools are just as good or even better than the ones we have in our personal lives.

    We bring the best of Google to work. The same cloud computing infrastructure that we use to run our search engine; powerful apps and services to help you get work done  fast; simple, secure platforms to access everything, wherever you are.

    While we have much more in store, it’s been a busy year and we’ve hit some great milestones over the last twelve months:

    • More than one million paying organizations are actively using Google Drive, including companies like The New York Times, Uber, Fossil, Wedding Wire and BBVA.
    • Google Apps for Work is proving to be the next generation tool of choice: according to a Better Cloud study, Millennials (aged 18-34) are 55% more likely to use Google Apps than alternatives. It’s cost effective, too: Forrester Research’s Total Economic Impact calculator shows that companies using Google Apps see a 304 percent return on investment.
    • We’ve introduced groundbreaking new services with Google Cloud Platform, such as Nearline and Cloud Bigtable for storage and Kubernetes, an open-source container orchestration system. In total, we’ve added over 30 products to our stack, and our online community has nearly doubled.
    • Chromebooks are now the best-selling device in the US for K-12 education, according to a report from IDC.
    • More than 10,000 companies are testing, trialling and using Android for Work following its launch in February. In July, we added carriers such as AT&T and Verizon to our partner program and introduced a new class of devices for regulated industries, like the Blackphone by Silent Circle and Samsungs KNOX devices.

    And the best is yet to come. Cloud computing will continue to get more powerful, and we’re only at the beginning of what machine learning can do to help businesses and people contextualize data.

    Imagine an even smarter digital assistant that can surface the information you need at just the right time and help you manage your schedule for stress-free productivity. Virtual reality products, such as Expeditions, are going to help us learn and work in exciting new ways. And finally, more and more of the objects around us will connect to the internet, enabling more efficient information transfer and actionable data for businesses than ever. These advances will affect all aspects of our lives, including work, and the possibilities are great. We’ll keep our focus forward, so that wherever we’re going, we’re always embarking on what’s next.
    Read More..

    Service Oriented Architecture

    Hi,

    I am an Architect in the Software Industry. I know the need for such a role is hotly debated one. But for now, I can do with such a designation.

    Service Oriented Architecture is a buzz-word since almost 3-4 years now. I believe that it has not caught up as fast as it promised to. However, there is definitely benefits that can be derived out of its implementation (if done right) across large enterprises.

    My opinion on this is that it is almost a sure failure, if it is taken up in a big bang way for implementation. It has to be planned and taken up in phases with calculated but less risky applicaitons initially. Once the technical success of it is ascertained, the applications of business value need to be taken up to move towards this architecture.

    Though lot is said about this in various forums, I am yet to hear anyone say confidently that much of their enterprise has taken to SOA.

    Anyones thoughts on this?
    Do you think Business critical applications should be taken up to prove the business value to the enterprise for a pilot phase or less critical applications should be piloted, to absorb and risk of failure?
    Read More..

    Episode 34 Really Nearby

    In this episode, we chat with Andrew Bunner and Akshay Kannan from the Nearby team. Nearby is a technology that allows devices that are, er, nearby to communicate in one of several ways (including ultrasonic frequencies, which is just kind of awesome).

    Favorite bits: "beeps and boops" (a technical term), "acoustical chamber" (sounds a lot cooler than it probably is), and the three most important things about Nearby: proximity, proximity, proximity.

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

    Nearby Product Overview

    Andrew: google.com/+AndrewBunner
    Akshay: google.com/+AkshayKannan
    Tor: google.com/+TorNorbye
    Chet: google.com/+ChetHaase
    Read More..

    Get ready for even more material design

    Posted by Monica Bagagem, Developer Marketing

    Google I/O 2015 starts tomorrow, and, like last year, we’ve got an exciting lineup of design-focused content for both developers and designers to experience in-person and online. Just a year ago, we announced material design - a system for cross-platform visual, motion, and interaction design. This year at I/O, we’ll see how material has been adopted and implemented by the community, and our approach on design across our platforms.

    Sessions

    At 4PM PDT on Thursday, May 28, join Matias Duarte’s “Material Now” session to recap where we’ve been and get a sneak peek of where we’re going with design at Google. We’ll be recognizing some of the phenomenal material design work from across the community, so definitely tune in if you’re an Android developer or designer. For more details, check Matias’ post on Google+.

    The session will be live streamed so you can follow along in real-time even if you’re not at Moscone. Recordings will also be available shortly after on the I/O website.

    Add Design Sessions to your I/O schedule

    Design Sandbox

    We’ve dedicated an entire section of Moscone West to design-related programming, including one-on-one and group UX reviews with members of the material design team. Appointments will be on a first-come, first-serve basis, but well also have Google designers on hand for more casual questions.

    Add Material Design Reviews to your I/O schedule

    Sandbox Talks

    Google designers and engineers will host several deep-dive, 20 minute tech talks in a breakout area within the Design Sandbox on Level 2. The space has been designed to facilitate conversation and discussion with small audiences, so come prepared with questions! We’ll be covering a range of topics such as cross-platform and responsive design, designing for platforms like Google Cast and Android Auto, and how to adapt material design to your brand. As an added bonus, most Sandbox Talks will take place twice throughout the conference giving you more flexibility to adjust your schedule.

    Add Design Sandbox Talks to your I/O schedule

    Explore the full Google I/O schedule here.

    Be sure to follow +GoogleDesign and @GoogleDesign, where we’ll be posting design-related announcements throughout the conference. You can also follow and join the general conversation about I/O at #io15. See you tomorrow!

    Read More..

    Gallery like RecyclerView CardView example


    A long long time ago, we have android.widget.Gallery to shows items (ex. photos) in a center-locked, horizontally scrolling list. My example "Implement Android Gallery widget". But it deprecated and no longer supported.

    So in long time ago at 2012, I have another example to "Implement Gallery-like HorizontalScrollView".

    Now, with RecyclerView and CardView, its another example to implement Gallery-like RecyclerView + CardView. It display files in ExternalStorageDirectoryPath + "/test/" folder.
    (If you want to load from other user selectable folder, refer "Intent.ACTION_OPEN_DOCUMENT (from API level 19) to load images in RecyclerView + CardView".)


    To use RecyclerView + CardView, we have to "Add Support Libraries of RecyclerView, CardView to Android Studio Project".

    Create our RecyclerView.Adapter, MyRecyclerViewAdapter.java
    package com.blogspot.android_er.androidgallery;

    import android.content.Context;
    import android.graphics.Bitmap;
    import android.graphics.BitmapFactory;
    import android.net.Uri;
    import android.support.v7.widget.CardView;
    import android.support.v7.widget.RecyclerView;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.view.ViewGroup;
    import android.widget.ImageView;

    import java.io.FileNotFoundException;
    import java.util.ArrayList;
    import java.util.List;

    public class MyRecyclerViewAdapter extends RecyclerView.Adapter<MyRecyclerViewAdapter.ItemHolder>{

    private List<Uri> itemsUri;
    private LayoutInflater layoutInflater;
    private Context context;
    private OnItemClickListener onItemClickListener;
    MainActivity mainActivity;

    public MyRecyclerViewAdapter(Context context, MainActivity mainActivity){
    this.context = context;
    layoutInflater = LayoutInflater.from(context);
    itemsUri = new ArrayList<Uri>();

    this.mainActivity = mainActivity;
    }

    @Override
    public MyRecyclerViewAdapter.ItemHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    CardView itemCardView = (CardView)layoutInflater.inflate(R.layout.layout_cardview, parent, false);
    return new ItemHolder(itemCardView, this);
    }

    @Override
    public void onBindViewHolder(MyRecyclerViewAdapter.ItemHolder holder, int position) {
    Uri targetUri = itemsUri.get(position);
    holder.setItemUri(targetUri.getPath());

    if (targetUri != null){

    try {
    //! CAUTION !
    //Im not sure is it properly to load bitmap here!
    holder.setImageView(loadScaledBitmap(targetUri));
    } catch (FileNotFoundException e) {
    e.printStackTrace();
    }
    }
    }

    /*
    reference:
    Load scaled bitmap
    http://android-er.blogspot.com/2013/08/load-scaled-bitmap.html
    */
    private Bitmap loadScaledBitmap(Uri src) throws FileNotFoundException {

    //display the file to be loadScaledBitmap(),
    //such that you can know how much work on it.
    mainActivity.textInfo.append(src.getLastPathSegment() + " ");

    // required max width/height
    final int REQ_WIDTH = 150;
    final int REQ_HEIGHT = 150;

    Bitmap bm = null;

    // First decode with inJustDecodeBounds=true to check dimensions
    final BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;
    BitmapFactory.decodeStream(context.getContentResolver().openInputStream(src),
    null, options);

    // Calculate inSampleSize
    options.inSampleSize = calculateInSampleSize(options, REQ_WIDTH,
    REQ_HEIGHT);

    // Decode bitmap with inSampleSize set
    options.inJustDecodeBounds = false;
    bm = BitmapFactory.decodeStream(
    context.getContentResolver().openInputStream(src), null, options);

    return bm;
    }

    public int calculateInSampleSize(BitmapFactory.Options options,
    int reqWidth, int reqHeight) {
    // Raw height and width of image
    final int height = options.outHeight;
    final int width = options.outWidth;
    int inSampleSize = 1;

    if (height > reqHeight || width > reqWidth) {

    // Calculate ratios of height and width to requested height and
    // width
    final int heightRatio = Math.round((float) height
    / (float) reqHeight);
    final int widthRatio = Math.round((float) width / (float) reqWidth);

    // Choose the smallest ratio as inSampleSize value, this will
    // guarantee
    // a final image with both dimensions larger than or equal to the
    // requested height and width.
    inSampleSize = heightRatio < widthRatio ? heightRatio : widthRatio;
    }

    return inSampleSize;
    }

    @Override
    public int getItemCount() {
    return itemsUri.size();
    }

    public void setOnItemClickListener(OnItemClickListener listener){
    onItemClickListener = listener;
    }

    public OnItemClickListener getOnItemClickListener(){
    return onItemClickListener;
    }

    public interface OnItemClickListener{
    public void onItemClick(ItemHolder item, int position);
    }

    public void add(int location, Uri iUri){
    itemsUri.add(location, iUri);
    notifyItemInserted(location);
    }

    public void clearAll(){
    int itemCount = itemsUri.size();

    if(itemCount>0){
    itemsUri.clear();
    notifyItemRangeRemoved(0, itemCount);
    }
    }


    public static class ItemHolder extends RecyclerView.ViewHolder implements View.OnClickListener{

    private MyRecyclerViewAdapter parent;
    private CardView cardView;
    ImageView imageView;
    String itemUri;

    public ItemHolder(CardView cardView, MyRecyclerViewAdapter parent) {
    super(cardView);
    itemView.setOnClickListener(this);
    this.cardView = cardView;
    this.parent = parent;
    imageView = (ImageView) cardView.findViewById(R.id.item_image);
    }

    public void setItemUri(String itemUri){
    this.itemUri = itemUri;
    }

    public String getItemUri(){
    return itemUri;
    }

    public void setImageView(Bitmap bitmap){
    imageView.setImageBitmap(bitmap);
    }

    @Override
    public void onClick(View v) {
    final OnItemClickListener listener = parent.getOnItemClickListener();
    if(listener != null){
    listener.onItemClick(this, getLayoutPosition());
    //or use
    //listener.onItemClick(this, getAdapterPosition());
    }
    }
    }
    }


    layout/layout_cardview.xml
    <?xml version="1.0" encoding="utf-8"?>
    <android.support.v7.widget.CardView


    android_layout_width="match_parent"
    android_layout_height="wrap_content"
    android_layout_margin="10dp"
    card_view_cardCornerRadius="5sp"
    card_view_cardElevation="5sp">

    <LinearLayout
    android_layout_width="match_parent"
    android_layout_height="wrap_content"
    android_orientation="vertical">

    <ImageView
    android_id="@+id/item_image"
    android_layout_width="wrap_content"
    android_layout_height="wrap_content" />

    </LinearLayout>
    </android.support.v7.widget.CardView>


    MainActivity.java
    package com.blogspot.android_er.androidgallery;

    import android.net.Uri;
    import android.os.Bundle;
    import android.os.Environment;
    import android.support.v7.app.AppCompatActivity;
    import android.support.v7.widget.LinearLayoutManager;
    import android.support.v7.widget.RecyclerView;
    import android.text.method.ScrollingMovementMethod;
    import android.widget.TextView;
    import android.widget.Toast;

    import java.io.File;

    public class MainActivity extends AppCompatActivity
    implements MyRecyclerViewAdapter.OnItemClickListener{

    private RecyclerView myRecyclerView;
    private MyRecyclerViewAdapter myRecyclerViewAdapter;
    private LinearLayoutManager linearLayoutManager;

    TextView textInfo;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    textInfo = (TextView)findViewById(R.id.info);
    textInfo.setMovementMethod(new ScrollingMovementMethod());

    myRecyclerView = (RecyclerView)findViewById(R.id.myrecyclerview);
    linearLayoutManager =
    new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
    myRecyclerViewAdapter = new MyRecyclerViewAdapter(this, this);
    myRecyclerViewAdapter.setOnItemClickListener(this);
    myRecyclerView.setAdapter(myRecyclerViewAdapter);
    myRecyclerView.setLayoutManager(linearLayoutManager);

    prepareGallery();
    }

    private void prepareGallery(){
    String ExternalStorageDirectoryPath = Environment
    .getExternalStorageDirectory()
    .getAbsolutePath();
    String targetPath = ExternalStorageDirectoryPath + "/test/";

    Toast.makeText(getApplicationContext(), targetPath, Toast.LENGTH_LONG).show();
    File targetDirector = new File(targetPath);

    File[] files = targetDirector.listFiles();
    for (File file : files){
    Uri uri = Uri.fromFile(file);
    myRecyclerViewAdapter.add(
    myRecyclerViewAdapter.getItemCount(),
    uri);
    }
    }

    @Override
    public void onItemClick(MyRecyclerViewAdapter.ItemHolder item, int position) {

    String stringitemUri = item.getItemUri();
    Toast.makeText(MainActivity.this, stringitemUri, Toast.LENGTH_SHORT).show();
    }
    }


    layout/activity_main.xml
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout

    android_layout_width="match_parent"
    android_layout_height="match_parent"
    android_orientation="vertical"
    android_padding="16dp"
    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" />

    <android.support.v7.widget.RecyclerView
    android_id="@+id/myrecyclerview"
    android_layout_width="match_parent"
    android_layout_height="170dp" />

    <TextView
    android_id="@+id/info"
    android_layout_width="match_parent"
    android_layout_height="wrap_content"
    android_typeface="monospace"
    android_gravity="bottom"/>

    </LinearLayout>


    To read diles in ExternalStorage, uses-permission of "android.permission.READ_EXTERNAL_STORAGE" is needed in AndroidManifest.xml.

    download filesDownload the files (Android Studio Format) .

    Next:
    - RecyclerView + CardView example: with Button

    ~ More example of RecyclerView + CardView.


    Read More..

    Display WiFi Hotspot clients by cat proc net arp

    This example display WiFi Hotspot connected clients (with IP and MAC address) by Linux command "cat /proc/net/arp", using ProcessBuilder.

    (You can download runnable APK from link on bottom)

    Tethering OFF, as WiFi client.

    Tethering ON, with no client connected.

    Tethering ON, with two clients connected; Nexus 7 and Raspberry Pi + WiFi dongle.

    But, after any client disconnected, the /proc/net/arp will not updated immediately; I dont know how long it will refresh. One way to update arp is turn OFF and ON tethering again.

    Tested on unrooted Xiaomi Redmi 2 running Android 4.4.4.

    MainActivity.java
    package com.blogspot.android_er.androidlistclient;

    import android.os.Bundle;
    import android.support.v7.app.AppCompatActivity;
    import android.view.View;
    import android.widget.Button;
    import android.widget.TextView;

    import java.io.IOException;
    import java.io.InputStream;

    public class MainActivity extends AppCompatActivity {

    Button btnRead;
    TextView textResult;

    //String[] args = {"/system/bin/cat", "/proc/net/arp"};
    String[] args = {"cat", "/proc/net/arp"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    btnRead = (Button)findViewById(R.id.readclient);
    textResult = (TextView)findViewById(R.id.result);

    btnRead.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
    textResult.setText(toRead());
    }
    });
    }

    private String toRead()
    {
    ProcessBuilder cmd;
    String result="";

    try{
    cmd = new ProcessBuilder(args);

    Process process = cmd.start();
    InputStream in = process.getInputStream();
    byte[] re = new byte[1024];
    while(in.read(re) != -1){
    System.out.println(new String(re));
    result = result + new String(re);
    }
    in.close();
    } catch(IOException ex){
    ex.printStackTrace();
    }
    return result;
    }
    }


    layout/activity_main.xml
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout

    android_layout_width="match_parent"
    android_layout_height="match_parent"
    android_padding="16dp"
    android_orientation="vertical"
    tools_context="com.blogspot.android_er.androidlistclient.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_id="@+id/readclient"
    android_layout_width="match_parent"
    android_layout_height="wrap_content"
    android_textAllCaps="false"
    android_text="Read /proc/net/arp"/>

    <TextView
    android_id="@+id/result"
    android_layout_width="match_parent"
    android_layout_height="wrap_content"
    android_typeface="monospace"
    android_textSize="12sp"/>
    </LinearLayout>


    download filesDownload runnable APK .

    This example display arp in human readable format, but not for machine. Next post "Retrieve IP and MAC addresses from /proc/net/arp" get it in more machine readable.

    Read More..

    Implementing Search activities

    Most Android phones have a search button. this button is used to search contacts,applications or anything on the phone. We can make use of the search functionality in our apps.

    In this post were going to see how to implement search functionality to search for entries stored in a databaseand display them in a ListView.

    Creating database:
    our database has two tables: Countries and Names:
    public class DBHelper extends SQLiteOpenHelper {

    public DBHelper(Context context) {
    super(context, "DemoDB", null, 1);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
    StringBuilder builder=new StringBuilder();
    // countries table
    builder.append("CREATE TABLE Countries ");
    builder.append("(_id INTEGER PRIMARY KEY AUTOINCREMENT,");
    builder.append("NAME TEXT) ");
    db.execSQL(builder.toString());
    // Names table
    // Virtual table for full text search
    builder.setLength(0);
    builder.append("CREATE VIRTUAL TABLE NAMES USING FTS3");
    builder.append("(");
    builder.append("name TEXT) ");
    db.execSQL(builder.toString());
    builder=new StringBuilder();

    //dummy data
    InsertData(db);

    }

    void InsertData(SQLiteDatabase db)
    {
    ContentValues cv=new ContentValues();
    cv.put("NAME","USA");
    db.insert("Countries", "NAME", cv);
    cv.put("NAME","UK");
    db.insert("Countries", "NAME", cv);
    cv.put("NAME","Spain");
    db.insert("Countries", "NAME", cv);
    cv.put("NAME","ITALY");
    db.insert("Countries", "NAME", cv);
    cv.put("NAME","Germany");
    db.insert("Countries", "NAME", cv);

    cv=new ContentValues();
    cv.put("name","John");
    db.insert("NAMES", "name", cv);
    cv.put("name","Jack");
    db.insert("NAMES", "name", cv);
    cv.put("name","Ann");
    db.insert("NAMES", "name", cv);
    cv.put("name","Adam");
    db.insert("NAMES", "name", cv);
    cv.put("name","Sarah");
    db.insert("NAMES", "name", cv);

    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    // TODO Auto-generated method stub

    }
    }
    notice that the Names table is a VIRTUAL table. we created it as virtual to make use of Full Text Search (FTS3) feature in SQLite. this feature makes queries faster than that in regular tables.
    then we add two functions to retrieve all rows from both tables:
    /**
    * Return all countries
    * @return
    */
    public ArrayListgetCountries(){
    ArrayList countries=new ArrayList();
    SQLiteDatabase db=this.getReadableDatabase();
    Cursor c=db.rawQuery("select * from Countries", null);
    while(c.moveToNext()){
    String country=c.getString(1);
    countries.add(country);
    }
    c.close();
    return countries;
    }
    /**
    * Return all names
    * @return
    */

    public ArrayListgetNames(){
    ArrayList names=new ArrayList();
    Cursor c=this.getReadableDatabase().rawQuery("select * FROM Names", null);
    while(c.moveToNext()){
    String name=c.getString(0);
    names.add(name);
    }
    c.close();
    return names;
    }
    and another two functions to retrieve data based on a search string:
    /**
    * Return all countries based on a search string
    * @return
    */
    public ArrayListgetCountriesSearch(String query){
    ArrayList countries=new ArrayList();
    SQLiteDatabase db=this.getReadableDatabase();
    Cursor c=db.rawQuery("select * from Countries where NAME LIKE %"+query+"%", null);
    while(c.moveToNext()){
    String country=c.getString(1);
    countries.add(country);
    }
    c.close();
    return countries;
    }
    /**
    * Return all names based on a search string
    * we use the MATCH keyword to make use of the full text search
    * @return
    */
    public ArrayListgetNamesSearch(String query){
    ArrayList names=new ArrayList();
    Cursor c=this.getReadableDatabase().rawQuery("select * FROM Names WHERE name MATCH "+query+"", null);
    while(c.moveToNext()){
    String name=c.getString(0);
    names.add(name);
    }
    c.close();
    return names;
    }

    Implementing The activity:
    then we will create our activity that has a list view like this:
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
    android_orientation="vertical"
    android_layout_width="fill_parent"
    android_layout_height="fill_parent"
    >
    <ListView
    android:layout_width="fill_parent"
    android_layout_height="fill_parent"
    android_id="@+id/list"/>
    </LinearLayout>

    we load data from database like this:
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    list=(ListView)findViewById(R.id.list);

    DBHelper helper=new DBHelper(this);
    ArrayList items=helper.getNames();
    ArrayAdapter adapter=new ArrayAdapter(this, android.R.layout.simple_list_item_1,items);
    list.setAdapter(adapter);
    }

    Handling the search dialog:
    In order to handle the search dialog ourselves we need to create a xml file with search configurations such as the search dialog title, voice search capabilities, content provider for auto complete and so on. we create a file with the name searchable.xml in res/xmldirectory:
    <?xml version="1.0" encoding="utf-8"?>
    <searchable
    android_label="@string/app_name"
    android_hint="@string/hint" >
    </searchable>
    the android:hint attribute denotes a string that acts as a water mark on the search text box.
    then we need to add an Intent Filter in out apps AndroidManifest.xml file to our activity to handle the search dialog:
    <activity android_name=".MainActivty"
    android_label="@string/app_name">
    <intent-filter>
    <action android_name="android.intent.action.MAIN" />
    <category android_name="android.intent.category.LAUNCHER" />
    </intent-filter>
    <intent-filter>
    <action android_name="android.intent.action.SEARCH" />
    </intent-filter>
    <meta-data android_name="android.app.searchable"
    android_resource="@xml/searchable"/>
    </activity>

    Understanding the Search process:

    when you press the search button, type some text and click on search the activits onSearchRequested() function is called, then an Intent with the action Intent.ACTION_SEARCH is created and you activity is re-created with this intent.

    the search intent has you search string as a string extra with the name SearchManager.QUERY. also it can carry a bundle of other extras with the name SearchManager.APP_DATA.

    what if the device doesnt have a Search button:
    not all Android devices have a search button, so we can start the search dialog manually by calling the activitys onSearchRequested() from a button or a menu item:
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
    menu.add("Search").setOnMenuItemClickListener(new OnMenuItemClickListener() {

    @Override
    public boolean onMenuItemClick(MenuItem item) {
    //launch the search dialog
    onSearchRequested();
    return true;
    }
    });
    return true;
    }

    Adding extras to the search dialog:
    we can pass some extra data as a bundle with our search dialog or an initial search string by overriding the activitys onSearchRequested():
    @Override
    public boolean onSearchRequested() {
    Bundle bundle=new Bundle();
    bundle.putString("extra", "exttra info");
    // search initial query
    startSearch("Country", false, bundle, false);
    return true;
    }

    Handling the search query:

    we said before that the search query is passed as a String extra when our activity is re-created. so we can handle the searcgh string in our onCreate() like this:
    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    list=(ListView)findViewById(R.id.list);

    DBHelper helper=new DBHelper(this);
    Intent intent=getIntent();
    // if the activity is created from search
    if(intent.getAction().equals(Intent.ACTION_SEARCH)){
    // get search query
    String query=intent.getStringExtra(SearchManager.QUERY);
    ArrayList items=helper.getNamesSearch(query);
    //get extras, just for demonstration
    Bundle bundle=intent.getBundleExtra(SearchManager.APP_DATA);
    String info=bundle.getString("extra");
    Log.v("extra", info);
    //bind the list
    ArrayAdapter adapter=new ArrayAdapter(this, android.R.layout.simple_list_item_1,items);
    list.setAdapter(adapter);
    }
    //activity created normally
    else{
    ArrayList items=helper.getNames();
    ArrayAdapter adapter=new ArrayAdapter(this, android.R.layout.simple_list_item_1,items);
    list.setAdapter(adapter);
    }
    helper.close();
    }


    we just extract the search string and any other extras and perform our search logic based on the search string.
    and thats was all about implementing search
    Read More..

    Introducing new Chromebooks and features engineered for work



    Editors note: To learn more about the new features that make Chromebooks ready for work, join our Chrome product team for a Hangout on Air on Tuesday, September 1st at 10AM PT. 

    Today, Chromebooks are putting on their power suit. Customers like Netflix, Sanmina and Starbucks have adopted Chromebooks for their ease of deployment, security and ability to integrate well with existing technologies, and a recent IDC study of Chromebooks use in K-12 education shows that Chromebooks require 69% less labor to install and 92% less labor to support than other devices. And with today’s announcements, the Chromebook family gets even bigger and better:

    Work-ready devices: Today, the new Dell Chromebook 13 joins the Asus Chromebook Flip and Chromebook Pixel in the Chromebook for Work lineup. Built with a lightweight carbon fiber cover, the laptop comes with a 13.3” FHD IPS touchscreen display, 5th Gen Intel® Core™ processor, magnesium alloy palmrest, backlit keyboard and high-precision glass trackpad. And if you’re often on the road or rushing between meetings, you’ll have the machine power to keep moving, thanks to a 12-hour battery life. Starting at $399 and available for purchase starting September 17th, the Chromebook 13 brings enterprise class performance at an economical price point.


    Plays well with others: Using Microsoft infrastructure? No problem. Single sign-on and support for legacy apps mean Chromebooks can now plug right in with VMWare, Dell vWorkspace, or Citrix’s improved Chrome receiver. Connecting to your files is even easier with Windows File Shares (SMB/CIFS), Box, Dropbox, or OneDrive. Need to print? Printing to local printers with Cloud Print 2.0 or to any existing printer using the improved Cloud Print CUPS connector is simple. With the help of a new API, HP supports over 100m+ printers with the HP Print for Chrome app. And connecting just got more seamless VPN support from Pulse Secure and Dell SonicWall join Cisco AnyConnect on the Chrome Web Store (F5 Networks and Palo Alto Networks coming soon).

    Manage from the beach: Chesterfield School District deployed 14,000 Dell devices in just a few weeks, and manages almost 32,000 devices today. What’s their secret? The Chrome Device Management console, a cloud based management solution with 200+ features that integrates Chrome devices with your infrastructure and helps manage thousands of devices with ease – from users to networks to applications. Weve made enhancements such as domain autocomplete and asset management, making users and IT admins lives easier.

    With so many businesses undergoing transformation, shifting to the cloud and rethinking how mobile and devices play into this transformation, Chrome authorized resellers and SYNNEX corporation are ready to help you.

    Check out our webpage or join us on Tuesday September 1st at 10AM PST for a Hangout on Air to learn more about Chromebooks for Work.
    Read More..

    Playstation Suite SDK referencing DLLs and Intellisense

    An issue I faced today while testing the Playstation Suite SDK, I created a sample project in the PSS Studio and added a reference to a custom made DLL.

    I found that the intellisense (auto completion) of the editor couldnt perceive the newly added DLL, it provided no auto-completion for the classes within the library.

    I got the solution to this from here http://www.gamefromscratch.com/post/2012/04/20/Initial-issues-with-Playstation-Suite-SDK.aspx

    just restart the PSS Studio and everything will work just fine
    Read More..

    Connecting to a web service over a Secure Sockets Layer SSL protocol

    Android default HttpClinet does not support SSL connections, so if you have a secured web service, you need to connect to it via javax.net.ssl.HttpsURLConnection.
    if you want to call a SSL SOAP web service:
    String CallWebService(String url,
    String soapAction,
    String envelope) throws IOException {
    URL address=new URL(url);
    URLConnection connection=address.openConnection();
    HttpsURLConnection post=(HttpsURLConnection)connection;
    post.setDoInput(true);
    post.setDoOutput(true);
    post.setRequestMethod("POST");
    post.setRequestProperty("SOAPAction", soapAction);
    post.setRequestProperty( "Content-type", "text/xml; charset=utf-8" );
    post.setRequestProperty( "Content-Length", String.valueOf(envelope.length()));
    post.setReadTimeout(4000);

    OutputStream outStream=post.getOutputStream();
    Writer out=new OutputStreamWriter(outStream);
    out.write(envelope);
    out.flush();
    out.close();


    InputStream inStream = post.getInputStream();
    BufferedInputStream in = new BufferedInputStream(inStream,4);
    StringBuffer buffer=new StringBuffer();
    // read 4 bytes a time
    byte[] buffArray=new byte[4];
    int c=0;
    while((c=in.read(buffArray))!=-1){
    for(int i=0;i<c;i++)
    buffer.append((char)buffArray[i]);
    }

    return buffer.toString();
    }
    Read More..

    Episode 35 Data Bound

    In this episode, we chat with George Mount and Yigit Boyar from the Android UI Toolkit team. Yigit and George worked on the new Data Binding feature announced at Google I/O and which is available in the preview release and in recent versions of Android Studio.

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

    Relevant Links

    Data Binding Guide

    George Mount: https://plus.google.com/+GeorgeMount007
    Yigit Boyar: https://plus.google.com/111851968937104436377, @yigitboyar
    Tor: google.com/+TorNorbye, @tornorbye
    Chet: google.com/+ChetHaase, @chethaase
    Read More..

    A new kind of Classroom for 10 million students and teachers



    (Cross-posted on the Google for Education Blog.)

    In a junior high class in Queens, New York, Ross Berman is teaching fractions. He wants to know whether his students are getting the key concept, so he posts a question in Google Classroom and instantly reviews their answers. It’s his favorite way to check for understanding before anyone has the chance to fall behind.

    Across the country, in Bakersfield, California, Terri Parker Rodman is waiting at the dentist’s office. She wonders how her class is doing with their sub. With a few swipes on her phone, she finds out which students have finished their in-class assignment and sends a gentle reminder to those who haven’t.
    Google Classroom launched last August, and now more than 10 million educators and students across the globe actively use it to teach and learn together, save time, and stay organized. We worked with teachers and students to create Classroom because they told us they needed a mission control – a central place for creating and tracking assignments, sharing ideas and resources, turning in completed work and exchanging feedback. Classroom is part of Google’s lineup of tools for education, which also includes the Google Apps for Education suite – now used by more than 50 million students, teachers and administrators around the world – and Chromebooks, the best-selling device in U.S. K-12 schools.

    Here are a few of the stories we’ve heard from teachers and students who are using Classroom.

    Learning better together 


    We built Classroom to help educators spend less time on paperwork and administrative tasks. But it’s also proven to be highly effective at bringing students and teachers closer together. In London, fifth grader Kamal Nsudoh-Parish stays connected with his Spanish teacher while he does his homework. “If I don’t understand something, I can ask him and he’d be able to answer rather than having to wait until my next Spanish lesson,” Kamal says.

    Terri, who teaches sixth grade at Old River Elementary School, also observes that Classroom can strengthen ties and improve communication. “When a student doesnt turn something in, I can see how close they are,” she says. “In the past, I couldnt tell why they didnt finish their work. I was grading them on bringing back a piece of paper instead of what their ability was.”

    Resource room teacher Diane Basanese of Black River Middle School in Chester, New Jersey, says that Classroom lets her see her students’ minds at work. “I’m in the moment with them,” she explains. “We have dialogue, like, ‘Oh, are you saying I should use a transition?’ We’re talking to each other. It’s a better way.”


    Removing the mundane 


    By helping them cut down on busywork, Classroom empowers teachers to do even more with every school day. “I no longer waste time figuring out paper jams at the school photocopier,” says Tom Mullaney, who teaches in Efland, North Carolina. “Absent students no longer email or ask, ‘What did we do yesterday?’ These time savers may not sound like much, but they free me to spend time on things that I consider transcendent in my teaching practice.”

    In Mexico City, teachers at Tec de Monterrey high school and university switched to Classroom from an online learning management system that often added complexity to their workflow instead of simplifying it. Professor Vicente Cubells says he’s found the new question feature in Classroom particularly useful for short quizzes, because he can quickly assess learning and have an automatic record of their responses and grades. “The Classroom mobile apps have also become essential for our faculty and students, we use them to stay connected even when we’re not in front of a laptop,” Cubells said.

    Giving teachers superpowers 


    Teachers are some of the most innovative thinkers in the world, so it’s no surprise that they’ve used Classroom in ways we never even imagined.

    Elementary school teacher Christopher Conant of Boise, Idaho, says his students are usually eager to leave school behind during summer break. But after using Classroom last year, they wanted to keep their class open as a way to stay in touch. “Classroom is a tool that keeps kids connected and learning as a community, well beyond the school day, school year and school walls,” said Christopher, who continued to post videos and questions for his students all summer long.

    These endless possibilities are the reason why Diane Basanese, a 30-year teaching veteran, says that Classroom is the tool she’s been looking for throughout her career. “It has made me hungrier,” she explains. “I look at how I can make every lesson a hit-it-out-of-the-ballpark lesson.”

    Growing our Classroom 


    Ever since we began working with teachers and students, its been rewarding and encouraging to hear their stories, collaborate to find answers to their problems, and watch those solutions come to life at schools and universities around the world. Lucky for us, we’re just getting started.
    Read More..

    Raising Sweet C Cane for Well Dressed Animals

    Posted by Stewart Miles, Fun Propulsion Labs*

    To celebrate the holiday season at Fun Propulsion Labs, were trading our sushi mats and baking pans for candy canes and snowballs. Please join us for a special holiday-themed version of Pie Noon and Zooshi! Zooshi and Pie Noon are open source, cross-platform games built from a suite of libraries that eager C++ developers can use to build their own projects.

    You can download and run Zooshis Santa mode on Google Play and find the latest open source release on our GitHub page. The holiday version of Pie Noon is available on Google Play as Snowdown in Santa Tracker and on our GitHub page. Happy Holidays!

    * Fun Propulsion Labs is a team within Google thats dedicated to advancing gaming on Android and other platforms.

    Read More..

    Table layout

    Organizing widgets in a table is a famous approach in HTML design where you construct a table of a number of rows and cells and distribute the controls over the cells to achieve a consistent look for your UI. Android provides a similar technique.


    In android you define the number of rows by your own and android determines the number of cells in each row according to the number of widgets in each row




    <Button
    android_layout_width="wrap_content"
    android_layout_height="wrap_content"
    android_text="Submit"
    />


    You can define a table and add rows and views to it like this:
    TableLayout tl=new TableLayout(this);
    TableRow tr=new TableRow(this);
    Button btn=new Button(this);
    btn.setText("Hello");
    tr.addView(btn);
    tl.addView(tr);
    setContentView(tl);
    This example represents a row with three cells.

    A table cell can span multiple columns like this:




    <Button
    android_layout_width="wrap_content"
    android_layout_height="wrap_content"
    android_text="Submit"
    />




    <Button
    android_layout_width="wrap_content"
    android_layout_height="wrap_content"
    android_text="Cancel"
    />



    Also you can choose which column to put your widget by using android:layout_column property, you define the Zero-based index of the column where you want your widget to be.




    <Button
    android_layout_width="wrap_content"
    android_layout_height="wrap_content"
    android_text="Submit"
    />




    <Button
    android_layout_width="wrap_content"
    android_layout_height="wrap_content"
    android_text="Cancel"
    />



    <Button
    android_layout_width="wrap_content"
    android_layout_height="wrap_content"
    android_text="Help"
    android_layout_column="1"
    />



    Note: if you specify an index greater than the actual cells count, the widget won’t appear. For example in the previous example if android:layout_column had a value greater than 2 the widget wouldn’t appear.

    Table layout also allows you to put widgets directly under the <TableRow> tag to act as a separator between rows.


    These widgets will have their width set to fill_parent.




    <Button
    android_layout_width="wrap_content"
    android_layout_height="wrap_content"
    android_text="Submit"
    />




    <Button
    android_layout_width="wrap_content"
    android_layout_height="wrap_content"
    android_text="Cancel"
    />



    <Button
    android_layout_width="wrap_content"
    android_layout_height="wrap_content"
    android_text="Help"
    android_layout_column="5"
    />

    <Button
    android_layout_width="wrap_content"
    android_layout_height="wrap_content"
    android_text="Separator"
    />


    In table layout each column occupies space equal to the size of the largest widget in it. But you can set the width of any column to take the largest available space, just like setting the width to 100 % in HTML. This is done by setting the property android:stretchColumns to the index of the column, also you can set multiple columns by separating them with a comma.

    Look at the layout below:






    Now we gonna to add android:stretchColumns="0" to the table layout and see what it’s gonna look like:






    Column 0 occupied the largest available space.

    You can set this property from code like this
    TableLayout tl=new TableLayout(this);
    tl.setColumnStretchable(0, true);
    the setColumnStretchable(ColumnIndex, IsStretchable)method parameters are the column index and a Boolean value to indicate it is going to be stretched.

    Now if we have a column that have a large content. Android columns by default do not wrap their content. Look at this layout:






    See column zero occupies large space that column 1 is not visible.

    We can use android:shrinkColumns property to wrap content of a certain column or for multiple columns by assigning column numbers separeted by commas.

    When we use the property with column zero it will be like this:






    Its like using style=”white-space:wrap;” style in HTML
    You can set the property from code like this:
    TableLayout tl=new TableLayout(this);
    tl.setColumnShrinkable(0, true);
    The setColumnShrinkable(columnIndex, isShrinkable) method parameters are the column index and a Boolean to indicate it si going to be shrinked.

    Finally if you want to make some columns invisible you can use the property android:collapseColumns the same way we used the last two properties






    See that column zero is invisible.
    You can use this property from code like this:
    TableLayout tl=new TableLayout(this);
    tl.setColumnCollapsed(0, true);
    The property setColumnCollapsed(columnIndex, isCollapsed) parameters are the column index and a Boolean to indicate that it’s going to be collapsed

    This is just like using the style=”display:none;” in HTML

    Other functions can be called from code:
    TableLayout.setShrinkAllColumns(Boolean shrinkAllColumns) : shrinks all colums
    TableLayout.setStretchAllColumns(Boolean stretchAllColumns): stretches all columns
    Read More..

    Episode 26 Fit

    Tor and Chet are joined by Gustavo Moura from the Google Fit team. We talk about the Google Fit app, but also about the GMS Core and REST APIs that enable that application and any other application that wants to take advantage of the sensor data that those APIs provide.

    Getting Fit, one step at a time.

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

    Relevant Links:
    Google Fit Developer Documentation
    Recording Fitness Data
    Working with the Fitness History
    Google Fit Developers G+ Community
    Google Fit Developer Challenge

    Gustavo: google.com/+GustavoMouraGoogle
    Tor: google.com/+TorNorbye
    Chet: google.com/+ChetHaase

    Read More..

    Selection Controls 3 CheckBox and RadioButton

    CheckBox:

    The check box has two states: Checked and UnChecked. It inherits from TextView so it has all of its properties:
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
    android_orientation="vertical"
    android_layout_width="fill_parent"
    android_layout_height="fill_parent"
    >
    <TextView
    android_layout_width="fill_parent"
    android_layout_height="wrap_content"
    android_id="@+id/txt"
    />
    <CheckBox
    android_layout_width="fill_parent"
    android_layout_height="wrap_content"
    android_id="@+id/Chk"
    android_text="This is a check box"
    android_checked="false"

    />
    </LinearLayout>



    and to handle the check/uncheck event:
    CheckBox chk=(CheckBox)findViewById(R.id.Chk);
    chk.setOnCheckedChangeListener(new OnCheckedChangeListener()
    {

    public void onCheckedChanged(CompoundButton arg0, boolean arg1) {
    TextView txt=(TextView)findViewById(R.id.txt);
    if (arg1)
    txt.setText("checked");
    else
    txt.setText("Unchecked");

    }

    }
    );


    RadioButton:
    Android provides Radio button control. You create a RadioGroup and add RadioButtons inside it.
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
    android_orientation="vertical"
    android_layout_width="fill_parent"
    android_layout_height="fill_parent"
    >
    <TextView
    android_id="@+id/txt"
    android_layout_width="fill_parent"
    android:layout_height="fill_parent"
    />
    <RadioGroup
    android_id="@+id/group"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:text="Radio Group"
    >
    <RadioButton android_id="@+id/item1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Item1"
    android:checked="true"
    />
    <RadioButton android_id="@+id/item2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Item2" />
    <RadioButton android_id="@+id/item3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Item3" />
    </RadioGroup>
    </LinearLayout>




    You can get the checked item from code like this:
    RadioGroup rg=(RadioGroup)findViewById(R.id.group);
    rg.setOnCheckedChangeListener(new android.widget.RadioGroup.OnCheckedChangeListener()
    {

    public void onCheckedChanged(RadioGroup arg0, int arg1) {
    // TODO Auto-generated method stub
    TextView txt=(TextView)findViewById(R.id.txt);
    RadioButton rb=(RadioButton)findViewById(arg1);
    txt.setText("You selected "+rb.getText());

    }

    }
    );

    Read More..

    Episode 31 Graphics Performance

    This time, Tor and Chet are joined by Chris Craik from the Android UI Toolkit team. Chris took time out of his busy schedule of writing performance-testing tools and fixing graphics performance issues to talk on the podcast about, well, performance-testing tools and graphics performance issues.

    Listen in to learn about graphics performance tips, tricks, and tools.

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

    Relevant Links:
    Systrace
    Framestats
    Android Performance Patterns
    Glide

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

    Read More..

    Episode 39 MIDI

    Chet, Phil, and Tor. And a lot of totally professional sound baffles
    This time, Tor and Chet get all musical with Phil Burk from the Android Audio team. Phil worked on the new MIDI feature in the Android 6.0 Marshmallow release, and joins the podcast to talk about MIDI (history as well as Android implementation), electronic music, and other audio-related topics.

    Bryan said it was his favorite episode so far. But then Bryans an audio engineer, so he might be slightly biased.

    Android MIDI: Its music to our ears.

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

    Relevant Links

    Android MIDI
    MidiSynth Example
    More Examples
    HMSL
    Larry Polansky

    Tor: google.com/+TorNorbye, @tornorbye
    Chet: google.com/+ChetHaase, @chethaase

    Thanks to continued tolerance and support by our audio engineer, Bryan Gordon.
    Read More..

    Blog Archive

    Powered by Blogger.