Android获得手机UA的代码public String getUserAgent() { String user_agent = ProductProperties.get(ProductProperties.USER_AGENT_KEY, null); return user_agent; ……继续阅读 » 5年前 (2021-03-31) 1910浏览 2931个赞
Android清空手机上的cookie代码CookieSyncManager.createInstance(getApplicationContext()); CookieManager.getInstance().removeAllCookie();……继续阅读 » 5年前 (2021-03-31) 2734浏览 1707个赞
Android建立gprs连接代码//Dial the GPRS link. private boolean openDataConnection() { // Set up data connection. DataConnection conn = DataConnection.getInstance(); ……继续阅读 » 5年前 (2021-03-31) 1793浏览 1810个赞
Android开发PreferenceActivity 用法public class Setting extends PreferenceActivity{ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);……继续阅读 » 5年前 (2021-03-31) 1655浏览 1299个赞
Android代码显示toastToast.makeText(this._getApplicationContext(), R.string._item, Toast.LENGTH_SHORT).show();或者写成函数形式:public void Display(String str) {Toast.[i]makeText[/i](, ……继续阅读 » 5年前 (2021-03-31) 2937浏览 1255个赞
Android获得屏幕高度DisplayMetrics dm = new DisplayMetrics(); //获取窗口属性getWindowManager().getDefaultDisplay().getMetrics(dm); int screenWidth = dm.widthPixels;//320 int screen……继续阅读 » 5年前 (2021-03-31) 3413浏览 748个赞
自动检测移动设备浏览器并自适应宽度的CSSExtended css media queries for modern mobile screens/* Desktops and laptops ----------- */ @media only screen and (min-width : 1224px) { /* Styl……继续阅读 » 5年前 (2021-03-31) 2219浏览 2947个赞
Android获得SD卡剩余容量的代码File pathFile = Environment.getExternalStorageDirectory();StatFs statfs = new StatFs(pathFile.getPath());//获得可供程序使用的Block数量long nAvailaBlock = statfs.getAv……继续阅读 » 5年前 (2021-03-31) 2019浏览 1888个赞
Android列出所有音乐文件//Some audio may be explicitly marked as not being musicString selection = MediaStore.Audio.Media.IS_MUSIC + " != 0";String[] projection = { M……继续阅读 » 5年前 (2021-03-31) 2116浏览 926个赞
Android的类模板代码package xxPACKAGENAMExx;import android.app.Activity;import android.os.Bundle;public class xxCLASSNAMExx extends Activity { /** Called when the activity is fi……继续阅读 » 5年前 (2021-03-31) 3317浏览 807个赞
Android带title、message、图标和按钮的对话框AlertDialog alertDialog = new AlertDialog.Builder(this).create();alertDialog.setTitle("Title");alertDialog.setMessage("Message&qu……继续阅读 » 5年前 (2021-03-31) 2179浏览 861个赞
Android Notification通知详解 Android Notification通知详解根据activity的生命周期,在activity不显示时,会执行onStop函数(比如按下home键),所以你在onStop函数(按退出键除外)里面把notifica……继续阅读 » 5年前 (2021-03-31) 2853浏览 1307个赞
此代码在后台运行,检测是否有心的版本,如果有则弹出提示框提示用户到电子市场升级。public class Test extends Activity { private Handler mHandler; @Override public void onCreate(Bundle savedInstanceState) { ……继续阅读 » 5年前 (2021-03-31) 2906浏览 1290个赞
在Android启动时自动运行应用程序in AndroidManifest.xml (application-part):<receiver android:enabled="true" android:name=".BootUpReceiver" android:permission=&……继续阅读 » 5年前 (2021-03-31) 3244浏览 2332个赞
Android一个简单的警告框,带标题、图标、按钮AlertDialog alertDialog = new AlertDialog.Builder(this).create();alertDialog.setTitle("Title");alertDialog.setMessage("Message");……继续阅读 » 5年前 (2021-03-31) 1599浏览 2770个赞
Android AsyncTask异步处理抓取网页/** * * @author yanggang * @see http://blog.csdn.net/sunboy_2050 */public class MainActivity extends Activity { private EditText metURL; private……继续阅读 » 5年前 (2021-03-31) 1808浏览 1152个赞
android socket传输序列化对象来源:http://blog.csdn.net/cq361106306/article/details/8107105 最好只传基本数据类型,基本数据类型不需要序列化在上一篇socket传输的基础上改即可添加一个类,继承Serializab……继续阅读 » 5年前 (2021-03-31) 3174浏览 2333个赞
Android软键盘的隐藏显示、事件监听 Android是一个针对触摸屏专门设计的操作系统,当点击编辑框,系统自动为用户弹出软键盘,以便用户进行输入。    那么,弹出软键盘后必然会造成原有布局高度的减少,那么系统……继续阅读 » 5年前 (2021-03-31) 2211浏览 1908个赞
android中使用afinal一行代码显示网络图片public class DemoActivity extends FinalActivity { @ViewInject(id=R.id.imageView) ImageView imageView; //无需findViewById @Override public vo……继续阅读 » 5年前 (2021-03-31) 2741浏览 1736个赞
Android四分之一屏实现package com.example.oneoffourdemo;import android.app.ActivityGroup;import android.content.Context;import android.content.Intent;import android.os.Bundle;impor……继续阅读 » 5年前 (2021-03-31) 2014浏览 1424个赞
在Android的布局文件中,往往使用dp作为控件的宽度和高度尺寸,但是在Java代码中,调用getWidth()方法获得的尺寸单位却是像素px,这两个单位有明显的区别:dp和屏幕的密度有关,而px与屏幕密度无关,所以使用时经常会涉及到两者之间的互相转化,代码示例如下:public int Dp2Px(Context context, float dp……继续阅读 » 5年前 (2021-03-31) 3236浏览 1827个赞
Android获得当前安装的所有应用程序列表public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); lView = (ListView) findVie……继续阅读 » 5年前 (2021-03-31) 2973浏览 711个赞
Android几种简单的获取Bitmap位图实例 1、通过BitmapFactory获取BitmapFactory.decodeResource(Resources res, int Id); //参数一:资源实例 参数二:资源ID ……继续阅读 » 5年前 (2021-03-31) 3027浏览 1529个赞
Android_在SD卡上保存图片 首先判断SD卡是否插入–>public String getSDPath(){ File SDdir=null; boolean sdCardExist=Environment.get……继续阅读 » 5年前 (2021-03-31) 3125浏览 219个赞
Android中AsyncTask使用实例 MainActivity如下:package com.example.asynctasktest;import java.io.ByteArrayOutputStream;import java.io.InputStream;imp……继续阅读 » 5年前 (2021-03-31) 2072浏览 374个赞
Android 获得手机ip地址public String getLocalIpAddress() { try { for (Enumeration<NetworkInterface> en = NetworkInterface .getNetwor……继续阅读 » 5年前 (2021-03-31) 2562浏览 2563个赞
Android为按钮添加相应事件 1、在onCreate方法中找到按钮。Button button =(Button) this.findViewById(R.id.button); 2、编写按钮监听器 ……继续阅读 » 5年前 (2021-03-31) 1871浏览 806个赞
Android 通过网络获取图片的代码 主activitypackage com.netimg;import android.app.Activity;import android.graphics.Bitmap;import android.graphics.BitmapF……继续阅读 » 5年前 (2021-03-31) 1622浏览 1690个赞
Android控制摄像头拍照并对照片进行裁剪 mainActivity如下:package cn.testcamera;import java.io.File;import java.text.SimpleDateFormat;import java.util.Date;i……继续阅读 » 5年前 (2021-03-31) 3053浏览 2210个赞
获取网络信息需要在AndroidManifest.xml文件中加入相应的权限,接下来详细介绍Android中判断网络连接是否可用及监控网络状态 获取网络信息需要在AndroidManifest.xml文件中加入相应的权限。  1)判断是否有网络连接&……继续阅读 » 5年前 (2021-03-31) 1927浏览 1047个赞
通过jQuery检测浏览器类型,本代码可以判断浏览器类型,如safari,ie,chrom,firefox,opera,还可以判断是iphone还是ipad还是黑莓等移动设备function _setBrowser(){ var userAgent = navigator.userAgent.toLowerCase(); // Figure ……继续阅读 » 5年前 (2021-03-31) 2606浏览 1525个赞
关于Lucene.Net的介绍网上已经很多了在这里就不多介绍Lucene.Net主要分为建立索引,维护索引和搜索索引Field.Store的作用是通过全文检查就能返回对应的内容,而不必再通过id去DB中加载。Field.Store.YES:存储字段值(未分词前的字段值)Field.Store.NO:不存储,存储与索引没有关系Field.Store.COMPR……继续阅读 » 5年前 (2021-03-31) 3238浏览 1795个赞
这个标题太绕口了,本人语文水平有限,其实就是在给函数传递参数的时候,可以使用 参数名:参数值的方式传递,这样不会传递错。不过下面的代码是通过字典来实现的,不像python原封就支持这样的方法function foo({ name:name, project:project}) {// http://www.75271.com Print( p……继续阅读 » 5年前 (2021-03-30) 1948浏览 1887个赞
python编写自动更换ip工具转载自:Dusk’sblog http://www.arc5ch.com/archives/78#!/usr/bin/env python#-*- encoding:gb2312 -*-# Filename: IP.py import sitecustomizeimport _winregimpo……继续阅读 » 5年前 (2021-03-30) 3146浏览 731个赞
python计算函数 f(x) = 0的根## module bisection''' root = bisection(f,x1,x2,switch=0,tol=1.0e-9). Finds a root of f(x) = 0 by bisection. The root must be bracket……继续阅读 » 5年前 (2021-03-30) 3033浏览 2272个赞
Python illustrating Downhill simplex method for minimizing the user-supplied scalar function''' x = downhill(F,xStart,side,tol=1.0e-6) Downhill simplex method ……继续阅读 » 5年前 (2021-03-30) 2768浏览 2115个赞
Python program to evaluate a polynomial with its derivatives## module evalPoly''' p,dp,ddp = evalPoly(a,x). Evaluates the polynomial p = a[0] + a[1]*x + a……继续阅读 » 5年前 (2021-03-30) 3520浏览 2028个赞
Python program to solve an equation using Gauss elimination''' x = gaussElimin(a,b). Solves [a]{b} = {x} by Gauss elimination.'''from numpy im……继续阅读 » 5年前 (2021-03-30) 1860浏览 527个赞
Python code for Gauss elimination with scaled row pivoting''' x = gaussPivot(a,b,tol=1.0e-9). Solves [a]{x} = {b} by Gauss elimination with scaled row pivo……继续阅读 » 5年前 (2021-03-30) 1675浏览 1769个赞
Computes the integral with Gauss-Legendre quadrature using m nodes in Python## module gaussQuad''' I = gaussQuad(f,a,b,m). Computes the integral of f(x) from ……继续阅读 » 5年前 (2021-03-30) 1890浏览 856个赞
Inverse power method for solving the eigenvalue problem in Python''' lam,x = inversePower(a,s,tol=1.0e-6). Inverse power method for solving the eigenvalue prob……继续阅读 » 5年前 (2021-03-30) 2783浏览 2189个赞
Inverse power method applied to a tridiagonal matrix in Python''' lam,x = inversePower3(d,c,s,tol=1.0e-6). Inverse power method applied to a tridiagonal matrix……继续阅读 » 5年前 (2021-03-30) 2131浏览 1286个赞
Python代码为解决特征值问题Python code for solving the eigenvalue problem''' lam,x = inversePower5(Bv,d,e,f,tol=1.0e-6). Inverse power method for solving the eigenvalue ……继续阅读 » 5年前 (2021-03-30) 2493浏览 731个赞
python code for solving eigenvalue problem by Jacobi’s method''' lam,x = jacobi(a,tol = 1.0e-9). Solution of std. eigenvalue problem [a]{x} = lam{x} by Jac……继续阅读 » 5年前 (2021-03-30) 2471浏览 1607个赞
N lowest eigenvalues of the tridiagonal matrix in python''' r = lamRange(d,c,N). Returns the sequence {r[0],r[1],...,r[N]} that separates the N lowest eige……继续阅读 » 5年前 (2021-03-30) 2038浏览 1148个赞