Skip to main content

Posts

Showing posts from July, 2021

How to use onBackPressed and onActivityResult in fragment Android

 Hello everyone hope you are doing well .Here is another article. we all know about fragments basically A Fragment represents a reusable portion of your app's UI. We easily use onBackPressed and onActivityResult in out Activity but we face difficulty when we use these two in our fragment class .We get no result,So if you facing same difficulty this artcile is for you. We have to use some tricks to use these methods in our fragment.So lets start :- First start with onActivityResult() in fragment you have to add these lines in your main Activity class protected void onActivityResult ( int requestCode , int resultCode , Intent data ) { Fragment uploadType = getSupportFragmentManager (). findFragmentById ( android . R . id . content ); if ( uploadType != null ) { uploadType . onActivityResult ( requestCode , resultCode , data ); } super . onActivityResult ( requestCode , resultCode , data ); } in findFragmentByI

How to open pdf file url using webview in Android

 Sometimes we have requirement of showing pdf file in our Android Application. Although there are many third party gradle dependencies available online by which you can show your pdf file easily but one of the major drawback of using these libraries are they will increase you apk size .In some cases they will increase apk size upto ~14 MB. Alternatively you can access and show pdf file using assets and from storage options. This can take less size than any third party library. Here we use pdf using url and if you directly open your pdf file url in webview you will get no result because it will start downoad if you open this link in any web browser.  So in this article we will learn how we can open our pdf url using webview and without using any third party library. So lets Start step by Step:- Lets Suppose you have a pdf file url something like   http://yourwebsite.com/files/mydocumentfile.pdf Step 1: So we you this pdf file url to embed in our webview .First of all you have to host yo

How to Create App Introduction Slider for Android Without Any Library

 In this Tutorial we will learn about how to create App Introduction Slider when the app launch very first time .App Introduction slider is basically use for show a brief information about your app or what's the properties of Application .For making this we do not use any third party library we use only ViewPager here . So let's start with step by step process and make it possible into action.👇 Step 1: Create  activity_welcome.xml in layout folder 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:app= "http://schemas.android.com/apk/res-auto" xmlns:tools= "http://schemas.android.com/tools" android:layout_width= "match_parent" android:layout_height= "match_parent&quo