Android获得手机UA的代码public String getUserAgent() { String user_agent = ProductProperties.get(ProductProperties.USER_AGENT_KEY, null); return user_agent; ……继续阅读 » 6年前 (2021-03-31) 3525浏览 1321个赞
Android清空手机上的cookie代码CookieSyncManager.createInstance(getApplicationContext()); CookieManager.getInstance().removeAllCookie();……继续阅读 » 6年前 (2021-03-31) 1916浏览 2221个赞
Android建立gprs连接代码//Dial the GPRS link. private boolean openDataConnection() { // Set up data connection. DataConnection conn = DataConnection.getInstance(); ……继续阅读 » 6年前 (2021-03-31) 1892浏览 737个赞
Android开发PreferenceActivity 用法public class Setting extends PreferenceActivity{ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);……继续阅读 » 6年前 (2021-03-31) 3248浏览 2266个赞
Android代码显示toastToast.makeText(this._getApplicationContext(), R.string._item, Toast.LENGTH_SHORT).show();或者写成函数形式:public void Display(String str) {Toast.[i]makeText[/i](, ……继续阅读 » 6年前 (2021-03-31) 3013浏览 2631个赞
Android获得屏幕高度DisplayMetrics dm = new DisplayMetrics(); //获取窗口属性getWindowManager().getDefaultDisplay().getMetrics(dm); int screenWidth = dm.widthPixels;//320 int screen……继续阅读 » 6年前 (2021-03-31) 3150浏览 2520个赞
自动检测移动设备浏览器并自适应宽度的CSSExtended css media queries for modern mobile screens/* Desktops and laptops ----------- */ @media only screen and (min-width : 1224px) { /* Styl……继续阅读 » 6年前 (2021-03-31) 2818浏览 577个赞
Android获得SD卡剩余容量的代码File pathFile = Environment.getExternalStorageDirectory();StatFs statfs = new StatFs(pathFile.getPath());//获得可供程序使用的Block数量long nAvailaBlock = statfs.getAv……继续阅读 » 6年前 (2021-03-31) 2664浏览 2970个赞
Android列出所有音乐文件//Some audio may be explicitly marked as not being musicString selection = MediaStore.Audio.Media.IS_MUSIC + " != 0";String[] projection = { M……继续阅读 » 6年前 (2021-03-31) 2420浏览 1991个赞
Android的类模板代码package xxPACKAGENAMExx;import android.app.Activity;import android.os.Bundle;public class xxCLASSNAMExx extends Activity { /** Called when the activity is fi……继续阅读 » 6年前 (2021-03-31) 3213浏览 1112个赞
Android带title、message、图标和按钮的对话框AlertDialog alertDialog = new AlertDialog.Builder(this).create();alertDialog.setTitle("Title");alertDialog.setMessage("Message&qu……继续阅读 » 6年前 (2021-03-31) 1983浏览 1048个赞
Android Notification通知详解 Android Notification通知详解根据activity的生命周期,在activity不显示时,会执行onStop函数(比如按下home键),所以你在onStop函数(按退出键除外)里面把notifica……继续阅读 » 6年前 (2021-03-31) 3271浏览 1794个赞
此代码在后台运行,检测是否有心的版本,如果有则弹出提示框提示用户到电子市场升级。public class Test extends Activity { private Handler mHandler; @Override public void onCreate(Bundle savedInstanceState) { ……继续阅读 » 6年前 (2021-03-31) 1983浏览 325个赞
在Android启动时自动运行应用程序in AndroidManifest.xml (application-part):<receiver android:enabled="true" android:name=".BootUpReceiver" android:permission=&……继续阅读 » 6年前 (2021-03-31) 2126浏览 1244个赞
Android一个简单的警告框,带标题、图标、按钮AlertDialog alertDialog = new AlertDialog.Builder(this).create();alertDialog.setTitle("Title");alertDialog.setMessage("Message");……继续阅读 » 6年前 (2021-03-31) 2685浏览 2246个赞
Android AsyncTask异步处理抓取网页/** * * @author yanggang * @see http://blog.csdn.net/sunboy_2050 */public class MainActivity extends Activity { private EditText metURL; private……继续阅读 » 6年前 (2021-03-31) 3274浏览 981个赞
android socket传输序列化对象来源:http://blog.csdn.net/cq361106306/article/details/8107105 最好只传基本数据类型,基本数据类型不需要序列化在上一篇socket传输的基础上改即可添加一个类,继承Serializab……继续阅读 » 6年前 (2021-03-31) 1976浏览 169个赞
Android软键盘的隐藏显示、事件监听 Android是一个针对触摸屏专门设计的操作系统,当点击编辑框,系统自动为用户弹出软键盘,以便用户进行输入。    那么,弹出软键盘后必然会造成原有布局高度的减少,那么系统……继续阅读 » 6年前 (2021-03-31) 3318浏览 1527个赞
android中使用afinal一行代码显示网络图片public class DemoActivity extends FinalActivity { @ViewInject(id=R.id.imageView) ImageView imageView; //无需findViewById @Override public vo……继续阅读 » 6年前 (2021-03-31) 2624浏览 652个赞
Android四分之一屏实现package com.example.oneoffourdemo;import android.app.ActivityGroup;import android.content.Context;import android.content.Intent;import android.os.Bundle;impor……继续阅读 » 6年前 (2021-03-31) 2836浏览 2561个赞
在Android的布局文件中,往往使用dp作为控件的宽度和高度尺寸,但是在Java代码中,调用getWidth()方法获得的尺寸单位却是像素px,这两个单位有明显的区别:dp和屏幕的密度有关,而px与屏幕密度无关,所以使用时经常会涉及到两者之间的互相转化,代码示例如下:public int Dp2Px(Context context, float dp……继续阅读 » 6年前 (2021-03-31) 2859浏览 2561个赞
Android获得当前安装的所有应用程序列表public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); lView = (ListView) findVie……继续阅读 » 6年前 (2021-03-31) 2162浏览 806个赞
Android几种简单的获取Bitmap位图实例 1、通过BitmapFactory获取BitmapFactory.decodeResource(Resources res, int Id); //参数一:资源实例 参数二:资源ID ……继续阅读 » 6年前 (2021-03-31) 2585浏览 2688个赞
Android_在SD卡上保存图片 首先判断SD卡是否插入–>public String getSDPath(){ File SDdir=null; boolean sdCardExist=Environment.get……继续阅读 » 6年前 (2021-03-31) 3042浏览 284个赞
Android中AsyncTask使用实例 MainActivity如下:package com.example.asynctasktest;import java.io.ByteArrayOutputStream;import java.io.InputStream;imp……继续阅读 » 6年前 (2021-03-31) 2489浏览 2279个赞
Android 获得手机ip地址public String getLocalIpAddress() { try { for (Enumeration<NetworkInterface> en = NetworkInterface .getNetwor……继续阅读 » 6年前 (2021-03-31) 3509浏览 1163个赞
Android为按钮添加相应事件 1、在onCreate方法中找到按钮。Button button =(Button) this.findViewById(R.id.button); 2、编写按钮监听器 ……继续阅读 » 6年前 (2021-03-31) 3285浏览 469个赞
Android 通过网络获取图片的代码 主activitypackage com.netimg;import android.app.Activity;import android.graphics.Bitmap;import android.graphics.BitmapF……继续阅读 » 6年前 (2021-03-31) 3127浏览 702个赞
Android控制摄像头拍照并对照片进行裁剪 mainActivity如下:package cn.testcamera;import java.io.File;import java.text.SimpleDateFormat;import java.util.Date;i……继续阅读 » 6年前 (2021-03-31) 3059浏览 2181个赞
获取网络信息需要在AndroidManifest.xml文件中加入相应的权限,接下来详细介绍Android中判断网络连接是否可用及监控网络状态 获取网络信息需要在AndroidManifest.xml文件中加入相应的权限。  1)判断是否有网络连接&……继续阅读 » 6年前 (2021-03-31) 2149浏览 1824个赞
通过jQuery检测浏览器类型,本代码可以判断浏览器类型,如safari,ie,chrom,firefox,opera,还可以判断是iphone还是ipad还是黑莓等移动设备function _setBrowser(){ var userAgent = navigator.userAgent.toLowerCase(); // Figure ……继续阅读 » 6年前 (2021-03-31) 1717浏览 211个赞
关于Lucene.Net的介绍网上已经很多了在这里就不多介绍Lucene.Net主要分为建立索引,维护索引和搜索索引Field.Store的作用是通过全文检查就能返回对应的内容,而不必再通过id去DB中加载。Field.Store.YES:存储字段值(未分词前的字段值)Field.Store.NO:不存储,存储与索引没有关系Field.Store.COMPR……继续阅读 » 6年前 (2021-03-31) 2277浏览 2014个赞
这个标题太绕口了,本人语文水平有限,其实就是在给函数传递参数的时候,可以使用 参数名:参数值的方式传递,这样不会传递错。不过下面的代码是通过字典来实现的,不像python原封就支持这样的方法function foo({ name:name, project:project}) {// http://www.75271.com Print( p……继续阅读 » 6年前 (2021-03-30) 3515浏览 222个赞
python编写自动更换ip工具转载自:Dusk’sblog http://www.arc5ch.com/archives/78#!/usr/bin/env python#-*- encoding:gb2312 -*-# Filename: IP.py import sitecustomizeimport _winregimpo……继续阅读 » 6年前 (2021-03-30) 2476浏览 536个赞
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……继续阅读 » 6年前 (2021-03-30) 2152浏览 2631个赞
Python illustrating Downhill simplex method for minimizing the user-supplied scalar function''' x = downhill(F,xStart,side,tol=1.0e-6) Downhill simplex method ……继续阅读 » 6年前 (2021-03-30) 2151浏览 2929个赞
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……继续阅读 » 6年前 (2021-03-30) 2571浏览 2005个赞
Python program to solve an equation using Gauss elimination''' x = gaussElimin(a,b). Solves [a]{b} = {x} by Gauss elimination.'''from numpy im……继续阅读 » 6年前 (2021-03-30) 3365浏览 105个赞
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……继续阅读 » 6年前 (2021-03-30) 3122浏览 2387个赞
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 ……继续阅读 » 6年前 (2021-03-30) 3099浏览 989个赞
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……继续阅读 » 6年前 (2021-03-30) 2074浏览 721个赞
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……继续阅读 » 6年前 (2021-03-30) 2157浏览 1686个赞
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 ……继续阅读 » 6年前 (2021-03-30) 1974浏览 1103个赞
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……继续阅读 » 6年前 (2021-03-30) 2736浏览 1586个赞
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……继续阅读 » 6年前 (2021-03-30) 2760浏览 947个赞