^

Android-java

Category about Android-java

XML Styling
[2020-09-02 07:12:25] Creating a Pop-Up Dialog [Android-Java / XML Styling]
Dialog XML File: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:layout_width="m...
[2020-09-02 06:47:56] Display a Video Centered (in XML) [Android-Java / XML Styling]
<FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" app:layout_constraintTop_toBottomOf="@+id/main_topbar"> <VideoView android:id="@+id/videoViewMain" android:layout_width="match_parent" android:layout_he...
Hints
[2020-08-15 03:41:11] Android 4/5 SSL Fix over Google Play [Android-Java / Hints]
This may fix this error --- javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x6abff398:Failure in SSL library, usually a protocol error error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure (external/openssl/ssl/s23_clnt.c:7440x684dfce0:0x00000000) Add this to your Class...
[2020-08-15 03:37:51] Check For Permission and Request [Android-Java / Hints]
This is Example for Internet Permissions Android Manifest XML (for every Permissoin u need one of this fitting block) <!-- Declare Use Of Internet --> <uses-permission android:name="android.permission.INTERNET"/> Java Content: if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission....
[2020-08-15 03:44:12] Disable Screenshots/Capturing [Android-Java / Hints]
In Constructor super.onCreate(savedInstanceState); // Disable Screenshots getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE); setContentView(R.layout.activity_main); ...
[2020-09-03 01:36:01] Display PDF in ImageView (Zoomable) [Android-Java / Hints]
Just a quick setup to render a pdf File. XML Fragment of Image view (somewhere in your layouts xml where you need it) <RelativeLayout android:id="@+id/relativeLayout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/colorSecondary&...
[2020-09-03 01:16:57] Dont reload Activitiy while Rotating Device [Android-Java / Hints]
There is an easy way to avoid that your activity reloads if you change between portrait/landscape view. Define the class in the manifest file as follow: <activity android:name=".YourActivity" android:configChanges="orientation|screenSize"/> ...
[2020-09-19 04:36:37] Download Manager Class [Android-Java / Hints]
Here a simple Download Manager Class. Use like this: DownloadManager DM = new DownloadManager(); DM.init(....); DM.execute(); Here the Class: import android.os.AsyncTask; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.io.PrintWriter; import java.net.HttpURLConnection; import java.net.URL; public class ...
[2020-07-25 18:15:28] Passing Argument to an Intent [Android-Java / Hints]
Passing the parameter Intent intent= new Intent(mContext,Activity.class); intent.putExtra("test","value")); Get value Intent intent=getIntent(); msg_textview.setText(intent.getStringExtra("test")); ...
File Operations
[2020-09-02 06:45:29] Play a Local Video File [Android-Java / File Operations]
Here the code to display a video in a videoView element. VideoView videoview = findViewById(R.id.VIDEOVIEWID); Uri uri = Uri.parse(STRING PATH TO FILE); MediaController mediaController = new MediaController(this); mediaController.setAnchorView(videoview); videoview.setMediaController(mediaController); videoview.setVideoURI(uri); videoview.start(); ...
[2020-08-25 04:39:26] Read A File from Internal Storage to String [Android-Java / File Operations]
Simple Code to read a File in Android (FROM INTERNAL STORAGE) to a String String readFile(Context context, String filename) throws IOException { String ret = ""; InputStream inStream = context.openFileInput(filename); if ( inStream != null ) { InputStreamReader inputStreamReader = new InputStreamReader(inStream); BufferedReader bu...
[2020-08-25 04:40:23] Write a File to Android Internal Storage from String [Android-Java / File Operations]
Write a File in Android to Internal Storage from String void writeFile(String data, Context context, String filename) throws IOException { OutputStreamWriter outStream = new OutputStreamWriter(context.openFileOutput(filename, Context.MODE_PRIVATE)); outStream.write(data); outStream.close(); } ...
Theme
Switch: 208 | Arrive: 281
This Website is using Session Cookies for Site Functionality and AWStats.
Staff may be MiA!