`
文章列表
/* * Copyright (C) 2007 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. * You may obtain a copy of the License at * *      http://www.apache.org/licenses/LICENSE-2.0 ...
private void uploadFile()   {     String end = "\r\n";     String twoHyphens = "--";     String boundary = "*****";     try     {       URL url =new URL(actionUrl);       HttpURLConnection con=(HttpURLConnection)url.openConnection();       /* 允许Input、Output,不使用Cache */   ...
@Override     public View getView(int position, View convertView,         ViewGroup parent)     {       // TODO Auto-generated method stub       /* 建立一个ImageView对象 */       ImageView imageView = new ImageView(this.myContext);       try       {         /* new URL物件将网址传入 */         URL aryURI = new UR ...
/* 开启播放录音文件的程序 */   private void openFile(File f)   {     Intent intent = new Intent();     intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);     intent.setAction(android.content.Intent.ACTION_VIEW);     String type = getMIMEType(f);     intent.setDataAndType(Uri.fromFile(f), type);     startActivity ...
在一个Activity中启动另一个Activy,取得数据,如:在应用 A 中启动 通讯录,选择目标用户,返回,以便在A 中使用选择的通讯录数据,基本过程如下:            Intent intent = new Intent();         /* 开启Pictures画面Type设定为image */        intent.setType("image/*");  //通讯录的不能这样写,        /* 使用Intent.ACTION_GET_CONTENT这个Action */        intent.setAction(Intent. ...
安排作业:       long repeatTime=24*60*60*1000;        /* 将更换桌布的排程叵丈AlarmManager中 */        Intent intent = new Intent(EX06_13.this,MyReceiver.class);        PendingIntent sender = PendingIntent.getBroadcast(EX06_13.this,            0, intent, 0);        AlarmManager am = (AlarmManager)getSystemService(A ...
private void showSize()   {     /* 将TextView及ProgressBar设定为空值及0 */    myTextView.setText(""); myProgressBar.setProgress(0);    /* 判断记忆卡是否插入 */    if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED))    {       /* 取得SD CARD档案路径一般是/sdcard */      File path = Environmen ...
请注意下面程序中的黑体部分:   package irdc.EX06_05; import android.app.Activity; import android.content.BroadcastReceiver;import android.content.Context;import android.content.Intent;import android.content.IntentFilter;import android.os.Bundle; import android.telephony.SmsMessage;import android.widget.TextView ...
 <service android:name=".mService1" android:exported="true" android:process=":remote" ></service>   /* 自定义mService类继承Service类 */public class mService1 extends Service{  /* 建立Handler对象,作为线程传递 postDelayed之用 */  private Handler objHandler = new Handler();    / ...
mActivityManager = (ActivityManager)EX05_21.this.getSystemService(ACTIVITY_SERVICE);   //最多获取 100 个运行信息 List<ActivityManager.RunningTaskInfo> mRunningTasks = mActivityManager.getRunningTasks(100);   //循环获取    for (ActivityManager.RunningTaskInfo amTask : mRunningTasks)  {           //am ...
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>     TelephonyManager telMgr = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);  if(telMgr.getSimState()==telMgr.SIM_STATE_READY)    {     //SIM卡:状态"良好");    }    else if(telMgr.getSimState()==te ...
WifiManager wfm= (WifiManager) this.getSystemService(Context.WIFI_SERVICE); mWiFiManager01 .startScane() ; //启动网络扫描 List<WifiConfiguration> list=wfm.getConfiguredNetworks(); if(list.size()>0){    if(wfm.isWifiEnabled()==false){  //如果 wifi 未启动,则启动        wfm.setWifiEnabled(true);    } ...
             /* 选择几个文件时,弹出要处理文件的ListDialog */    String[] menu={"打开文件","更改文件名","删除文件"};    new AlertDialog.Builder(EX05_15.this)        .setTitle("你要做甚么?")        .setItems(menu,d) /* menu 就是要显示的选择项, d 是 针对不同的选项的处理接口(DialogInterface.OnClickListener)*/        .s ...
用系统默认的方式打开文件:     /* ?手机勺打开文件的method */  private void openFile(File f)   {    Intent intent = new Intent();    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);    intent.setAction(android.content.Intent.ACTION_VIEW);        /* 调用getMIMEType()来取得MimeType */    String type = getMIMEType(f);    /* 设定i ...
执行 SQL : select IDENT_CURRENT( 'mms_send_task ')   可获得 'mms_send_task  表中的自增加字段的最大值,当表内容为空(从未插入数据)时候,获得的为初始值。
Global site tag (gtag.js) - Google Analytics