Android-Java

Entries for: Android-Java!
^Top
<< Back
Mobile-Menu










Sub Categories

XML Styling

Creating a Pop-Up Dialog

Views: 710
Created: 2020-09-02 07:12:25
Modified: 2023-09-22 11:06:15

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_height=&quot;fill_parent&quot;&gt; &lt;LinearLayout android:layout_width=&quot;m...

Display a Video Centered (in XML)

Views: 724
Created: 2020-09-02 06:47:56
Modified: 2023-09-22 01:04:08

&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;@+id/videoViewMain&quot; android:layout_width=&quot;match_parent&quot; android:layout_he...

Hints

Android 4/5 SSL Fix over Google Play

Views: 769
Created: 2020-08-15 03:41:11
Modified: 2023-09-22 13:22:06

This may fix this error ---<br /> 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 t...

Check For Permission and Request

Views: 821
Created: 2020-08-15 03:37:51
Modified: 2023-09-24 15:17:30

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;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;uses-permission android:name=&quot;android.permission.INTER...

Disable Screenshots/Capturing

Views: 711
Created: 2020-08-15 03:44:12
Modified: 2023-09-24 13:05:28

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

Display PDF in ImageView (Zoomable)

Views: 629
Created: 2020-09-03 01:36:01
Modified: 2023-09-23 10:35:07

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<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; android:id=&quot;@+id/relativeLayout&quot;<br /> &nbsp;&nbsp;&nbsp;&a...

Dont reload Activitiy while Rotating Device

Views: 644
Created: 2020-09-03 01:16:57
Modified: 2023-09-24 20:22:35

There is an easy way to avoid that your activity reloads if you change between portrait/landscape view.<br /> Define the class in the manifest file as follow: <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;activity android:name=&quot;.YourActivity&quo...

Download Manager Class

Views: 979
Created: 2020-09-19 04:36:37
Modified: 2023-09-22 11:29:19

Here a simple Download Manager Class. Use like this: &nbsp; DownloadManager DM = new DownloadManager();<br /> &nbsp; DM.init(....);<br /> &nbsp; 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....

Passing Argument to an Intent

Views: 749
Created: 2020-07-25 18:15:28
Modified: 2023-09-25 03:43:44

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

File Operations

Play a Local Video File

Views: 676
Created: 2020-09-02 06:45:29
Modified: 2023-09-24 22:51:01

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

Read A File from Internal Storage to String

Views: 636
Created: 2020-08-25 04:39:26
Modified: 2023-09-25 04:33:33

&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 ( inStream != null ) { InputStreamReader inputStreamReader = new InputStreamReader(inStream); Buffere...

Write a File to Android Internal Storage from String

Views: 746
Created: 2020-08-25 04:40:23
Modified: 2023-09-24 12:34:32

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



Warning: Array to string conversion in /home/bugfish/public_html/_site/btm/init.php on line 82
Switches: 0 | Arrivals: 0 | Visits: 0
This Website is using Session Cookies for Site Functionality.