安卓折线图插件和自带截图分享的实现_JAVA_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > JAVA > 安卓折线图插件和自带截图分享的实现

安卓折线图插件和自带截图分享的实现

 2013/10/8 13:29:47  king_tt  程序员俱乐部  我要评论(0)
  • 摘要:packagecom.example.test;importjava.io.File;importandroid.app.Activity;importandroid.content.Intent;importandroid.graphics.Bitmap;importandroid.graphics.Matrix;importandroid.net.Uri;importandroid.os.Bundle;importandroid.os.Environment;importandroid
  • 标签:实现 插件
class="java" name="code">



package com.example.test;

import java.io.File;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.Surface;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.Button;

public class MainActivity extends Activity {
	
	 private Matrix mDisplayMatrix;  
	 private Display mDisplay;  
     private DisplayMetrics mDisplayMetrics;  
     private Bitmap mScreenBitmap;  
     private WindowManager mWindowManager; 
	 
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		//setContentView(R.layout.activity_main);
		//  
			setContentView(R.layout.activity_main); 
	        WebView wView = (WebView)findViewById(R.id.webview); 
	        Button btn_fen=(Button)findViewById(R.id.btn_fen);   
	        
	        WebSettings wSet = wView.getSettings();     
	        //wSet.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
	        wSet.setUseWideViewPort(true);
	        wSet.setLoadWithOverviewMode(true);
	        String data="55,33,86,57,99,14,25,36,44,58,78,69";
	        wSet.setJavaScriptEnabled(true);   
	        wView.loadUrl("file:///android_asset/line2d_06.html?"+data);  
//	        
	        btn_fen.setOnClickListener(new OnClickListener() {
				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					        File file_save_pic=new File(Environment.getExternalStorageDirectory().getPath() +"/sharetmp.jpg");
					        
					        ScreenShot.shoot(MainActivity.this, file_save_pic);
					
							Intent 	shareInt=new Intent(Intent.ACTION_SEND);
//							shareInt.setType("text/plain");   
							shareInt.setType("image/png");
							shareInt.putExtra(Intent.EXTRA_SUBJECT, "选择分享方式");   
							//shareInt.putExtra(Intent.EXTRA_TEXT, "kkkkkkkkkkkkkkkkkkkkkkk");  
							shareInt.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file_save_pic));  
							shareInt.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
							startActivity(shareInt);
				 }  
			});
	}
	 /** 
     * @return the current display rotation in degrees 
     */  
    private float getDegreesForRotation(int value) {  
        switch (value) {  
        case Surface.ROTATION_90:  
            return 360f - 90f;  
        case Surface.ROTATION_180:  
            return 360f - 180f;  
        case Surface.ROTATION_270:  
            return 360f - 270f;  
        }  
        return 0f;  
    }  


}

?

源码下载地址 :http://www.32666.com/file-553531.html

?

?

  • 大小: 38.7 KB
  • 大小: 47.8 KB
  • 查看图片附件
发表评论
用户名: 匿名