Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize Android to develop some small functions

Shulou Source: shulou.com Published: 2022-06-02 12:43:11 10月04日 Update

This article is about how to implement some small functions of Android development. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Toast (message prompt box):

Toast.makeText (MainActivity.this, "position changed:", 3000). Show ()

Intent Jump: (remember to register Activity in AndroidManifest.xml)

Intent intent=new Intent (Success.this,luru.class); startActivity (intent)

Intent implicitly starts:

Intent intent=new Intent (Intent.ACTION_VIEW,Uri.parse (urlString)); startActivity (intent); urlString can be "www.baidu.com"

System acquisition time:

Date now=new Date (); / / Custom format SimpleDateFormat d1=new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); String time=d1.format (now)

Camera call:

String filepath = "/ mnt/sdcard/DCIM/Camera/" + phototime + ".png"

Final File file = new File (filepath)

Final Uri imageuri = Uri.fromFile (file)

Intent intent = new Intent (MediaStore.ACTION_IMAGE_CAPTURE)

Intent.putExtra (android.provider.MediaStore.EXTRA_OUTPUT, imageuri)

StartActivityForResult (intent, 110)

Thank you for reading! This is the end of this article on "how to achieve some small functions of Android development". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Tags: Features development content more articles good practical location articles time format messages cameras look knowledge systems references help tips related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Microsoft Redmi Xiaomi MariaDB