當前位置:首頁 » 安卓系統 » android批量

android批量

發布時間: 2022-06-29 04:06:18

⑴ android可以批量移動、刪除文件嗎怎麼操作

去下一個文件管理軟體,比如「Winten文件管理器」,裡面自帶批量移動、刪除文件功能

安卓手機怎麼批量刪除照片

安卓手機可以按住想要刪除的照片然後把需要刪除的都勾選上這樣就可以批量刪除了。

⑶ 安卓手機怎麼批量刪除聯系人 手機知道

1、在手機的屏幕上找到(設置)這個選項

⑷ 請問android裡面如何對id進行批量處理

把他們放在一個父容器里,比如一個LinearLayout parent
int childCount = parent.getChildCount();
for(int i=0;i<childCount;i++){
Button btn = (Button) parent.getChildAt(i);
**************************
}

⑸ android 如何優化ant 批量打包

1.配置java的環境變數

很多Java程序員由於使用Eclipse不配置Java環境變數也能正常運行代碼。但是如果想使用Ant命令批量打包本步驟必不可少。
2. 下載Ant(這里的Ant不是eclipse和android SDk裡面自帶的ant)

3. 解壓Ant並配置環境變數
a) 解壓Ant,比如解壓到D:\ant
b) 我的電腦->屬性->高級->環境變數
c) 系統變數新建ANT_HOME,變數值為d:\ant
d) 系統變數新建或修改PATH:將%ANT_HOME%\bin;%ANT_HOME%\lib添加到環境變數的PATH中 (注意以上
路徑均用反斜杠)

4. 驗證ant配置是否正確
在控制台輸入Cmd 回車, ant 回車,如果出現:
Buildfile: build.xml does not exist!
Build failed
恭喜你已經ant配置成功!!
Ant批量打包的基本思想是,每次打包後自動替換渠道號,然後再次打包從而實現多渠道打包的目的。
但是Ant不支持循環,怎樣循環打包? 擴展包Ant-contrib能輕松解決這個問題.可以翻牆的1.0b3.jar放到Ant的lib文件夾即可.

5. 編寫build.xml
將以下帶有顏色的字體(包括路徑,項目名稱)都改成正確的名稱
<?xml version="1.0" encoding="UTF-8"?>
<project name="ThumbPlay" default="help">

<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
<property file="local.properties" />

<!-- The ant.properties file can be created by you. It is only edited by the
'android' tool to add properties to it.
This is the place to change some Ant specific build properties.
Here are some properties you may want to change/update:

source.dir
The name of the source directory. Default is 'src'.
out.dir
The name of the output directory. Default is 'bin'.

For other overridable properties, look at the beginning of the rules
files in the SDK, at tools/ant/build.xml

Properties related to the SDK location or the project target should
be updated using the 'android' tool with the 'update' action.

This file is an integral part of the build system for your
application and should be checked into Version Control Systems.

-->
<property file="ant.properties" />

<!-- The project.properties file is created and updated by the 'android'
tool, as well as ADT.

This contains project specific properties such as project target, and library
dependencies. Lower level build properties are stored in ant.properties
(or in .classpath for Eclipse projects).

This file is an integral part of the build system for your
application and should be checked into Version Control Systems. -->
<loadproperties srcFile="project.properties" />

<!-- quick check on sdk.dir -->
<fail
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
unless="sdk.dir"
/>

<!-- extension targets. Uncomment the ones where you want to do custom work
in between standard targets -->
<!--
<target name="-pre-build">
</target>
<target name="-pre-compile">
</target>

<target name="-post-compile">
</target>
-->

<!-- Import the actual build file.

To customize existing targets, there are two options:
- Customize only one target:
- /paste the target into this file, *before* the
<import> task.
- customize it to your needs.
- Customize the whole content of build.xml
- /paste the content of the rules files (minus the top node)
into this file, replacing the <import> task.
- customize to your needs.

***********************
****** IMPORTANT ******
***********************
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
in order to avoid having your file be overridden by tools such as "android update project"
-->
<!-- version-tag: 1 -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="D:/androidDev/batch-package-tool/ant1.8.3/lib/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<import file="${sdk.dir}/tools/ant/build.xml" />

<target name="deploy">
<foreach target="modify_manifest" list="${market_channels}" param="channel" delimiter=",">
</foreach>
</target>

