Skip to content

Instantly share code, notes, and snippets.

@dzwillpower
dzwillpower / Channel.xml
Last active January 1, 2016 20:29
江西省网的数据结构 服务端返回的xml
<?xml version="1.0" encoding="GBK"?>
<Channels totalResults="4" restartAtToken="0" timeShiftURL="">
<Channel channelID="817447" channelCode="10001010-00000000000000000000345" channelName="CCTV-7" channelNumber="0"
logo="" isStartOver="1" isNPVR="0" isStandardChannel="1"
isTVAnyTime="1" npvrOrderFlag="0" tVAnyTimeOrderFlag="0" startOverOrderFlag="0">
@dzwillpower
dzwillpower / timeline.json
Last active August 29, 2015 13:56
新浪微博 主页时间线 http://open.weibo.com/wiki/2/statuses/home_timeline 字段说明 两条微博 带图片
{
"statuses": [
{
"created_at": "Thu May 15 13:51:34 +0800 2014",
"id": 3710489487555905,
"mid": "3710489487555905",
"idstr": "3710489487555905",
"text": "测试一张图片",
"source": "<a href=\"http://app.weibo.com/t/feed/6ghA0p\" rel=\"nofollow\">搜狗高速浏览器</a>",
"favorited": false,
@dzwillpower
dzwillpower / selector.xml
Created March 4, 2014 01:30
各种selector的写法
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/detail_favorites_focus" android:state_focused="true"/>
<item android:drawable="@drawable/detail_favorites_unfocus" android:state_focused="false"/>
</selector>
@dzwillpower
dzwillpower / snippet.java
Last active June 22, 2018 06:22
代码片段
/** 注册外接设别插拔的广播*/
IntentFilter localIntentFilter = new IntentFilter();
localIntentFilter.addAction("android.intent.action.MEDIA_UNMOUNTED");
localIntentFilter.addAction("android.intent.action.MEDIA_MOUNTED");
localIntentFilter.addAction("android.intent.action.MEDIA_REMOVED");
localIntentFilter.addAction("android.intent.action.MEDIA_BAD_REMOVAL");
localIntentFilter.addDataScheme("file");
registerReceiver(this.mReceiver, localIntentFilter);
/** Stirng 中空格的写法 */
@dzwillpower
dzwillpower / AssetfileToFile.java
Created April 29, 2014 08:59
将asset 里面的文件转换为file
AssetManager am = getAssets();
InputStream inputStream = am.open(file:///android_asset/myfoldername/myfilename);
File file = createFileFromInputStream(inputStream);
private File createFileFromInputStream(InputStream inputStream) {
try{
File f = new File(my_file_name);
OutputStream outputStream = new FileOutputStream(f);
byte buffer[] = new byte[1024];
@dzwillpower
dzwillpower / OAuthActivity.java
Created May 1, 2014 13:05
新浪微博授权activity
package org.qii.weiciyuan.ui.login;
import org.qii.weiciyuan.R;
import org.qii.weiciyuan.bean.AccountBean;
import org.qii.weiciyuan.bean.UserBean;
import org.qii.weiciyuan.dao.URLHelper;
import org.qii.weiciyuan.dao.login.OAuthDao;
import org.qii.weiciyuan.support.database.AccountDBTask;
import org.qii.weiciyuan.support.debug.AppLogger;
import org.qii.weiciyuan.support.error.WeiboException;
@dzwillpower
dzwillpower / DirectoryCreate.java
Created July 30, 2014 01:29
创建文件夹 和递归删除文件夹
package com.wits.dzwillpower;
import java.io.File;
public class DirectoryCreate {
public static void main(String[] args) {
deleteFile(new File("E:\\ProgrammeMaterial\\Android\\AndroidProgram\\3372\\1\\1"));
}
public static void deleteFile(File file) {
@dzwillpower
dzwillpower / LruCache.java
Created September 19, 2014 02:40
Android使用 LruCache 缓存图片
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@dzwillpower
dzwillpower / DiskLruCache.java
Created September 19, 2014 02:42
DiskLruCache
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@dzwillpower
dzwillpower / VolleyLog.java
Created November 13, 2014 14:31
volley库 的log 类 可以打出调用的线程 方法名称
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software