android代码保存maven
2015-01-23 16:20:47 haoxuezhe1988 阅读数 856
private void GetandSaveCurrentImage() 
    
        //1.构建Bitmap 
        WindowManager windowManager = getWindowManager(); 
        Display display = windowManager.getDefaultDisplay(); 
        int w = display.getWidth(); 
        int h = display.getHeight(); 
 
        Bitmap Bmp = Bitmap.createBitmap( w, h, Config.ARGB_8888 );     
 
        //2.获取屏幕 
        View decorview = this.getWindow().getDecorView();  
        decorview.setDrawingCacheEnabled(true);  
        Bmp = decorview.getDrawingCache();  
 
        String SavePath = getSDCardPath()+"/AndyDemo/ScreenImage";
 
        //3.保存Bitmap  
        try
            File path = new File(SavePath); 
            //文件 
            String filepath = SavePath + "/Screen_1.png"
            File file = new File(filepath); 
            if(!path.exists()){ 
                path.mkdirs(); 
            
            if (!file.exists()) { 
                file.createNewFile(); 
            
 
            FileOutputStream fos = null
            fos = new FileOutputStream(file); 
            if (null != fos) { 
                Bmp.compress(Bitmap.CompressFormat.PNG, 90, fos); 
                fos.flush(); 
                fos.close();   
 
                Toast.makeText(CircleShareActivity.this"截屏文件已保存至SDCard/AndyDemo/ScreenImage/下", Toast.LENGTH_LONG).show(); 
            
 
        catch (Exception e) { 
            e.printStackTrace(); 
        
    
 
    /**
     * 获取SDCard的目录路径功能
     * @return
     */
    private String getSDCardPath(){
        File sdcardDir = null;
        //判断SDCard是否存在
        boolean sdcardExist = Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED);
        if(sdcardExist){
            sdcardDir = Environment.getExternalStorageDirectory();
        }
        return sdcardDir.toString();
    }
2013-08-22 15:46:40 dengweijunkedafu 阅读数 4283

WifiManager mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);

mWifiManager.removeNetwork(networkId); 

mWifiManager.saveConfiguration();



其中networdId必须更具SSID来获取,方法如下:

private int getNetworkId(){

List<WifiConfiguration> wifiConfigurationList = wifiManager.getConfiguredNetworks();
if(wifiConfigurationList != null && wifiConfigurationList.size() != 0){
for (int i = 0; i < wifiConfigurationList.size(); i++) {
WifiConfiguration wifiConfiguration = wifiConfigurationList.get(i);

// wifiSSID就是SSID
if (wifiConfiguration.SSID != null && wifiConfiguration.SSID.equals(wifiSSID)) {
return wifiConfiguration.networkId;

}
}
}

}

2012-04-26 14:38:22 zhuangxujun 阅读数 5243
pacakges/apps/Mms/src/com/android/mms/ui/ComposeMessageActivity
 
1.private void saveMessageToSim(String msgType, long msgId) {
        Intent intent = new Intent();
        intent.putExtra("message_type", msgType);
        intent.putExtra("message_id", msgId);
        intent.putExtra(SELECT_TYPE, SIM_SELECT_FOR_SAVE_MSG_TO_SIM);
        showSimSelectedDialog(intent);
    }


    
   2. private void showSimSelectedDialog(Intent intent) {
        final Intent it = intent;
        List<Map<String, ?>> entries = new ArrayList<Map<String, ?>>();
        for (int i = 0; i < mSimCount; i++) {
            SIMInfo simInfo = mSimInfoList.get(i);
            HashMap<String, Object> entry = new HashMap<String, Object>();

            entry.put("simIcon", simInfo.mSimBackgroundRes);
            int state = getSimStatus(i);
            entry.put("simStatus", MessageUtils.getSimStatusResource(state));
            String simNumber = "";
            if (!TextUtils.isEmpty(simInfo.mNumber)) {
                switch(simInfo.mDispalyNumberFormat) {
                    //case android.provider.Telephony.SimInfo.DISPLAY_NUMBER_DEFAULT:
                    case android.provider.Telephony.SimInfo.DISPLAY_NUMBER_FIRST:
                        if(simInfo.mNumber.length() <= 4)
                            simNumber = simInfo.mNumber;
                        else
                            simNumber = simInfo.mNumber.substring(0, 4);
                        break;
                    case android.provider.Telephony.SimInfo.DISPLAY_NUMBER_LAST:
                        if(simInfo.mNumber.length() <= 4)
                            simNumber = simInfo.mNumber;
                        else
                            simNumber = simInfo.mNumber.substring(simInfo.mNumber.length() - 4);
                        break;
                    case 0://android.provider.Telephony.SimInfo.DISPLAY_NUMBER_NONE:
                        simNumber = "";
                        break;
                }
            }
            if (!TextUtils.isEmpty(simNumber)) {
                entry.put("simNumberShort",simNumber);
            } else {
                entry.put("simNumberShort", "");
            }

            entry.put("simName", simInfo.mDisplayName);
            if (!TextUtils.isEmpty(simInfo.mNumber)) {
                entry.put("simNumber", simInfo.mNumber);
            } else {
                entry.put("simNumber", "");
            }
            if (mAssociatedSimId == (int) simInfo.mSimId) {
                // if this SIM is contact SIM, set "Suggested"
                entry.put("suggested", getString(R.string.suggested));
            } else {
                entry.put("suggested", "");// not suggested
            }
            if (!is3G(i)) {
                entry.put("sim3g", "");
            } else {
                String optr = SystemProperties.get("ro.operator.optr");
                if (optr.equals("OP02")) {
                    entry.put("sim3g", "3G");
                } else {
                    entry.put("sim3g", "");
                }
            }
            entries.add(entry);
        }

        final SimpleAdapter a = new SimpleAdapter(
                this,
                entries,
                R.layout.sim_selector,
                new String[] {"simIcon", "simStatus", "simNumberShort", "simName", "simNumber", "suggested", "sim3g"},
                new int[] {R.id.sim_icon, R.id.sim_status, R.id.sim_number_short, R.id.sim_name, R.id.sim_number, R.id.sim_suggested, R.id.sim3g});
        SimpleAdapter.ViewBinder viewBinder = new SimpleAdapter.ViewBinder() {
            public boolean setViewValue(View view, Object data, String textRepresentation) {
                if (view instanceof ImageView) {
                    if (view.getId() == R.id.sim_icon) {
                        ImageView simicon = (ImageView) view.findViewById(R.id.sim_icon);
                        simicon.setBackgroundResource((Integer) data);
                    } else if (view.getId() == R.id.sim_status) {
                        ImageView simstatus = (ImageView)view.findViewById(R.id.sim_status);
                        if ((Integer)data != -1) {
                            simstatus.setImageResource((Integer)data);
                        }
						else {
							//add by yanjun.yao To bug Tsk_6573_W626Retail00289
							simstatus.setVisibility(View.INVISIBLE);
								}
                    }
                    return true;
                }
                return false;
            }
        };
        a.setViewBinder(viewBinder);
        AlertDialog.Builder b = new AlertDialog.Builder(this);
        b.setTitle(getString(R.string.sim_selected_dialog_title));
        b.setCancelable(true);
        b.setAdapter(a, new DialogInterface.OnClickListener() {
            @SuppressWarnings("unchecked")
            public final void onClick(DialogInterface dialog, int which) {
                updateSendButtonState(false);
                mSelectedSimId = (int) mSimInfoList.get(which).mSimId;
                if (it.getIntExtra(SELECT_TYPE, -1) == SIM_SELECT_FOR_SEND_MSG) {
                    confirmSendMessageIfNeeded();
                } else if (it.getIntExtra(SELECT_TYPE, -1) == SIM_SELECT_FOR_SAVE_MSG_TO_SIM) {
                    //getMessageAndSaveToSim(it);
                    Message msg = mSaveMsgHandler.obtainMessage(MSG_SAVE_MESSAGE_TO_SIM_AFTER_SELECT_SIM);
                    msg.obj = it;
                    //mSaveMsgHandler.sendMessageDelayed(msg, 60);
                    mSaveMsgHandler.sendMessage(msg);
                }
                dialog.dismiss();
            }
        });
        mSIMSelectDialog = b.create();
        mSIMSelectDialog.show();
    }
  3.  private final class SaveMsgHandler extends Handler {
        public SaveMsgHandler(Looper looper) {
            super(looper);
        }
        
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {
                case MSG_QUIT_SAVE_MESSAGE_THREAD: {
                    if (MmsApp.DEBUG) {
                        Log.d("MMSLog", "exit save message thread");
                    }
                    getLooper().quit();
                    break;
                }

                case MSG_SAVE_MESSAGE_TO_SIM: {
                    String type = (String)msg.obj;
                    long msgId = msg.arg1;
                    //saveMessageToSim(type, msgId);
                    getMessageAndSaveToSim(type, msgId);
                    break;
                }

                case MSG_SAVE_MESSAGE_TO_SIM_AFTER_SELECT_SIM: {
                    Intent it = (Intent)msg.obj;
                    getMessageAndSaveToSim(it);
                    break;
                }

                default:
                    break;
            }
        }
    }

4.private void getMessageAndSaveToSim(Intent intent) {
        Log.d("MMSLog", "get message and save to sim, selected sim id = " + mSelectedSimId);
        String msgType = intent.getStringExtra("message_type");
        long msgId = intent.getLongExtra("message_id", 0);
        if (msgType == null) {
            //mSaveMsgHandler.sendEmptyMessage(MSG_SAVE_MESSAGE_TO_SIM_FAILED_GENERIC);
            mUiHandler.sendEmptyMessage(MSG_SAVE_MESSAGE_TO_SIM_FAILED_GENERIC);
            return;
        }
        getMessageAndSaveToSim(msgType, msgId);
    }

  5.  private void getMessageAndSaveToSim(String msgType, long msgId){
        int result = 0;
        MessageItem msgItem = getMessageItem(msgType, msgId, true);
        if (msgItem == null || msgItem.mBody == null) {
            Log.e("MMSLog", "getMessageAndSaveToSim, can not get Message Item.");
            return;
        }
        
        String scAddress = null;
        if (FeatureOption.MTK_GEMINI_SUPPORT) {
            scAddress = TelephonyManagerEx.getDefault().getScAddress(SIMInfo.getSlotById(this, mSelectedSimId));
        } else {
            scAddress = TelephonyManagerEx.getDefault().getScAddress(0);
        }
                
        SmsManager smsManager = SmsManager.getDefault();
        ArrayList<String> messages = null;
        messages = smsManager.divideMessage(msgItem.mBody);

        int smsStatus = 0;
        long timeStamp = 0;
        if (msgItem.isReceivedMessage()) {
            smsStatus = SmsManager.STATUS_ON_ICC_READ;
            timeStamp = msgItem.mSmsDate;
        } else if (msgItem.isSentMessage()) {
            smsStatus = SmsManager.STATUS_ON_ICC_SENT;
        } else if (msgItem.isFailedMessage()) {
            smsStatus = SmsManager.STATUS_ON_ICC_UNSENT;
        } else {
            Log.e("MMSLog", "Unknown sms status");
        }


            result = GeminiSmsManager.copyTextMessageToIccCardGemini(scAddress, 
                    msgItem.mAddress, messages, smsStatus, timeStamp, slotId);
        } else {
            
            result = SmsManager.getDefault().copyTextMessageToIccCard(scAddress, 
                    msgItem.mAddress, messages, smsStatus, timeStamp);
        }

        if (result == SmsManager.RESULT_ERROR_SUCCESS) {
            //mSaveMsgHandler.sendEmptyMessage(MSG_SAVE_MESSAGE_TO_SIM_SUCCEED);
            mUiHandler.sendEmptyMessage(MSG_SAVE_MESSAGE_TO_SIM_SUCCEED);
        } else if (result == SmsManager.RESULT_ERROR_SIM_MEM_FULL) {
            //mSaveMsgHandler.sendEmptyMessage(MSG_SAVE_MESSAGE_TO_SIM_FAILED_SIM_FULL);
            mUiHandler.sendEmptyMessage(MSG_SAVE_MESSAGE_TO_SIM_FAILED_SIM_FULL);
        } else {
            //mSaveMsgHandler.sendEmptyMessage(MSG_SAVE_MESSAGE_TO_SIM_FAILED_GENERIC);
            mUiHandler.sendEmptyMessage(MSG_SAVE_MESSAGE_TO_SIM_FAILED_GENERIC);
        }
        mSaveMsgHandler.sendEmptyMessageDelayed(MSG_QUIT_SAVE_MESSAGE_THREAD, 5000);
    }


