Special android usage 1

Source: Internet
Author: User

1. Make an image transparent:

1. Bitmap buffer = Bitmap. createBitmap (width, height, Bitmap. Config. ARGB_4444); buffer. eraseColor (Color. TRANSPARENT );

2. send an email directly:

1. Intent intent = new Intent (Intent. ACTION_SENDTO, Uri. fromParts ("mailto", "test@test.com", null ));

2. intent. setFlags (Intent. FLAG_ACTIVITY_NEW_TASK );

3. context. startActivity (intent );

3. program control screen highlighted:

1. WindowManager. LayoutParams lp = getWindow (). getAttributes ();

2. lp. screenBrightness = 100/100 running F;

3. getWindow (). setAttributes (lp );

4. Filter specific text

1. Filter filter = myAdapter. getFilter ();

2. filter. filter (mySearchText );

5. scrollView scroll stop event

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. Initiate an association for a specific program to open

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 ");

11. startActivity (intent );

12. An error occurs when the index format is not applicable to the image.

13. Intent intent = new Intent ();

14. intent. setAction (android. content. Intent. ACTION_VIEW );

15. File file = new File ("/sdcard/test.mp4 ");

16. intent. setDataAndType (Uri. fromFile (file), "video /*");

17. startActivity (intent );

18.

19. Intent intent = new Intent ();

20. intent. setAction (android. content. Intent. ACTION_VIEW );

21. File file = new File ("/sdcard/test.pdf ");

22. intent. setDataAndType (Uri. fromFile (file), "audio /*");

23. startActivity (intent );

7. Set the text appearance

1. setTextAppearance (context, android. R. style. TextAppearance_Medium );

2. android: textAppearance = "? Android: attr/textAppearanceMedium"

8. Set an independent launch mode:

1. <activity

2. android: name = ". ArtistActivity"

3. android: label = "Artist"

4. android: launchMode = "singleTop">

5. </activity>

6. www.2cto.com

7. Intent I = new Intent ();

8. I. putExtra (EXTRA_KEY_ARTIST, id );

9. I. setClass (this, ArtistActivity. class );

10. I. addFlags (Intent. FLAG_ACTIVITY_SINGLE_TOP );

11. startActivity (I );

 

From LuoXianXiong, your partner

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.