Translate This Site to Czech >>>> Android Studio Examples >>>>
CZECH JAVA Source GitHUB
Android JAVA Open Source Projects - Valery Shmelev Programming. RSA cryptography example, use unicode, SMS sending and receiving, SQLite database example.
Photo Web Cam >>
1024 bit PRNG >>
RSA encryption >>
Android SMS >>
Android UNICODE >>
Android SQLite >>
A complete beginner's code collection to Android Studio, which will allow you to start writing programs faster.
1. Display a line of text on the screen in myTextView
String aboutCat = "Sample text will be displayed.";
myTextView.setText(aboutCat); //Display string aboutCat on the screen
2. Programmatic access to a string resource is done like this
String catName = getResources().getString(R.string.text_title);
myTextView.setText(catName); //Display string catName
3. Show a letter from a word or string
//Select a character from a string
//How to count characters - 0,1,2,3,4,...
String testString = "Oflameron";
char myChar = testString.charAt(4);
myTextView.setText(Character.toString(myChar)); // Displays the fifth character - m
Android Studio Example
4. Show a letter from a word or string
//Searches for the substring str and returns the index (position) of the found substring. If the substring is not found, then -1 is returned
String FullString = "Android java examples"; //Full string
myTextView.setText(String.valueOf(FullString.indexOf("java")));
5. If the NextString is empty, then execute the code
//Checks if a string is empty
if(NextString.isEmpty()) {
// Here you write the code to be executed
}
6. Calculate string length
//Write text string length in myTextView
String BigString = "Oflameron";
myTextView.setText(String.valueOf(BigString.length())); //Returns 9 (nine characters)
- Valery Shmeleff
7. Open web page
Intent browseIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.oflameron.ru"));
startActivity(browseIntent);
RSS
Shmeleff
Shmeleff
Shmeleff
8. Open map by specific coordinates or request
String uri = "geo:"+ latitude + "," + longitude;
Intent mapIntent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(mapIntent);
9. Take a picture with the camera
Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAMERA_RESULT);
Uses a standard camera application in the system
The image received from the camera can be processed in the onActivityResult method:
Android Studio Example
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAMERA_RESULT) {
Bitmap thumbnail = (Bitmap) data.getExtras().get("data");
ImageView ivCamera = (ImageView) findViewById(R.id.iv_camera);
ivCamera.setImageBitmap(thumbnail);
}
}
The image from the camera can be saved in a specific directory by adding a parameter to the intent
File photo = new File(Environment.getExternalStorageDirectory(), "oflameron.jpg");
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(filePath)));
For this intent, you do not need the permission android.permission.CAMERA, because The camera is not used directly, but the built-in camera application is just called. However, it is recommended that you add the following line to AndroidManifest:
Deutsche >>
- Valery Shmeleff
10. Take a picture with the camera
You must specify this in the manifest file. This is done using the <uses-function> tags.
<manifest ... >
<uses-feature android:name="android.hardware.camera"
android:required="true" />
...
</manifest>
Android allows you to transfer the execution of various actions to other applications using intent objects. This way we can take photos using an external application. This process includes three stages: creating a specific intent object, launching a new Activity, processing the results in the current Activity
static final int REQUEST_IMAGE_CAPTURE = 1;
private void dispatchTakePictureIntent() {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
}
}
Using the resolveActivity () method, we check for the presence of an application for working with the camera. If intent cannot be handled by any external application, then calling the startActivityForResult () method will crash your application.
Photos that the user takes must be saved in some public directory on an external medium, because in this case the photos will be available to other applications. A suitable directory for storing photographs can be obtained using the getExternalStoragePublicDirectory () method by passing it the DIRECTORY_PICTURES argument. To work with this directory, you need to set the appropriate permission in the manifest of your application.
<manifest ...>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
...
</manifest>
Writing permission allows both reading and reading.
If you want photos to be accessible only using your application, then use the getExternalFilesDir () method to get the directory. On Android 4.3 and below, writing to this directory also requires WRITE_EXTERNAL_STORAGE permission. Starting with Android 4.4, permission is no longer required, since the directory is no longer available to other applications. Based on this, you can declare permission like this :
<manifest ...>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
...
</manifest>
Android Studio Example
Please note that when you delete your application, the directory returned by the getExternalFilesDir () method will also be deleted
When you define a directory for the photo, you need to create a file with a unique name and possibly save the path to it. The following is an example of a method that performs this procedure using the current date and time.
This method creates a file for the photo and launches the camera application using the intent.
The created photo can be made publicly available using the system Media Provider.
Scenar filmu Wiki >>
Oflameron Rescue PHOTO
One of the Android applications written in Java - Rescue PHOTO a photo recorder for a smartphone. If you have an old Android smartphone, make them a photo recorder with FTP access and save photos on a free web server. You can view photos on any device from any browser.
The program takes photos on a timer and uploads them to any web hosting service using FTP protocol, for example, to a free web hosting service. On the http://oflameron.com website, you can download and install the APK file of the application and see the Java source codes.
Download Android 11 app Photo Web Cam from GOOGLE DRIVE:
Install APK >> Support >>
Wiki Web Cam - http://androidwebcam.wikidot.com/
If the Internet is not available somewhere, the application can work autonomously. It will save photos in the memory of your smartphone and you can then view them. A photo recorder Oflameron Rescue PHOTO is a convenient tool for monitoring objects, the state of which rarely changes. This significantly saves Internet traffic and the amount of data on the web server.
This is a real freeware app. You can use it for free for any number of surveillance systems, you can distribute or add to archives (including those published for a fee).
Development and testing of the application requires financial costs, which are compensated by advertising on the official website of the program. Versions of the application with new features and for new operating systems and new smartphones will be created while advertising revenues compensate the developer's costs.
GNU General Public License
Android Java Photo recorder OFLAMERON Photo Web Cam (http://oflameron.com) for Android smartphones is now available under free license GNU General Public License (Open Source Code). You are free to use the source code, as long as you keep the copyright of the author.
Direct DOWNLOAD full Java project (Android Studio) from GOOGLE DRIVE
OPENSOURCE.ZIP >> Source Code >> Admin Guide >>
Author >>
Application "Photo Web Cam" - full working version. The Java source code is available as a complete Android Studio project here and added to GitHUB
The source code has a lot of room for improvement.
(c) by Valery Shmelev
Android Photo Web Cam
Global Photo Web Cam >>
Global Photo Web Cam >>
Photo Web Cam Blog >>
Android Photo Web Cam - highly effective and low cost means for global surveillance from anywhere in the world
Now the next Android Java project is being developed. This will be a program to confirm your alibi.
Germany
Global Combat Systems
Android Studio Example
|