package com.sdk.example;

import org.json.JSONObject;

import android.app.Activity;
import android.os.Bundle;
import android.text.Html;
import android.text.SpannableString;
import android.text.Spanned;
import android.util.Log;
import android.widget.TextView;

import com.sdk.util.Parser;
import com.wole56.sdk.APP;

/**
 * 获取应用的相关信息
 * 
 * @author susie
 * 
 */
public class GetAppInfo extends Activity {
	/**
	 * log tag.
	 */
	private String TAG = "GetAppInfo";

	/**
	 * textView to show result.
	 */
	private TextView resultTxtV;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.app_info);
		// init ui
		resultTxtV = (TextView) findViewById(R.id.result_txt);

		// get app info
		JSONObject result = APP.getInfo(getApplicationContext());
		Log.i(TAG, result.toString());

		// 数据简单解析与呈现
		String parseStr = Parser.simpleParser(result);
		// 富文本形式展现
		Spanned span = Html.fromHtml(parseStr);
		SpannableString spanStr = new SpannableString(span);
		// show result
		resultTxtV.setText(spanStr);
	}
}
