1.讓一個圖片透明:
復制到剪貼板 Java代碼
1. Bitmap buffer = Bitmap.createBitmap(width, border="1" Height, Bitmap.Config.ARGB_4444);buffer.eraseColor(Color.TRANSPARENT);
2.直接發送郵件:
復制到剪貼板 Java代碼
1. Intent intent = new Intent(Intent.ACTION_SENDTO, Uri .fromParts( "mailto" , "
[email protected]" , null ));
2. intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
3. context.startActivity(intent);
3.程序控制屏幕變亮:
復制到剪貼板 Java代碼
1. WindowManager.LayoutParams lp = getWindow().getAttributes();
2. lp.screenBrightness = 100 / 100 .0f;
3. getWindow().setAttributes(lp);
4.過濾特定文本
復制到剪貼板 Java代碼
1. Filter filter = myAdapter.getFilter();
2. filter.filter(mySearchText);
5.scrollVIEw scroll停止事件
復制到剪貼板 Java代碼
1. setOnScrollListener( new OnScrollListener(){
2. public void onScroll(AbsListView vIEw, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
3. // TODO Auto-generated method stub }
4. public void onScrollStateChanged(AbsListView vIEw, int scrollState) {
5. // TODO Auto-generated method stub
6. if (scrollState == 0 ) Log.i( "a" , "scrolling stopped..." ); } });}
6. 對於特定的程序 發起一個關聯供打開
復制到剪貼板 C/C++代碼
1. Bitmap bmp = getImageBitmap(jpg);
2. String path = getFilesDir().getAbsolutePath() + "/test.png" ;
3. File file = new File(path);
4. FileOutputStream fos = new FileOutputStream(file);
5. bmp.compress( CompressFormat.PNG, 100, fos );
6. fos.close();
7.
8. Intent intent = new Intent();
9. intent.setAction(android .content.Intent.ACTION_VIEW);
10. intent.setDataAndType(Uri .fromFile( new File(path)), "image/png"