<target name="modify_manifest">
<!--<replaceregexp file="AndroidManifest.xml" encoding="utf-8" match="android:value="(.*)"" replace=""/>-->
<replaceregexp flags="g" byline="false">
<regexp pattern="android:name="UMENG_CHANNEL" android:value="(.*)"" />
<substitution expression="android:name="UMENG_CHANNEL" android:value="${channel}"" />
<fileset dir="" includes="AndroidManifest.xml" />
</replaceregexp>
<!--<property name="out.release.file" value="${out.absolute.dir}/${channel}.apk"/>-->
<antcall target="release"/>
< tofile="${gos.path}/ThumbPlay_${channel}.apk">
<fileset dir="${out.absolute.dir}/" includes="ThumbPlay-release.apk" />
</>
<delete includeEmptyDirs="true">
<fileset dir="${out.absolute.dir}" includes="**/*"/>
</delete>
<echo message="==========================="/>
</target>
</project>
6. 配置local.properties
sdk.dir=D:\\androidDev\\android-sdk 改成你的SDK所在的目錄,注意轉義字元
7. 配置ant.properties
# the config file for batch package.
application.package=com.leyou.thumb (你的apk文件的包名)
ant.project.name=ThumbPlay (你的apk文件的工程名)
java.encoding=utf-8
out.absolute.dir=C:/compile
gos.path=Z:/app-version/test (打好的渠道包要放到的目的位置)
key.store=D:/androidApk/thumbplay/thumbplay.keystore (keystore文件路徑)
key.store.password=wushenshiji999 (keystore文件路徑)
key.alias=mugame (keystore文件別名)
key.alias.password=wushenshiji999 (keystore文件別名密碼)
app_version=1.0.4 (要打的渠道包的版本名稱)
market_channels=guanwang,shuihu,wushen,shenhua,huawei (渠道名稱,要以逗號分隔,必須在一行內)

⑹ android 怎麼批量插入聯系人,高效率的方法

參考下面:
ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>();
ArrayList<VCardEntry> list = params[0];
Iterator<VCardEntry> it = null;
if (list != null) {
it = list.iterator();
}
Logger.v(TAG,"--->doInBackground it:"+it);
int rawContactInsertIndex = 0;
while(it!= null && it.hasNext()) {
VCardEntry mv = it.next();
rawContactInsertIndex = ops.size(); // 有了它才能給真正的實現批量添加
Logger.v(TAG,"--->>>>>>>name:"+mv.getDisplayName());
Logger.v(TAG,"--->>>>>>>getPhoneList:"+mv.getPhoneList());
if (mv.getPhoneList() != null) {
ops.add(ContentProviderOperation
.newInsert(RawContacts.CONTENT_URI)
.withValue(RawContacts.ACCOUNT_TYPE, ACCOUNT_NAME)
.withValue(RawContacts.ACCOUNT_NAME, ACCOUNT_TYPE)
.withYieldAllowed(true).build());
// add name
ops.add(ContentProviderOperation
.newInsert(Data.CONTENT_URI)
.withValueBackReference(Data.RAW_CONTACT_ID, rawContactInsertIndex)
.withValue(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE)
.withValue(StructuredName.DISPLAY_NAME, mv.getDisplayName())
.withYieldAllowed(true).build());
// add number
for(VCardEntry.PhoneData phone : mv.getPhoneList()) {
Logger.v(TAG,"--->>>>>>>number:"+phone.getNumber());
ops.add(ContentProviderOperation
.newInsert(Data.CONTENT_URI)
.withValueBackReference(Data.RAW_CONTACT_ID, rawContactInsertIndex)
.withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE)
.withValue(Phone.NUMBER, phone.getNumber())
.withValue(Phone.TYPE, Phone.TYPE_MOBILE)
.withValue(Phone.LABEL, "")
.withYieldAllowed(true).build());
}
}
}
ContentProviderResult[] results = null;
if (ops != null) {
try {
results = mContext.getContentResolver()
.applyBatch(ContactsContract.AUTHORITY, ops);
} catch (RemoteException e) {
Logger.e(TAG,String.format("%s: %s", e.toString(), e.getMessage()));
} catch (OperationApplicationException e) {
Logger.e(TAG,String.format("%s: %s", e.toString(), e.getMessage()));
}
}

⑺ android如何實現圖片批量上傳