6.frameworksbasetelephonyjavaandroidtelephony/SmsManager.java

public static boolean copyMessageToIcc(
            byte[] smsc, byte[] pdu, int status, int simId) {

        boolean success = false;
        
        String isms = getSmsServiceName(simId);
        
        try {
            ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService(isms));
            if (iccISms != null) {
                success = iccISms.copyMessageToIccEf(status, pdu, smsc);
            }
        } catch (RemoteException ex) {
            // ignore it
        }

        return success;
    }


out/target/common/obj/java_libraries/framework_intermediates/src/telephony/java/com/android/internal/telephony/ISms.java
/**
     * Copy a raw SMS PDU to the ICC.
     *
     * @param pdu the raw PDU to store
     * @param status message status (STATUS_ON_ICC_READ, STATUS_ON_ICC_UNREAD,
     *               STATUS_ON_ICC_SENT, STATUS_ON_ICC_UNSENT)
     * @return success or not
     *
     */
public boolean copyMessageToIccEf(int status, byte[] pdu, byte[] smsc) throws android.os.RemoteException
{
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
boolean _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
_data.writeInt(status);
_data.writeByteArray(pdu);
_data.writeByteArray(smsc);
mRemote.transact(Stub.TRANSACTION_copyMessageToIccEf, _data, _reply, 0);
_reply.readException();
_result = (0!=_reply.readInt());
}
finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
/**
     * Copy a text SMS to the ICC.
     *
     * @param scAddress Service center address
     * @param address   Destination address or original address
     * @param text      List of message text
     * @param status    message status (STATUS_ON_ICC_READ, STATUS_ON_ICC_UNREAD,
     *                  STATUS_ON_ICC_SENT, STATUS_ON_ICC_UNSENT)
     * @param timestamp Timestamp when service center receive the message
     * @return success or not
     *
     */
