
android
文章平均质量分 75
meetings
这个作者很懒,什么都没留下…
展开
-
android在 Activity 之间传递参数
1.点击一个按钮跳转到百度页面(或者另一个activity):public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState原创 2016-01-12 20:57:06 · 586 阅读 · 0 评论 -
借助PopupWindow实现的一种通用弹窗
记录下自己实现的一个通用弹窗,使用的时候传入自己需要的view即可public class PopWindow { private Activity mContext; private ViewGroup contentView; private PopupWindow popupWindow; public interface OnPopWindowDi原创 2017-10-09 15:28:24 · 1738 阅读 · 0 评论 -
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "strtof" referenced by "libsupp
1.报错:10-29 10:17:23.960 5768-5788/com.coocaa.mall E/APP_CRASH: java.lang.RuntimeException: Failure during heap dump; check log output for details原创 2017-10-29 10:18:11 · 4317 阅读 · 1 评论 -
TextView实现中间文字两侧图片的样式 和 左侧图片右侧文字
public class StandardView extends LinearLayout { private Context mContext; private TextView standard; private LinearLayout.LayoutParams lp; private Drawable standardLeftIcon, standardR原创 2017-08-04 14:33:25 · 2283 阅读 · 0 评论 -
获取一个url里面的域名部分,并取对应的IP地址
比如:取这个地址“"http://blog.youkuaiyun.com/meetings/article/details/78785424"”里的“blog.youkuaiyun.com”对应的真实IP /** * 获取url对应的域名 * * @param url * @return */ public String getDomain(String原创 2017-12-20 11:21:13 · 11928 阅读 · 1 评论 -
获取安卓设备上有线网或者无线网络的IP地址
/** * 获取安卓设备当前的IP地址(有线或无线) * * @return */ private String getClientIP() { try { // 获取本地设备的所有网络接口 Enumeration enumerationNi = NetworkInterface转载 2017-12-20 11:29:33 · 3592 阅读 · 0 评论 -
android在指定时间内匀速画一条直线
1.效果图:2.自定义view实现public class UniformLine extends View { private int x, y, nextX, nextY, incrementY, incrementX; public UniformLine(Context context) { super(context); }原创 2017-12-20 14:45:30 · 30053 阅读 · 1 评论 -
自定义View饼状图
1.效果图 2.代码实现public class PieChartView extends View { private Paint mPaint; private ListpieDataList; // 饼状图初始绘制角度 private float mStartAngle = 0; public原创 2017-12-22 11:39:56 · 30360 阅读 · 0 评论 -
java代码实现的帧动画
1、效果图2、帧动画的简要代码 private ImageView bgAnimView; private AnimationDrawable mAnimationDrawable; //初始化 mAnimationDrawable = new AnimationDrawable(); bgAnimView = new ImageV原创 2017-12-12 19:56:24 · 5622 阅读 · 0 评论 -
Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag
startActivity时错误信息提示:android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? 原来是原创 2017-10-09 14:28:19 · 1171 阅读 · 0 评论 -
retrofit 请求后台接口url时参数中用URLEncoder.encode编码方式
有时候我们在和后台约定请求参数的时候会涉及到编码解码的问题,但是retrofit里面默认的编码方式很可能和后台的解码方式不一致,导致前端请求不到数据: try { extendStr = URLEncoder.encode(param,"utf-8"); } catch (UnsupportedEncodingException e) {原创 2017-08-04 15:39:14 · 7688 阅读 · 0 评论 -
fresco:0.12.0 无法播放gif图片的解决方法
private SimpleDraweeView draweeView; draweeView = (SimpleDraweeView) findViewById(R.id.gif); draweeView.setController(getDraweeController(R.drawable.gif1)); draweeView.setOnClickListener(o原创 2017-05-31 11:34:24 · 2323 阅读 · 0 评论 -
获取未接来电及新短信的小栗子(主要使用ContentObserver类)
1.ContentObserver简单介绍: ContentObserver——内容观察者,目的是观察(捕捉)特定Uri引起的数据库的变化,继而做一些相应的处理,它类似于数据库技术中的触发器(Trigger),当ContentObserver所观察的Uri发生变化时,便会触发它。2.编程步骤: ①创建我们特定的ContentObserver派生类,必须重载父类构造方法,原创 2016-08-27 14:04:37 · 1514 阅读 · 1 评论 -
深入理解layout_weight属性
1.最常见用法:子控件的宽度比是1:2:3<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height=原创 2016-10-31 21:08:51 · 1353 阅读 · 0 评论 -
异步访问URL
1.同步get请求:传统方式: URL url = null; try { url = new URL(_url); HttpURLConnection urlConn = null; urlConn = (HttpURLConnection) url.openConnection(); // 设置连接超时时间原创 2017-01-15 13:54:30 · 2098 阅读 · 0 评论 -
RxJava与Retrofit 结合请求后台数据并解析
1.核心: 一个方法类(HttpMethod)+一个接口(HttpService)public class ADHttpMethods { public static final String BASE_URL = "http://172.20.132.196:1660/i/"; private Retrofit retrofit; private ADHttpSer原创 2017-01-06 21:44:47 · 30062 阅读 · 0 评论 -
activity之间传递 intent 类型的参数
传:Intent adIntent = new Intent();adIntent.putExtra("app", app);adIntent.putExtra("space", space);Bundle b = new Bundle();b.putParcelable("eIntent", intent);adIntent.putExtras(b);context.startA原创 2017-01-15 19:25:27 · 1143 阅读 · 0 评论 -
greendao 数据库升级
新加两个类即可:MigrationHelper 和 MyOpenHelper/** * Created by fc on 2017/4/7. */public class MigrationHelper { private static final String CONVERSION_CLASS_NOT_FOUND_EXCEPTION = "MIGRA原创 2017-04-14 16:52:44 · 1718 阅读 · 0 评论 -
使用正则表达式删除一个字符串中特定两个字符之间的所有字符
删除两个%之间的所有字符: String s = "http://media.advu.cn/stat/index?f=1001&eventid=266&tvType=%appname%&appname=%apptype%&time=%time%"; String result = s.replaceAll("%[^%]*%", ""); Log.原创 2017-05-13 13:56:13 · 28580 阅读 · 0 评论 -
Mockito的简单实践
一、简要概念:1.Mock的概念:mock就是创建一个类的虚假的对象,在测试环境中,用来替换掉真实的对象2.目的:①验证这个对象的某些方法的调用情况,调用了多少次,参数是什么等等②可以随时指定mock对象的某个方法返回什么样的值,或执行什么样的动作。Mockito.verify(mockUserManager, Mockito.times(3)).performLogin(..原创 2017-05-28 16:54:09 · 1648 阅读 · 0 评论 -
绘制类似于腾讯管家测网速的渐变折线图
1.效果图2.实现:path绘制直线+path绘制不规则图形(如果想要动态绘制,可以动态改变图形显示的LayoutParams)/** * Created by fc on 2018/5/7. * <mPaint> * 根据坐标系list来绘制折线 */public class PathLine extends View { private Paint mPaint...原创 2018-05-21 16:41:47 · 535 阅读 · 0 评论