首先,以下架構下的批量文件上傳可能會失敗或者不會成功:
1.android客戶端+springMVC服務端:服務端採用org.springframework.web.multipart.MultipartHttpServletRequest作為批量上傳接收類,這種搭配下的批量文件上傳會失敗,最終服務端只會接受到一個文件,即只會接受到第一個文件。可能因為MultipartHttpServletRequest對servlet原本的HttpServletRequest類進行封裝,導致批量上傳有問題。
2.android客戶端+strutsMVC服務端:
上傳成功的方案:
採用android客戶端+Servlet(HttpServletRequest)進行文件上傳。
Servlet端代碼如下:

[java] view plainprint?
DiskFileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
try
{
List items = upload.parseRequest(request);
Iterator itr = items.iterator();
while (itr.hasNext())
{
FileItem item = (FileItem) itr.next();
if (item.isFormField())
{
System.out.println("表單參數名:" + item.getFieldName() + ",表單參數值:" + item.getString("UTF-8"));
}
else
{
if (item.getName() != null && !item.getName().equals(""))
{
System.out.println("上傳文件的大小:" + item.getSize());
System.out.println("上傳文件的類型:" + item.getContentType());
// item.getName()返回上傳文件在客戶端的完整路徑名稱
System.out.println("上傳文件的名稱:" + item.getName());

File tempFile = new File(item.getName());
// 上傳文件的保存路徑
File file = new File(sc.getRealPath("/") + savePath, tempFile.getName());
item.write(file);
request.setAttribute("upload.message", "上傳文件成功!");
} else
{
request.setAttribute("upload.message", "沒有選擇上傳文件!");
}
}
}
}
catch (FileUploadException e)
{
e.printStackTrace();
}
catch (Exception e)
{
e.printStackTrace();
request.setAttribute("upload.message", "上傳文件失敗!");
}
request.getRequestDispatcher("/uploadResult.jsp").forward(request, response);

android端代碼如下:

