
Android
文章平均质量分 71
cxcbupt
这个作者很懒,什么都没留下…
展开
-
Services overview
1 Services overviewA Service is an application component that can perform long-running operations in the background, and it doesn’t provide a user interface. Another application component can start a...转载 2019-10-21 22:25:03 · 421 阅读 · 0 评论 -
Understand Tasks and Back Stack--Defining launch modes
Defining launch modesUnderstand Tasks and Back Stack--Defining launch modes1、Using the manifest file"standard" (the default mode)"singleTop""singleTask""singleInstance"2、Using Intent flagsFLAG_ACTIVIT...转载 2019-10-13 16:55:01 · 308 阅读 · 0 评论 -
IntentFilter匹配规则
1、Intent typesIntent有两种类型,显式Intent和隐式Intent。使用显式Intent启动的目标组件特别明确,而隐式Intent则需要能够匹配组件在AndroidManifest.xml中声明的<intent-filter>信息。2、Intent Filter当通过隐式Intent启动Activity时,该Intent需要同时匹配Activity在...原创 2018-12-01 21:22:39 · 598 阅读 · 0 评论 -
Android 8.0 Oreo 形为变更之 Notification Channels
最近(2018年11月15日)在上传App升级包至Google Play时,遇到了如下问题:即:当前App的Target API Level 为25(Android 7.1.1 Nougat),要求将App的Target API Level提升到26(Android 8.0 Oreo)或以上。查阅资料发现,Google开发者在持续提高 Android 应用的安全性与性能一文中提到:...原创 2018-11-17 16:50:26 · 837 阅读 · 0 评论 -
持续提高 Android 应用的安全性与性能
为了提升App的安全性及性能,确保每个用户都能够获取最佳体验,Google对Android应用开发者提出了一些变更:今天,我们想要和各位 Android 开发者简单说明一下三项变更,它们背后的原因,以及它们如何让 Android 设备运行得更加安全和流畅。 从 2018 下半年开始,Google Play 要求新 App 和 App 更新包将目标 SDK 版本(Target SDK Ve...转载 2018-11-17 14:56:20 · 545 阅读 · 0 评论 -
Android Studio: Debug Android SDK Source Code
1>查看当前设备的API Level如图,设备Android版本为8.0.0。2>使用SDK Manager下载对应的Source Code注意: a、勾选右下角的“Show Package Details” b、勾选Android 8.0.0(Oreo)下面的“Sources for Android 26”,点击"OK",即可下载该版...原创 2018-11-13 15:25:09 · 948 阅读 · 0 评论 -
Android Bundle--ArrayMap详解
Android 四大组件:Activity、Service、ContentProvider、Broadcast Receiver。在Android App开发中,跟UI相关使用的最多的莫过于Activity了。一个Activity 启动另一个Activity时,可以使用Intent,其包含了一组方法方便携带一些参数:1、MainActivity中包含一个按钮,点击打开DetailAct...原创 2018-11-03 18:47:38 · 1155 阅读 · 0 评论 -
Android Platform Codenames, Versions, API Levels, and NDK Releases
The code names match the following version numbers, along with API levels and NDK releases provided for convenience:https://source.android.com/setup/start/build-numbers原创 2018-06-28 16:04:05 · 247 阅读 · 0 评论 -
ScrollView’s handy trick--android:fillViewport="true"
ScrollView is one of Android’s most commonly used widget and is also one of the easiest to use. When something is too big to fit on screen, drop it inside a ScrollView and you’re done. You can’t even ...转载 2018-03-26 17:25:34 · 287 阅读 · 0 评论 -
OK Http-Interceptors
Interceptors are a powerful mechanism that can monitor, rewrite, and retry calls. Here's a simple interceptor that logs the outgoing request and the incoming response.class LoggingInterceptor im转载 2018-02-06 11:24:42 · 550 阅读 · 0 评论 -
Android Architecture Components--Saving UI States
In cases where the UI data to preserve is simple and lightweight, you might use onSaveInstanceState()alone to preserve your state data. In cases where you have complex data that you want to preserve转载 2018-02-05 16:29:00 · 319 阅读 · 0 评论 -
Android内存泄漏总结
Android 内存泄漏总结箫鉴哥 2016-01-19 13:44:26 浏览42979 评论10android 性能优化 阿里技术协会 内存管理 内存泄漏摘要: Android 内存泄漏总结 内存管理的目的就是让我们在开发中怎么有效的避免我们的应用出现内存泄漏的问题。内存泄漏大家都不陌生了,简单粗俗的讲,就是该被释放的对象没有释放,一直被某个或某些实例所持有却不再被转载 2017-12-29 16:14:26 · 495 阅读 · 0 评论 -
OkHttp Source Code Analyse (Part one)
OkHttp An HTTP & HTTP/2 client for Android and Java applicationsFrom:http://square.github.io/okhttp/Example:OkHttpClient client = new OkHttpClient(); Request request =原创 2017-12-07 11:40:36 · 328 阅读 · 0 评论 -
Android Studio--Read garbage collection messages
Sometimes when a garbage collection event occurs, they're printed to logcat.For more detail about your app's memory, use the Memory Profiler.Dalvik log messagesIn Dalvik (but not ART), every转载 2017-11-03 17:55:42 · 382 阅读 · 0 评论 -
display two or more logcat filters at the same time in Android Studio
up votedown votefavoriteI have declared two LOG.i such as followings in my code:Log.i("pen", pen.toString);Log.i("book", book.toString);Then I added these two filters to转载 2017-09-25 17:30:49 · 312 阅读 · 0 评论 -
Android Studio / Intellij Tip of the Day
Android Studio / Intellij Tip of the Day: tools:attributeIf you have ever entered some testing text in a TextView to see how it looks in the previewer, then this is for you.For any attribute in th转载 2017-08-24 14:06:28 · 1378 阅读 · 0 评论 -
Android Studio Tip of the Day--Breakpoints
Android Studio Tip of the Day--Breakpoints转载 2017-08-23 17:50:59 · 597 阅读 · 0 评论 -
Showing a Dialog Fullscreen or as an Embedded Fragment
You might have a UI design in which you want a piece of the UI to appear as a dialog in some situations, but as a full screen or embedded fragment in others (perhaps depending on whether the device is转载 2017-07-24 19:52:29 · 479 阅读 · 0 评论 -
从fragment开始向上查找实现了某个接口的parent Fragment 或者 Activity
//从fragment开始向上查找实现了接口listenerClass的fragment或activity public T findInterfaceByClass(Fragment fragment, Class listenerClass) { if (listenerClass != null) { if (fragment != null原创 2017-07-24 10:25:50 · 549 阅读 · 0 评论 -
Fragment 与DialogFragment 相互之间传递数据
场景:步骤在FragmentA 中触发显示DialogFragmentB,并传递参数数据mA2B给DialogFragmentB,在DialogFragmentB获取该参数--mA2B。步骤在DialogFragmentB中对传递的参数mA2B进行一些处理得到结果mB2A,最后点击“完成”,需要将mB2A回传给FragmentA中。步骤中的数据传递如何完成呢?步骤数据传递方原创 2017-06-20 11:28:42 · 8100 阅读 · 3 评论 -
你所不知道的Android Studio调试技巧
首先,来看看Android studio中为我们提供的调试面板(标准情况下):这里写图片描述点击右上角Restore ‘Threads’View可先展示目前相关的线程信息:这里写图片描述android studio大体为我们提供了7个功能区:单步调试区断点管理区求值表达式线程帧栈区对象变量区变量观察区下面我们分别对这七转载 2017-05-26 16:37:58 · 675 阅读 · 0 评论 -
Android 如何快速定位当前页面是哪个Activity or Fragment
在日常需求开发中,经常碰到不太熟悉的模块,如何快速定位相应页面对应的Activity/Fragment ? (1)查看当前Activity :adb shell "dumpsys window w | grep name="(2)查看当前栈顶的Activity :adb shell dumpsys activity | grep "mFocusedActivity"(3)查看当前...原创 2017-05-11 11:21:15 · 12929 阅读 · 4 评论 -
Helper class for creating pools of objects.
/* * Copyright (C) 2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * Yo转载 2017-05-04 11:34:31 · 358 阅读 · 0 评论 -
Positions in RecyclerView
Positions in RecyclerView:RecyclerView introduces an additional level of abstraction between the RecyclerView.Adapter and RecyclerView.LayoutManager to be able to detect data set changes in batc转载 2017-03-30 16:24:13 · 307 阅读 · 0 评论 -
Set "gravity" attribute to a RelativeLayout not working
How gravity affects the subviews is shown in the image below.I resized the widths of all the subviews so that what is happening is more clear. Note that the way RelativeLayout handle转载 2017-03-07 18:28:39 · 386 阅读 · 0 评论 -
Notifications --- Preserving Navigation when Starting an Activity
When you start an Activity from a notification, you must preserve the user's expected navigation experience. Clicking Back should take the user back through the application's normal work flow to the转载 2017-01-20 10:58:27 · 387 阅读 · 0 评论 -
Using the RecyclerView
OverviewThe RecyclerView is a new ViewGroup that is prepared to render any adapter-based view in a similar way. It is supposed to be the successor of [[ListView|Using-an-ArrayAdapter-with-ListView]] an转载 2017-01-17 16:40:17 · 1533 阅读 · 0 评论 -
Size, Padding and Margins
The size of a view is expressed with a width and a height. A view actually possess two pairs of width and height values.The first pair is known as measured width and measured height. These dimen转载 2017-01-16 15:31:11 · 566 阅读 · 0 评论 -
Google Android 原生Rom 下载地址及刷机教程--Factory Images for Nexus and Pixel Devices
Google Android 原生Rom 下载地址及刷机教程详见链接:https://developers.google.com/android/images#hammerheadkrt16m原创 2017-01-13 17:48:48 · 84705 阅读 · 2 评论 -
Broadcasts -----Security considerations and best practices
Here are some security considerations and best practices for sending and receiving broadcasts:If you don't need to send broadcasts to components outside of your app, then send and receive local转载 2017-01-06 11:46:22 · 392 阅读 · 0 评论 -
Requesting Permissions at Run Time
Beginning in Android 6.0 (API level 23), users grant permissions to apps while the app is running, not when they install the app.This approach streamlines the app install process, since the user doe转载 2016-12-29 10:34:22 · 371 阅读 · 0 评论 -
Some Tips About Layout Resource
<ViewGroup xmlns:android="http://schemas.android.com/apk/res/android" android:id="@[+][package:]id/resource_name" android:layout_height=["dimension" | "match_parent" | "wrap_content"]转载 2016-12-15 18:10:29 · 326 阅读 · 0 评论 -
Inset Drawable
A drawable defined in XML that insets another drawable by a specified distance. This is useful when a View needs a background that is smaller than the View's actual bounds.转载 2016-12-14 21:13:36 · 372 阅读 · 0 评论 -
Launch-Time Performance----Profiling Launch Performance
In order to properly diagnose start time performance, you can track metrics that show how long it takes your application to start.Time to initial displayFrom Android 4.4 (API level 19), logcat转载 2016-12-13 14:13:00 · 403 阅读 · 0 评论 -
Defining and Enforcing Permissions
To enforce your own permissions, you must first declare them in your AndroidManifest.xml using one or more elements.For example, an application that wants to control who can start one of its acti原创 2016-12-09 11:34:40 · 262 阅读 · 0 评论 -
Activity configChanges 含义
我们知道,默认情况下,当系统配置发生改变后(如旋转手机屏幕),Activity会被重新创建.有时候我们并不想Activity被重新创建,这时可以通过在mannifest.xml文件中指定该Activity相应的configChanges属性,以防止该属性发生变化时Activity被重新创建(当指定的属性发生变化时,Activity不会被重新创建,而是调用该Activity的onConfigur原创 2016-12-09 10:44:35 · 370 阅读 · 0 评论 -
View.setBackgroundResource(int resId)当resId代表的Drawable带有Padding时,会改变View本身的Padding值
View.setBackgroundResource(int resId)源码如下:/** * Set the background to a given Drawable, or remove the background. If the * background has padding, this View's padding is set to the原创 2016-12-06 16:10:52 · 1032 阅读 · 0 评论 -
Activity内嵌Fragment,当Activity recreate时Fragment被添加多次,造成相互遮盖
问题描述:由于某些原因(如旋转屏幕,或内存不足时)造成Activity被destroy ,当再次回到该Activity时,系统会recreate 该Activity , if your activity instance is destroyed and recreated, the state of the layout is restored to its previous state w原创 2016-12-06 15:16:57 · 3305 阅读 · 0 评论 -
Filtering Log Output
Filtering Log OutputEvery Android log message has a tag and a priority associated with it.The tag of a log message is a short string indicating the system component from which the message or转载 2016-11-23 15:44:47 · 282 阅读 · 0 评论 -
Android Custom View ---->invalidate() 、postInvalidate() and requestLayout()
invalidate():View本身调用,迫使view重绘,需要在UI线程中自身调用。当View的appearance发生改变,比如状态改变(enable,focus),背景改变,隐显改变等,这些都属于appearance范畴,都会引起invalidate操作。所以当我们改变了View的appearance,需要更新界面显示,就可以直接调用invalidate方法。View(非容器类)调用inv转载 2016-11-07 14:24:46 · 600 阅读 · 1 评论