自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(41)
  • 收藏
  • 关注

原创 AlarmManager定时器

首先,获取系统服务:   private AlarmManager mAlarmManager;mAlarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE);然后,设置定时器:Intent intent = new Intent(this, Alerm.class);PendingIntent...

2013-04-15 18:19:57 127

原创 google play 提交apk说:服务器无法处理app

检查manifest里面的的资源文件

2012-09-25 16:16:18 153

原创 Widget分区域点击

<?xml version="1.0" encoding="utf-8"?><appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" android:minHeight="72dp" android:minWidth="72dp" an

2012-09-25 10:24:24 122

原创 Widget分区域点击

 Widget配置文件: package com.example.changewidget;import android.app.Activity;import android.app.PendingIntent;import android.appwidget.AppWidgetManager;import android.content.Intent;imp...

2012-09-25 10:23:43 101

原创 检查packageName对应app是否安装

// 检查packageName对应app是否安装 public static boolean checkApkExist(Context context, String packageName) { if (packageName == null || "".equals(packageName)) return false; try { context.g...

2012-08-24 10:46:33 167

原创 监听WebView显示结束(回调函数实现)

webView只提供了一个监听加载完毕的方法,但是没有提供监听显示完毕的方法。所以经过各种大师的帮忙,发现可以这样做来监听显示完毕,其中用到了回调函数。 1.重写webview,并且添加回调函数。setDf(); import android.content.Context;import android.graphics.Canvas;import android.util...

2012-08-15 11:31:00 837

原创 Intent跳转去网络设置页面