[java] view plainprint?
public class SocketHttpRequester {
/**
*多文件上傳
* 直接通過HTTP協議提交數據到伺服器,實現如下面表單提交功能:
* <FORM METHOD=POST ACTION="http://192.168.1.101:8083/upload/servlet/UploadServlet" enctype="multipart/form-data">
<INPUT TYPE="text" NAME="name">
<INPUT TYPE="text" NAME="id">
<input type="file" name="imagefile"/>
<input type="file" name="zip"/>
</FORM>
* @param path 上傳路徑(註:避免使用localhost或127.0.0.1這樣的路徑測試,因為它會指向手機模擬器,你可以使用http://www.iteye.cn或http://192.168.1.101:8083這樣的路徑測試)
* @param params 請求參數 key為參數名,value為參數值
* @param file 上傳文件
*/
public static boolean post(String path, Map<String, String> params, FormFile[] files) throws Exception{
final String BOUNDARY = "---------------------------7da2137580612"; //數據分隔線
final String endline = "--" + BOUNDARY + "--\r\n";//數據結束標志

int fileDataLength = 0;
for(FormFile uploadFile : files){//得到文件類型數據的總長度
StringBuilder fileExplain = new StringBuilder();
fileExplain.append("--");
fileExplain.append(BOUNDARY);
fileExplain.append("\r\n");
fileExplain.append("Content-Disposition: form-data;name=\""+ uploadFile.getParameterName()+"\";filename=\""+ uploadFile.getFilname() + "\"\r\n");
fileExplain.append("Content-Type: "+ uploadFile.getContentType()+"\r\n\r\n");
fileExplain.append("\r\n");
fileDataLength += fileExplain.length();
if(uploadFile.getInStream()!=null){
fileDataLength += uploadFile.getFile().length();
}else{
fileDataLength += uploadFile.getData().length;
}
}
StringBuilder textEntity = new StringBuilder();
for (Map.Entry<String, String> entry : params.entrySet()) {//構造文本類型參數的實體數據
textEntity.append("--");
textEntity.append(BOUNDARY);
textEntity.append("\r\n");
textEntity.append("Content-Disposition: form-data; name=\""+ entry.getKey() + "\"\r\n\r\n");
textEntity.append(entry.getValue());
textEntity.append("\r\n");
}
//計算傳輸給伺服器的實體數據總長度
int dataLength = textEntity.toString().getBytes().length + fileDataLength + endline.getBytes().length;

URL url = new URL(path);
int port = url.getPort()==-1 ? 80 : url.getPort();
Socket socket = new Socket(InetAddress.getByName(url.getHost()), port);
OutputStream outStream = socket.getOutputStream();
//下面完成HTTP請求頭的發送
String requestmethod = "POST "+ url.getPath()+" HTTP/1.1\r\n";
outStream.write(requestmethod.getBytes());
String accept = "Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*\r\n";
outStream.write(accept.getBytes());
String language = "Accept-Language: zh-CN\r\n";
outStream.write(language.getBytes());
String contenttype = "Content-Type: multipart/form-data; boundary="+ BOUNDARY+ "\r\n";
outStream.write(contenttype.getBytes());
String contentlength = "Content-Length: "+ dataLength + "\r\n";
outStream.write(contentlength.getBytes());
String alive = "Connection: Keep-Alive\r\n";
outStream.write(alive.getBytes());
String host = "Host: "+ url.getHost() +":"+ port +"\r\n";
outStream.write(host.getBytes());
//寫完HTTP請求頭後根據HTTP協議再寫一個回車換行
outStream.write("\r\n".getBytes());
//把所有文本類型的實體數據發送出來
outStream.write(textEntity.toString().getBytes());
//把所有文件類型的實體數據發送出來
for(FormFile uploadFile : files){
StringBuilder fileEntity = new StringBuilder();
fileEntity.append("--");
fileEntity.append(BOUNDARY);
fileEntity.append("\r\n");
fileEntity.append("Content-Disposition: form-data;name=\""+ uploadFile.getParameterName()+"\";filename=\""+ uploadFile.getFilname() + "\"\r\n");
fileEntity.append("Content-Type: "+ uploadFile.getContentType()+"\r\n\r\n");
outStream.write(fileEntity.toString().getBytes());
if(uploadFile.getInStream()!=null){
byte[] buffer = new byte[1024];
int len = 0;
while((len = uploadFile.getInStream().read(buffer, 0, 1024))!=-1){
outStream.write(buffer, 0, len);
}
uploadFile.getInStream().close();
}else{
outStream.write(uploadFile.getData(), 0, uploadFile.getData().length);
}
outStream.write("\r\n".getBytes());
}
//下面發送數據結束標志,表示數據已經結束
outStream.write(endline.getBytes());

BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
if(reader.readLine().indexOf("200")==-1){//讀取web伺服器返回的數據,判斷請求碼是否為200,如果不是200,代表請求失敗
return false;
}
outStream.flush();
outStream.close();
reader.close();
socket.close();
return true;
}

/**
*單文件上傳
* 提交數據到伺服器
* @param path 上傳路徑(註:避免使用localhost或127.0.0.1這樣的路徑測試,因為它會指向手機模擬器,你可以使用http://www.itcast.cn或http://192.168.1.10:8080這樣的路徑測試)
* @param params 請求參數 key為參數名,value為參數值
* @param file 上傳文件
*/
public static boolean post(String path, Map<String, String> params, FormFile file) throws Exception{
return post(path, params, new FormFile[]{file});
}
}

⑻ 如何在安卓手機上批量重命名文件啊

  1. 先下載 文件管理器,可以在網路應用裡面搜索,安裝完成。

  2. 打開 SD 卡,選擇要重命名的文件。(以常見的 MP3文件舉例)

  3. 按住一個文件不放手,直至進入多選狀態,把要重命名的文件都先選上。

  4. 點擊最下面的選項,重命名。

  5. 以一定的名稱按序號重命名文件,我們原來的文件上1.mp3……5.mp3

  6. 為了方便管理,我舉例把它們改為 歌曲1.mp3……歌曲5.mp3,因為播放器在升降排序的時候,不會按照數字大小排列,而是按照開頭數字大小.

  7. 如下圖操作,點擊確定,就會完成如圖。


    最後還有 兩種批量重命名,操作方法雷同,給大家看下結果

1,新文件名+舊文件名

2,批量改掉擴展名

把兩種重命名方法同時使用舉例,要把以上的文件重命名為擴展名為 .mp4的文件,因此文件開頭不能是歌曲了,應該改成視頻歌曲,把這兩種方法都使用了一遍