public int copyTextMessageToIccCard(java.lang.String scAddress, java.lang.String address, java.util.List<java.lang.String> text, int status, long timestamp) throws android.os.RemoteException
{
android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
int _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
_data.writeString(scAddress);
_data.writeString(address);
_data.writeStringList(text);
_data.writeInt(status);
_data.writeLong(timestamp);
mRemote.transact(Stub.TRANSACTION_copyTextMessageToIccCard, _data, _reply, 0);
_reply.readException();
_result = _reply.readInt();
}
finally {
_reply.recycle();
_data.recycle();
}
return _result;


2015-07-30 15:19:39 jdc317264476 阅读数 1135

在Android手机中,连接了Wifi之后,密码一般就看不到了,那有没有什么办法可以查看到这些密码呢?办法一般有两种,一种是通过查看wifi的配置文件,一种是使用命令。对于第一种,网上已经有很多了,大致就是先root,然后使用一些手机助手或者手机文件查看之类的工具(如ES、Root Exploere等)来查看wifi配置文件(位置是进入data/misc/wifi,目录里有个wpa_supplicant.conf或者其他文件名以.conf结尾的文件)。

但是用这一种方法,有时会遇到一些问题,比如当手机的root不够彻底时,会引发遇想不到的问题。比如小米手机,当我们使用root工具去root后,看似root成功了,却会引起一些问题,比如授权出问题了、wifi不可用了、手机无法连接到电脑了等。

