![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
android
婉琪
上海融链科技有限公司
展开
-
android 杀死进程的方法总结
第一种: 只能杀死当天进程 int mid=android.os.Process.myPid();android.os.Process.killProcess(mid);第二种:可以杀死任意ActivityManager om=(ActivityManager)getSystemService(ACTIVITY_SERVICE);原创 2013-09-09 14:06:44 · 978 阅读 · 0 评论 -
android 添加网络权限后还是不能访问网络
在4.2以上的系统再添加访问权限之后,发现仍然不能访问网络。需要添加以下代码:StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() .detectDiskReads() .detectDiskWrites() .detectNetwork() .penaltyLog() .build());原创 2013-09-18 14:27:58 · 2374 阅读 · 3 评论 -
android 调用webservice 接口
package com.example.test;import java.io.IOException;import org.ksoap2.SoapEnvelope;import org.ksoap2.SoapFault;import org.ksoap2.serialization.SoapObject;import org.ksoap2.serialization.SoapSer转载 2013-09-17 22:55:46 · 627 阅读 · 0 评论 -
android ;检查网络是否可以连接
private boolean isConnected(){ ConnectivityManager mConnectivity = (ConnectivityManager) this.getSystemService(CONNECTIVITY_SERVICE); TelephonyManager mTelephony = (TelephonyMana原创 2013-09-22 10:42:24 · 560 阅读 · 0 评论 -
android listview,GridView 和 ScrollView
前段时间 遇到 listview 和scrollview 布局的问题 ,现在提供一个解决方案 if (listAdapter == null || listAdapter.getCount() == 0) { return; } int totalHeight = 0;原创 2015-04-16 11:16:14 · 727 阅读 · 0 评论 -
android EditText 如何使ellipse 起作用
如何实现EditText 的 ellipse 起作用,看过很多的文章,也看过别人的实现。但是都不如意,以下是我的几种实现方式的探索:实现之前请先设置相关参数,例如:setEllipsize(TextUtils.TruncateAt.END);setSingleLine();setLines(1);首先最简单的设置,在xml 中设置editorable = false,enable = fa原创 2016-06-16 15:14:15 · 986 阅读 · 0 评论 -
android LayoutInflater加载的布局大小不受控制
在使用LayoutInflater 加载布局时,经常会碰到这样的情况,明明在布局里设置了布局的大小,为什么就是不起作用,但是同样的布局 在setContentView() 中就可以起作用呢!在查看底层LayoutInflater 中的inflate 方法中终于找到了答案!首先 我们来看 inflate(intresource, ViewGroup root, booleanattach原创 2016-08-16 17:09:41 · 3113 阅读 · 1 评论 -
android service中弹出dialog对话框
我们都知道在Activity中弹出Dialog很正常,因为Dialog是基于Window弹出。但是我们经常会遇到这样的需求,需要在service 中弹出一个Dialog对话框,做法有两种第一种,使用Activity,theme设置成 Dialog 并添加:intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 即可实现效果。第二种,仍然使用转载 2016-09-09 16:27:26 · 3118 阅读 · 0 评论 -
android EditText setInputType,setRawInputType 的使用详解
今天 我来分享一下这两个方法的使用:setInputType 简单来说 就是设置EditText的输入法和输入内容限制: /** * Set the type of the content with a constant as defined for {@link EditorInfo#inputType}. This * will take care of chan原创 2016-10-09 11:38:12 · 5082 阅读 · 1 评论 -
Service Intent must be explicit 原因和解决方法
在android 5.0系统以上,我们知道启动service时需要显示声明 Intent intent = new Intent(this, CoreService.class); startService(intent); Intent intent = new Intent(this, CoreService.class); st原创 2016-09-23 14:57:40 · 726 阅读 · 0 评论 -
java volatile 关键字的含义和作用
转载 http://www.cnblogs.com/dolphin0520/p/3920373.html 写的不错这里我们主要来区别几个关键字:Volatile,const, synchronized1.const 声明常量定义的时候使用,是保证这个值不被修改的修饰符。2.synchronized 这个关键适用于多进程中,保证线程安全的,确保操作的原子性。3.Volatile 这个转载 2016-09-27 11:00:36 · 469 阅读 · 0 评论 -
Android 设置全局字体大小
网上很多另类做法也可以实现字体大小动态变化,不过都是代码侵入式写法,特别的恶心,这都是不会正确的做法,一、我现在讲的是另外一种实现方式,代码无侵入,实现方式如下:1.在你的BaseActivity 中添加 @Override public Resources getResources() { Resources resources = super.getRes原创 2017-06-06 17:36:47 · 3196 阅读 · 0 评论 -
android 解决ViewPager与Gallery事件冲突
public class UserGallery extends Gallery implements OnGestureListener { ViewPager mPager; public ViewPager getmPager() { return mPager; } pu原创 2013-09-09 14:23:04 · 1327 阅读 · 0 评论 -
android 调用其他应用的归类
Android Intent调用Java代码://调用浏览器Uriuri=Uri.parse("");Intentit=newIntent(Intent.ACTION_VIEW,uri);startActivity(it);//显示某个坐标在地图上Uriuri=Uri.parse("geo:38.899533,-77.03原创 2013-09-09 14:10:25 · 633 阅读 · 0 评论 -
android 代码混淆
第一步: 在 proguard-project.txt 文件或者 proguard.cfg 输入相应的规则-optimizationpasses 5 -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontpreverify -verbose -optimizations !code/si原创 2013-09-09 14:19:31 · 686 阅读 · 0 评论 -
android socket 即时通信
public class TestClient { static DataInputStream dis =null; static DataOutputStream dos= null; /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method st转载 2013-09-09 14:26:27 · 626 阅读 · 0 评论 -
android 下载好了自动安装apk文件
private void install_soft() { private static String str_soft_path = "/sdcard/msoft"; File file = new File(str_soft_path + "/fuck.apk");原创 2013-09-09 14:32:27 · 1058 阅读 · 0 评论 -
android pull 解析
public class PullParseService { public static List getBooks(InputStream inputStream) throws Exception{ List books = null; Book book = null; XmlPullParser parser原创 2013-09-09 14:14:53 · 501 阅读 · 0 评论 -
android 获取手机的唯一标识符
/* 获取设备唯一标识码 mac */ public static String getDeviceId(Context context) { StringBuilder deviceId = new StringBuilder(); // 渠道标志 deviceId.append("a"); try { //wifi mac地址 WifiMa原创 2013-09-09 14:34:12 · 1718 阅读 · 0 评论 -
android 文件搜索
第一:新建一个classimport java.io.File; import java.io.FilenameFilter;public class MusicFilter implements FilenameFilter{ @Override public boolean accept(File dir, String filename) { // TODO Auto-原创 2013-09-09 14:34:56 · 763 阅读 · 0 评论 -
android 获取当前时间
/** 获取当前时间public static String getCurrentTime(){Time time = new Time("GMT+8");time.setToNow(); //获取系统时间return time.year + "年" + (time.month + 1 ) + "月" + time.monthDay +"日";}/** 获取当前星期*/publ原创 2013-09-09 14:37:36 · 1478 阅读 · 0 评论 -
android 给相片添加相应的时间
ExifInterface exif = new ExifInterface(filepath);//filepath 照片路径exif.setAttribute(ExifInterface.TAG_DATETIME, date);原创 2013-09-09 14:40:08 · 1062 阅读 · 0 评论 -
android 中文转成拼音
import net.sourceforge.pinyin4j.PinyinHelper;import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;p原创 2013-09-09 17:12:14 · 500 阅读 · 0 评论 -
Execution failed for task ':app:mergeDebugResources'
ReactNative android配置中报错Execution failed for task ':app:mergeDebugResources'.> Error: Cannot create directory E:\project\code\app\DriverApp\android\app\build\intermediates\res\merged\debug\values原创 2017-08-24 10:22:15 · 2101 阅读 · 2 评论