⑼ Android 可以用代碼實現批量刪除某一類型文件嗎 比如rm /sdcard/*.mp4*

當然可以了,可以使用File對象的delete方法刪除,如果不用這個方法,也可以使用Runtime.getRuntime().exec("rm
file");但前提是你的android系統的底層內核包含rm命令.你可以使用adb
shell,查看system/bin,system/xbin等文件夾中,如果其中包含rm那就可以;另外這個應用需要root許可權,還有就是rm在命令行使用的時候就加上強制刪除參數,即"rm
-rf"

⑽ android 怎麼批量調用百度地圖的地理編碼功能

一、下載最新網路地圖sdk,導入工程中

二、根據官方文檔初始化地圖,在main.xml中添加對應布局

<com..mapapi.map.MapView
android:id="@+id/bmapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"/>

//獲取地圖控制項引用
mapView = (MapView) findViewById(R.id.bmapView);
Map = mapView.getMap(); // 獲取地圖控制器

三、通過地理編碼獲取經緯度

p//第一步,創建地理編碼檢索實例;
mSearch=GeoCoder.newInstance();//第二步,創建地理編碼檢索監聽者;
=(){publicvoidonGetGeoCodeResult(GeoCodeResultresult){if(result==null||result.error!=SearchResult.ERRORNO.NO_ERROR){//沒有檢索到結果
}else{//獲取地理編碼結果
floatlatitude=(float)result.getLocation().latitude;floatlongitude=(float)result.getLocation().longitude;finalLatLngpoint=newLatLng(latitude,longitude);//載入自定義marker
ViewpopMarker=View.inflate(MainActivity.this,R.layout.pop,null);
Bitmapbitmap1=getViewBitmap(popMarker);
=BitmapDescriptorFactory.fromBitmap(bitmap1);//構建MarkerOption,用於在地圖上添加Marker
OverlayOptionsoption=newMarkerOptions()
.position(point)
.icon(bitmapDescriptor);//在地圖上添加Marker,並顯示
Markermarker=(Marker)Map.addOverlay(option);

}
}@Override
(ReverseGeoCodeResultresult){if(result==null||result.error!=SearchResult.ERRORNO.NO_ERROR){//沒有找到檢索結果
}//獲取反向地理編碼結果
}
};//第三步,設置地理編碼檢索監聽者;
mSearch.setOnGetGeoCodeResultListener(listener);//第四步,發起地理編碼檢索;
mSearch.geocode(newGeoCodeOption()
.city("北京")
.address("海淀區上地十街10號"));//網路地圖上少一個括弧
將View轉換成Bitmap的方法/**
*將View轉換成Bitmap
*@paramaddViewContent
*@return
*/privateBitmapgetViewBitmap(ViewaddViewContent){

addViewContent.setDrawingCacheEnabled(true);

addViewContent.measure(
View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED),
View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED));
addViewContent.layout(0,0,
addViewContent.getMeasuredWidth(),
addViewContent.getMeasuredHeight());

addViewContent.buildDrawingCache();
BitmapcacheBitmap=addViewContent.getDrawingCache();
Bitmapbitmap=Bitmap.createBitmap(cacheBitmap);returnbitmap;
}

Marker的自定義布局pop.xml

<?xmlversion="1.0"encoding="utf-8"?><LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical">
<ImageView
android:id="@+id/iv_title"
android:layout_width="42dp"
android:layout_height="42dp"
/>
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="42dp"
android:padding="5dp"
android:gravity="center"
android:text="標題"
android:textSize="16dp"/></LinearLayout>
熱點內容
lua腳本學習 發布:2025-05-14 08:20:55 瀏覽:713
python文件刪除一行 發布:2025-05-14 08:06:58 瀏覽:721
如何下載奧特曼高級化3安卓版 發布:2025-05-14 07:47:31 瀏覽:346
qml文件修改後編譯未生效 發布:2025-05-14 07:31:00 瀏覽:331
內到內演算法 發布:2025-05-14 07:29:11 瀏覽:34
文件夾名字不顯示 發布:2025-05-14 07:27:47 瀏覽:775
oracle的資料庫驅動jar 發布:2025-05-14 07:23:20 瀏覽:556
我的世界電腦版伺服器手機版能進嗎 發布:2025-05-14 07:22:01 瀏覽:680
達內培訓php多少錢 發布:2025-05-14 07:19:10 瀏覽:27
python位元組轉字元串 發布:2025-05-14 07:06:35 瀏覽:423