Android

Entries about: Android
^Top
<< Back
Mobile-Menu










Sections

XML

Creating a Pop-Up Dialog

Dialog XML File: &lt;RelativeLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot; xmlns:tools=&quot;http://schemas.android.com/tools&quot; android:layout_width=&quot;fill_parent&quot; android:layout_...


Display a Video Centered

&lt;FrameLayout android:layout_width=&quot;match_parent&quot; android:layout_height=&quot;match_parent&quot; app:layout_constraintTop_toBottomOf=&quot;@+id/main_topbar&quot;&gt; &lt;VideoView android:id=&quot;...


Snippets

Check For Permission and Request

This is Example for Internet Permissions Android Manifest XML (for every Permissoin u need one of this fitting block) &nbsp;&nbsp;&nbsp; &lt;!-- Declare Use Of Internet --&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&...


Disable Screenshots/Capturing

In Constructor super.onCreate(savedInstanceState); // Disable Screenshots getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE); setContentView(R.layout.activity_main); ...


Display PDF in Zoomable ImageView

Just a quick setup to render a pdf File. XML Fragment of Image view (somewhere in your layouts xml where you need it) &nbsp;&nbsp;&nbsp; &lt;RelativeLayout &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; android...


Passing Argument to an Intent

Passing the parameter Intent intent= new Intent(mContext,Activity.class); intent.putExtra(&quot;test&quot;,&quot;value&quot;)); Get value Intent intent=getIntent(); msg_textview.setText(intent.getStringExtra(&quot;test&quot;))...


Play a Local Video File

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(videov...


Read A File from Internal Storage to String

&nbsp;Simple Code to read a File in Android (FROM INTERNAL STORAGE) to a String String readFile(Context context, String filename) throws IOException { String ret = &quot;&quot;; InputStream inStream = context.openFileInput(filename); if (...


Write a File to Android Internal Storage from String

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


Fixes

Android 4/5 SSL Fix over Google Play

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...


Dont reload Activitiy while Rotating Device

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: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb...


Classes

Download Manager Class

Here a simple Download Manager Class. Use like this: &nbsp; DownloadManager DM = new DownloadManager(); &nbsp; DM.init(....); &nbsp; DM.execute(); Here the Class: import android.os.AsyncTask; import java.io.File; import java.io.FileOutput...


This Website is using Session Cookies for Site Functionality.