public static void startNetworkSettingActivity(Context context) { Intent intent = new Intent(); int sdkVersion = VERSION.SDK_INT; if (sdkVersion >= Env.ANDROID_4_0 ) { intent = new ...

2012-08-14 23:50:31 181

原创 TextView显示html内容

TextView tv = (TextView) findViewById(R.id.webview);tv.setText(Html.fromHtml(url));

2012-08-10 16:26:19 99

原创 使用String资源

 getResources().getString(R.string.emailsend)

2012-08-06 16:06:48 113

原创 Intent到gmail发邮件

Intent returnIt = new Intent (Intent . ACTION_SEND );//设置收件人returnIt .putExtra(Intent . EXTRA_EMAIL , new String[]{getResources().getString(R.string.emailsend)});//设置邮件主体returnIt .putExtra(...

2012-08-06 15:31:10 192

原创 导入外部数据库

package com.example.imputdatabase;import java.io.File;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io.IOException;import java.io.InputStream;impo...

2012-07-31 10:51:46 117

原创 读入大文本信息方法

  BufferedReader br = new BufferedReader(new InputStreamReader(context.getResources().openRawResource(R.raw.hoax), "utf-8"), 100 * 1024);// 打开在raw文件夹中的hoax资源,资源格式是utf-8,指定每次读入一行为100*1024Strin...

2012-07-31 09:52:26 88

原创 所有的R文件都消失

问题描述: 添加了一个资源文件,然后所有引用到R资源都出错,原因是找不到资源文件,clean,fix,refresh都没有用,以下为 gen文件夹内的信息。/** Automatically generated file. DO NOT MODIFY */package com.zdworks.legerdemain;public final class BuildC...

2012-07-26 18:05:30 113

原创 String和int互化

String化为IntInteger.parseInt(String); Int化为String1.Int.toString();2.String.valueOf(Int); 

2012-07-26 10:41:52 166

原创 如何使覆盖区域点击效果不覆盖

 问题描述:点击红色区域框,会点击到地图解决办法:android:clickable="true"

2012-07-26 10:39:11 124

原创 设定界面横屏或者竖屏

在AndroidMainfest.xml中的每一个activity中加入一句 android:screenOrientation="landscape"表示横屏, android:screenOrientation="portrait"表示竖屏

2012-07-26 10:39:02 119

原创 使两张图片不停切换

 package zdclub.destorybarrier; import android.app.Activity; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.widget.ImageView; ...

2012-07-25 19:43:40 403

原创 不停地切换两张图片ViewFlipper

 <ViewFlipper android:layout_height="fill_parent"android:layout_width="fill_parent"android:inAnimation="@anim/in_lefttoright"android:outAnimation="@anim/out_lefttoright"android:flipInterv...

2012-07-25 19:43:31 115

原创 完全退出应用(SharedPreferences和onResume()实现)

问题:A.class Intent跳转到B.class,由于某些原因,需要在B.class恢复到A.class跳转前的状态,同时也需要在B.class直接关闭应用。分析:在Android的Activity中有一个方法叫onResume(),每当Intent结束的时候,就会直接吊起前一个 onResume(),所以只要在onResume()判断是否需要结束就可以了。解决方法:设置一个共享变量,来判断...

2012-07-25 19:43:20 123

原创 Invalid project description

导入不同版本的eclipse制作的项目,可能会产生Invalid project description错误。解决方法:把将要导入的文件夹放到非Eclipse的Android默认目录。

2012-07-25 19:43:15 96

原创 数据库的使用

作用:从文本中获取信息存放在数据库中。 SQLActivity主要负责界面控制,六个按钮的摆放以及点击效果。 package com.example.sql;import java.io.IOException;import android.app.Activity;import android.content.ContentValues;import ...

2012-07-25 19:43:06 104

原创 自定义控件

需要添加类似public SurfaceV(Context context, AttributeSet attrs) {super(context, attrs);init(context);} AttributeSet是给XML使用的属性。

2012-07-24 11:26:52 43

原创 关于Intent

Intent常见于在页面间的跳转。常见语句为:Intent intent = new Intent(GameOver.this,PlayingActivity.class);startActivity(intent);finish(); 其中,Intent()中的参数是指上下文,即Context,倘若Intent是在Activity中,可以直接用上述语句,但是如果不在,则需要用...

2012-07-24 11:26:33 156

原创 在普通类中使用getResources()

context可以作为成员变量传入类中,然后通过context调用getResources()

2012-07-24 11:26:25 296

原创 final 和 static

摘选自:http://blog.csdn.net/tianjf0514/article/details/7431262public class myTestClass {int i;static int i;final int i;static final int i;} nt i;是属于类的实例的,可以改变。 static int i;是属于类...

2012-07-24 11:26:19 67

原创 键盘顶起内容

 android:windowSoftInputMode="adjustResize" 放在AndroidManifest.xml里面相对应的activity标签中,可以实现让键盘出现时,内容往上滑动。

2012-07-24 11:26:09 63

原创 点击图片时,按钮效果设置

在drawble中建立一个xml,内容是: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_pressed="true" android

2012-07-23 08:58:18 73

原创 获取系统时间

SimpleDateFormat formatter = new SimpleDateFormat ("yyyy年MM月dd日 HH:mm:ss");//hh12小时 Date curDate = new Date(System.currentTimeMillis());//获取当前时间 HH24小时 String str = formatter.format(curD...

2012-07-23 08:57:10 72

原创 关于adb不是内部或外部的命令

在命令行中输入adb shell,本来是应该可以用的,但是,命令行却跳出一条:“adb不是内部或外部命令,也不是可运行程序或批处理文件”有人说是sdk没有配置环境变量,然后在cmd里面输入android却是正常的,那么就证明不是sdk没有配置环境变量。1.去看tools文件夹,发现有个文件叫adb_has_moved,文件内容是The adb tool has moved to platform-...

2012-07-23 08:54:51 207

原创 字符串搜索以及截取

 //搜索String中“你”出现的位置String.indexOf("你");//截取String中的一段,从位置Stat到endString.substring(start, end);

2012-07-23 08:54:34 59

原创 获取asset文件夹中的txt文件方法

 //获取asset文件夹的管理权限AssetManager aManager = context.getAssets();//打开文件名为fileName的文件InputStream file = aManager.open(fileName); //统计文件中的字节数int length = file.available();//创建一个数组存储字符byte[]...

2012-07-23 08:53:07 131

原创 EditText的显示文字的方式

EditText预设显示的文字有两种方式:1.android:text:他会将文字显示在文本框中,但是选中文本框后,文字是不会消失的。2.android:hint:他会将文字显示在文本框中,但是如果选中文本框后,文字会自动消失,就是预设的功能。...

2012-07-20 08:58:29 481

原创 HorizontalScrollView判断是否移动到底部

 HorizontalScrollView hs = (HorizontalScrollView)findViewById(R.id.horscro); //水平滑动栏箭头的出现与消失 hs.setOnTouchListener(new OnTouchListener() { @Override ...

2012-07-20 08:58:04 412

原创 调用浏览器

启动默认浏览器:Intent intent = new Intent(); intent.setAction("android.intent.action.VIEW"); Uri content_url = Uri.parse("http://www.baidu.com"); intent.setData(content_url); startActivity(intent);...

2012-07-20 08:57:55 73

原创 ListView控件简单使用

main.xml:设定ListView父控件的大小,定义ListView的各种属性<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" ...

2012-07-20 08:57:37 50

原创 使用Dialog主题

修改项目对应的AndroidManifest.xml,在相对应的<activity标签上加上android:theme="@android:style/Theme.Dialog"例子:<activity android:name=".ListViewActivity" android:theme="@android:style/Theme.Dialog"/>...

2012-07-20 08:57:25 58

原创 延时实现,Handle

//延时Handler x = new Handler(); x.postDelayed(new splashhandler(), 2000);//延时2秒,接着往下面做就是splashhandler(); //延时实现掉跳转class splashhandler implements Runnable{ public void...

2012-07-19 13:53:21 106

原创 Intent切换出错

代码没有错,然后该添加的都添加了~~没有报错,然后只在运行时出错,出错地方就在:startActivity(intent);上,只在运行时出错。<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"package...

2012-07-19 13:49:06 87

原创 全屏显示(去掉最顶上的那一栏)

在setContentView(R.layout.mainview);上添加:getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);

2012-07-19 13:48:02 105

原创 关于导入文件后提示删除@Override

今天在论坛上下载了一个和listView有关的源代码,导入至eclipse后,报错,需要把所有的@Override都删掉。错误原因:jdk不合适解决方法:更改jdk,更改方法,在eclipse中的,Windows->Preference->Java->Compiler->1.6如果不行,就改成 Windows->Preference->Java->Inst...

2012-07-19 13:46:35 175

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除