android 常用方法

2021-07-09 23:16:06 字數 811 閱讀 2809

package com.sunkiha.mydemo.mydemo.comm.util;

import android.content.context;

import android.content.pm.packageinfo;

import android.content.res.resources;

import android.graphics.drawable.drawable;

/** * created by administrator on 2016/2/16.

*/public class s

/*** 根據資源的名字獲取它的id

** @param name 要獲取的資源的名字

* @param deftype 資源的型別,如drawable, string 。。。

* @return 資源的id

*/public int getresid(string name, string deftype)

/*** 獲取有關本程式的資訊。

** @return 有關本程式的資訊。

*/public apkinfo getapkinfo() catch (exception e)

return apkinfo;

}public class apkinfo

}

retrofit 傳送body json 資料方法

@post("shopping/scansubmit")

flowablescansubmit(@body mapm);

android檔案操作常用方法

判斷檔案是否存在 判斷檔案是否存在。param filepath 檔案路徑。return 檔案是否存在。public satic boolean hosti istfile string filepath return false sd卡寫入檔案操作 判斷sdcard是否存在。return sd卡存...

Android常用工具方法

1.從流中解析新聞集合 使用pull解析器解析xml資料 private static listgetnewlistfrominputstream inputstream is throws exception else if new equals tagnme else if title equa...

Android測量控制項常用的方法

第一種 直接 view.getwidth,getheight 但是在oncreate 中得到的都是0,因為還沒準備好。但可以在以後的方法中獲得寬高值。linearlayout.layoutparams linearparams linearlayout.layoutparams textview.g...