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.Video;
/**
 * 获取首页的热门视频，支持分页
 * @author susie
 *
 */
public class GetHotVideo extends Activity {
	private String TAG = "GetHotVideo";
	private TextView resultTxtV;

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

		String cid = "2";//视频分类
		String page = "1";//第几页
		String num = "2";//每页的数量

		JSONObject result = Video.getHotVideo(getApplicationContext(), cid,
				num, page);
		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);
	}
}
