Android开发中可能会碰到如何发送邮件的困扰,之前我也查了相关的文档,博友们也分享了不少的发送邮件的办法,总共有3种把,我仔细阅读了下,发现有的讲的太过复杂跟麻烦,不够清晰,我今天就来分享下我认为的最好用的办法来解决该问题,使用Andorid-MAIL Jar包。首先我们先要下载以下四个文件然后呢在Android平台上发送邮件呢,肯定先要检查网络的状态,网络状态可用的情况下才能发送邮件成功啊(别往了获取网络信息需要在Android...
分享到微信朋友圈代码。不好用,最后选择了shareSdk。 privatestaticvoid shareToTimeLine(File file) {Intent intent = new Intent();ComponentName comp = new ComponentName("com.tencent.mm", "com.tencent.mm.ui.tools.ShareToTimeLineUI");intent.setComponent(comp);intent.setAction("android.intent.action.SEND");intent.setType("image/*");intent.putExtra(Intent.EXTRA_TEXT, "我是文字");intent.putExtra(Intent.EXT...
这里用的mac版本的AndroidStudio 1. 执行组合快捷键command+”,”,打开AS偏好设置页面,找到plugin选项,输入Parcelable搜索,搜索出来的第一个五颗星的就是,点击右边的install plugin,等装完后会提示你重启as2.等插件装完了就可以使用了,随便建立一个Person类,例如有四个属性username,password,age,isGay/*** Created by hailonghan on 15/5/28.*/publicclassPerson {private String username;private String password;privat...
废话不多说,这是地址:http://android.lineten.net/layout.php。
有图有真相,例如:
你的XML假如是这样:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/logo"
android:layout_...
转载请注明出处:http://blog.csdn.net/bettarwang/article/details/41634729 之前在网上也看到一些所谓的下拉刷新的例子,但是总感觉是把简单的事情复杂化了,动辄300多行甚至600多行的代码,其实主要就是对触摸事件作出反应嘛,根本用不着这么麻烦。下面先实现一个可上下拉动的ListView,再实现一个带有Header的可下拉刷新的ListView: 可上下拉动的ListView的源码如下:/*** 可上下拉动的ListView* @author Bettar**/...
概述Proguard代码混淆工具:可以对代码进行去冗余压缩,代码优化,代码混淆等。在Android中的主要应用就是对代码混淆:就是将类名,方法名,Field名变成如a,b,c或者1,2,3等难以阅读和理解的名字,以防止逆向工程和被反编译阅读源码。使用Proguard启用Eclipse下:项目根路径下有两个文件:project.properties和proguard-project.txt在project.properties中有这样一段话:# To enable ProGuard to shrink and obfuscate your code, u...
命名规则变量名:1)尽量要取有意义的名字,比如说:一个用户名的成员变量,应该写成username,而不要只写个string;2)如果是常量,既在编码过程中,这个值是不会改变的,应该写成大写的名字,如:USER_AGE,也可以是User_Age,这里需要强调的是,如果是多个单词组成的,需要在每个单词下面加一个下划线进行区分,整个命名是这样的:static final int USER_AGE = 25。方法名:同样的,和变量名命名一样,方法名也要取有意义的名字...
由于之前的项目使用过xml文件的解析,但是在使用的时候都是从网上找到的代码,稍作修改就使用了,然而对其中的原理并不知所以然,所以再次想使用的时候,感觉还是空空的,不知道如何下手,为了更加深入的理解xml文件的解析,我从代码实现的角度做一些理解,但是我在看代码的时候,有些代码的实现还是没有办法读懂,还是太深奥。下面我就以我之见,写一些东西,作为记录。 在android中XML的解析有三种,分别为:SAX(Simple API...
一、引入PendingIntent是一个非常不起眼的类,你可能在以下情况下遇到过它1、AlarmManagerint requestID = 1;AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE);Intent i = new Intent(this,AshqalReceiver.class);PendingIntent pi = PendingIntent.getBroadcast(this,requestID,i,PendingIntent.FLAG_UPDATE_CURRENT);am.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + 1000, 1000, pi);2...
/*** Adapter for grid of coupons.*/private static class CouponAdapter extends BaseAdapter {private LayoutInflater mInflater;private List<Coupon> mAllCoupons;/*** Constructs a new {@link CouponAdapter}.** @param inflater to create new views* @param allCoupons for list of all coupons to be displayed*/public CouponAdapter(LayoutInflater inflater, List<Coupon> allCoupons) {if (allCoupons == null) {thr...
关键词:蓝牙blueZ UART HCI_UART H4 HCI L2CAP RFCOMM 版本:基于android4.2之前版本 bluez内核:linux/linux3.08系统:android/android4.1.3.4作者:xubin341719(欢迎转载,请注明作者,请尊重版权谢谢)欢迎指正错误,共同学习、共同进步!!一、Android Bluetooth Architecture蓝牙代码架构部分(google 官方蓝牙框架)Android的蓝牙系统,自下而上包括以下一些内容如上图所示:1、串口驱动Linux的内核的蓝牙驱动程、Linux的...
首先来看一下 手淘HD - 商品详情 - 选择商品属性 页面的UI商品有很多尺码,而且展现每个尺码所需要的View的大小也不同(主要是宽度),所以在从服务器端拉到数据之前,展现所有尺码所需要的行数和每一行的个数都无法确定,因此不能直接使用GridView或ListView。如果使用LinearLayout呢?一个LinearLayout只能显示一行,如果要展示多行,则每一行都要new一个LinearLayout出来,而且还必须要计算出每一个LinearLayout能容纳多少个尺码...
Android代码混淆是必须的,java层代码如果不做混淆等于把源代码送人了。那如何做混淆呢?之前一般都是提到采用proguard.cfg,但使用新版本ADT后没有这个文件了,取而代之的是proguard-project.txt文件。那该如何使用呢?在项目根目录下有个project.properties,里面有如下内容:# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}...
在学习【状态栏通知】时,遇到代码被横线划掉,这是怎么回事呢?例如:package com.example.notification;import android.app.Activity;
import android.app.AlertDialog;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
impor...
//删除文件夹private void deleteDirectory(File folder) {if (folder.exists()) {File[] files = folder.listFiles();if (files == null) {return;}for (int i = 0; i < files.length; i++) {if (files[i].isDirectory()) {deleteDirectory(files[i]);} else {files[i].delete();}}}folder.delete();}原文:http://blog.csdn.net/lfdfhl/article/details/41047647