那如果不用这种方式,还有什么方式呢?这就是今天的主题,查看wifi密码的第二种方式:命令。

先来看看效果图:


从图中,我们可以看到,通过依次输入命令后,拿到了wifi的用户名(test)和密码(12345)。现在来看这几个命令。

1、adb connect 192.168.1.6。这是使用adb来连接手机。如果adb没有配置到环境变量中,请先定位到adb所在的目录,然后执行该命令或者将其所在目录加入环境变量中。

2、adb shell。这是启动手机的命令终端。

WifiManage.java

[java] view plaincopy在CODE上查看代码片派生到我的代码片
  1. package com.example.wifipassword;  
  2.   
  3. import java.io.BufferedReader;  
  4. import java.io.DataInputStream;  
  5. import java.io.DataOutputStream;  
  6. import java.io.InputStreamReader;  
  7. import java.util.ArrayList;  
  8. import java.util.List;  
  9. import java.util.regex.Matcher;  
  10. import java.util.regex.Pattern;  
  11.   
  12. public class WifiManage {  
  13.   
  14.     public List<WifiInfo> Read() throws Exception {  
  15.         List<WifiInfo> wifiInfos=new ArrayList<WifiInfo>();  
  16.       
  17.         Process process = null;  
  18.         DataOutputStream dataOutputStream = null;  
  19.         DataInputStream dataInputStream = null;  
  20.         StringBuffer wifiConf = new StringBuffer();  
  21.         try {  
  22.             process = Runtime.getRuntime().exec("su");  
  23.             dataOutputStream = new DataOutputStream(process.getOutputStream());  
  24.             dataInputStream = new DataInputStream(process.getInputStream());  
  25.             dataOutputStream  
  26.                     .writeBytes("cat /data/misc/wifi/*.conf\n");  
  27.             dataOutputStream.writeBytes("exit\n");  
  28.             dataOutputStream.flush();  
  29.             InputStreamReader inputStreamReader = new InputStreamReader(  
  30.                     dataInputStream, "UTF-8");  
  31.             BufferedReader bufferedReader = new BufferedReader(  
  32.                     inputStreamReader);  
  33.             String line = null;  
  34.             while ((line = bufferedReader.readLine()) != null) {  
  35.                 wifiConf.append(line);  
  36.             }  
  37.             bufferedReader.close();  
  38.             inputStreamReader.close();  
  39.             process.waitFor();  
  40.         } catch (Exception e) {  
  41.             throw e;  
  42.         } finally {  
  43.             try {  
  44.                 if (dataOutputStream != null) {  
  45.                     dataOutputStream.close();  
  46.                 }  
  47.                 if (dataInputStream != null) {  
  48.                     dataInputStream.close();  
  49.                 }  
  50.                 process.destroy();  
  51.             } catch (Exception e) {  
  52.                 throw e;  
  53.             }  
  54.         }     
  55.       
  56.           
  57.         Pattern network = Pattern.compile("network=\\{([^\\}]+)\\}", Pattern.DOTALL);  
  58.         Matcher networkMatcher = network.matcher(wifiConf.toString() );  
  59.         while (networkMatcher.find() ) {  
  60.             String networkBlock = networkMatcher.group();  
  61.             Pattern ssid = Pattern.compile("ssid=\"([^\"]+)\"");  
  62.             Matcher ssidMatcher = ssid.matcher(networkBlock);  
  63.               
  64.             if (ssidMatcher.find() ) {     
  65.                 WifiInfo wifiInfo=new WifiInfo();  
  66.                 wifiInfo.Ssid=ssidMatcher.group(1);  
  67.                 Pattern psk = Pattern.compile("psk=\"([^\"]+)\"");  
  68.                 Matcher pskMatcher = psk.matcher(networkBlock);  
  69.                 if (pskMatcher.find() ) {  
  70.                     wifiInfo.Password=pskMatcher.group(1);  
  71.                 } else {  
  72.                     wifiInfo.Password="无密码";  
  73.                 }          
  74.                 wifiInfos.add(wifiInfo);  
  75.             }  
  76.               
  77.         }  
  78.   
  79.         return wifiInfos;  
  80.     }  
  81.   
  82. }  

