Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.IOException;

import android.util.JsonReader;
import android.util.Log;

public class Main {
    final static String TAG = "O82Utils";

    /**
     * Read Access token from Json object that we got from O8 Auth server.
     * 
     */
    private static String getAccessToken(JsonReader reader) throws IOException {
        String text = null;

        try {
            reader.beginObject();
            while (reader.hasNext()) {
                String name = reader.nextName();
                if (name.equals("access_token")) {
                    text = reader.nextString();
                    break;
                }
            }

            //reader.endObject();
        } catch (IOException ex) {
            Log.e(TAG, ex.getStackTrace().toString());
        }
        return text;
    }
}