WifiInfo.java

[java] view plaincopy在CODE上查看代码片派生到我的代码片
  1. package com.example.wifipassword;  
  2.   
  3. public class WifiInfo {  
  4.     public String Ssid="";  
  5.     public String Password="";  
  6. }  


注:

1、通过Runtime.getRuntime().exec("su")获取root权限。

2、通过process.getOutputStream()和process.getInputStream()获取终端的输入流和输出流。

3、通过dataOutputStream.writeBytes("cat /data/misc/wifi/*.conf\n")往终端中输入命令。注意,这里必须要有\n作为换行,否则会与后一个exit命令作为一个命令,最终导致命令执行失败,无法得到结果。

4、通过dataInputStream获取命令执行结果,并以UTF-8的编码转换成字符串。

5、使用正则表达式过滤出wifi的用户名和密码。

附上显示密码的代码:

[java] view plaincopy在CODE上查看代码片派生到我的代码片
  1. package com.example.wifipassword;  
  2.    
  3. import java.util.List;  
  4.    
  5. import android.app.Activity;  
  6. import android.content.Context;  
  7. import android.os.Bundle;  
  8. import android.view.LayoutInflater;  
  9. import android.view.View;  
  10. import android.view.ViewGroup;  
  11. import android.widget.BaseAdapter;  
  12. import android.widget.ListView;  
  13. import android.widget.TextView;  
  14.    
  15. public class MainActivity extends Activity {  
  16.        
  17.     private WifiManage wifiManage;  
  18.    
  19.     @Override  
  20.     protected void onCreate(Bundle savedInstanceState) {  
  21.         super.onCreate(savedInstanceState);  
  22.         setContentView(R.layout.activity_main);  
  23.         wifiManage = new WifiManage();  
  24.         try {  
  25.             Init();  
  26.         } catch (Exception e) {  
  27.             // TODO Auto-generated catch block  
  28.             e.printStackTrace();  
  29.         }  
  30.     }  
  31.    
  32.     public void Init() throws Exception {  
  33.         List<wifiinfo> wifiInfos = wifiManage.Read();  
  34.         ListView wifiInfosView=(ListView)findViewById(R.id.WifiInfosView);  
  35.         WifiAdapter ad = new WifiAdapter(wifiInfos,MainActivity.this);  
  36.         wifiInfosView.setAdapter(ad);     
  37.     }  
  38.        
  39.     public class WifiAdapter extends BaseAdapter{  
  40.    
  41.         List<wifiinfo> wifiInfos =null;  
  42.         Context con;  
  43.            
  44.         public WifiAdapter(List<wifiinfo> wifiInfos,Context con){  
  45.             this.wifiInfos =wifiInfos;  
  46.             this.con = con;  
  47.         }  
  48.            
  49.         @Override  
  50.         public int getCount() {  
  51.             // TODO Auto-generated method stub  
  52.             return wifiInfos.size();  
  53.         }  
  54.    
  55.         @Override  
  56.         public Object getItem(int position) {  
  57.             // TODO Auto-generated method stub  
  58.             return wifiInfos.get(position);  
  59.         }  
  60.    
  61.         @Override  
  62.         public long getItemId(int position) {  
  63.             // TODO Auto-generated method stub  
  64.             return position;  
  65.         }  
  66.    
  67.         @Override  
  68.         public View getView(int position, View convertView, ViewGroup parent) {  
  69.             // TODO Auto-generated method stub  
  70.             convertView = LayoutInflater.from(con).inflate(android.R.layout.simple_list_item_1, null);  
  71.             TextView tv = (TextView)convertView.findViewById(android.R.id.text1);  
  72.             tv.setText("Wifi:"+wifiInfos.get(position).Ssid+"\n密码:"+wifiInfos.get(position).Password);  
  73.             return convertView;  
  74.         }  
  75.            
  76.     }  
  77.    
  78. }  

最终效果图:

2013-12-11 19:52:01 twlkyao 阅读数 1187
    在Eclipse——>Window——>Preferences——>Android——>Editors——>Format on save打上勾即可,为了使XML格式化,将Automatically format the xml edited by visual layout editor前面的勾选上。

Android 用代码查看本机保存的Wifi密码

阅读数 30238

在Android手机中,连接了Wifi之后,密码一般就看不到了,那有没有什么办法可以查看到这些密码呢?办法一般有两种,一种是通过查看wifi的配置文件,一种是使用命令。对于第一种,网上已经有很多了,大致就是先root,然后使用一些手机助手或者手机文件查看之类的工具(如ES、RootExploere等)来查看wifi配置文件(位置是进入data/misc/wifi,目录里有个wpa_supplic

博文 来自: jdsjlzx

Android 保存画图

阅读数 1552

很多人在做画图软件的时候找不到保存画好图片的方法。。 其实可以在bitmap上面画,然后保存bitmap就可以了,而不需要找屏幕截图的函数了。。。  packagecom.android.DrawTest;importjava.io.File;importjava.io.FileNotFoundException;importjava.io.FileOutp

博文 来自: lessu

android相片保存

阅读数 439

if(cameraAble==true){cameraAble=false;Timet=newTime();//orTimet=newTime("GMT+8");加上TimeZone资料。t.setToNow();//取得系统时间。Stringfilename=String.format("/image%04d%02d%02d%02d%02d%02d

博文 来自: ganlijianstyle

Android保存位图

阅读数 977

本文转自:http://www.blogjava.net/mixer-a/archive/2012/02/17/375034.html本意是想实现一个视频截屏的功能,因为视频是用位图刷新显示的,因此,截屏用到了保存位图的功能,话不多说,贴代码packagexiaosi.bitmap;importandroid.app.Activity;importandroid.os.Bu

博文 来自: key123zhangxing

android保存 数据

阅读数 3

主要3类:(不包含保存在网络服务器)SharedPreferences键值对数据库文件SharedPreferences以下代码在Fragment自定义keyContextcontext=getActivity();SharedPreferencessharedPref=context.getSharedPr...

博文 来自: weixin_33749242
没有更多推荐了,返回首页