Gnducoders.com

Android Codes

Code to Process Login/Register Async
Explanation: no explanation
Code to create/able SQLite
Explanation: no explanation
Great website and service appsFlyer
Explanation: for tracking the mobile app and so many new creative things in a website
Setting width and height of imageView programatically
Explanation:
Show alert to select browsers in your phone and open link with it.
Explanation: try and see.
Get IMEI of device.
Explanation: Just copy and use.
Using connectivity manager > is wifi available or mobile data available.
Explanation:
Check whether network time is enabled or not on your mobile.
Explanation: Just call this boolean method and it will return you true/false if (isNetworkTimeEnabled()) { Log.d(TAG, "network time is not enabled"); displayWrongDateNotification(); }
Show custom toast onBackPressed in activity > like Double Tap to exit.
Explanation: Just paste it in your activity.
Game Development
Explanation:
Addding Image in a button and giving padding to drawable
Explanation: image size is not adjustable , you have to use small image.
Adding float, boolean, integer, string value in dimen resources of android
Explanation: I used it to set weight value of textview. Here,format,type be correctly written.
Animation xml code fade reverse infinite times.
Explanation: Pick and paste.
Java code to add animation
Explanation: Pick and paste.
Java code to add animation.
Explanation: Pick and paste.
Is Network available code.
Explanation: Just copy and paste
Code to add back button on action bar.
Explanation: I wrote finish() on back arrow pressed in action bar , you can use it accordingly.
Animation task to animate layout with elevation.
Explanation: use it : new AnimationTask().execute(); to start it.
Slide to right animation xml using translate, rotate and alpha etc.
Explanation: Place it in anim directory.
Drawing oval shape xml with specific size
Explanation: Firstly make xml drawable file.
Code to uninstall the app by package name.
Explanation:
Code to notification in android
Explanation: Call it by : showBigNotification("This is a big message",getApplicationContext(),new Intent(getApplicationContext(),ShowBigNotification.class),123);
Code used in Marshmallow for checking phone permission granted or not.
Explanation: Methods used like ContextCompat etc. requires compile SDK version and buildToolsVersion : 23
Code of Base Fragment with back pressing functionality.
Explanation: Used with fragments , extended by fragment class.
Code to alert dialog with xml code.
Explanation: Java code + xml layout code
XML code of drawable light red solid color with red stroke border.
Explanation: Create drawable file and paste this code.
Using custom toolbar : appbar xml code.
Explanation:
test title
Explanation: test explanatin any
Download Picasso .jar library
Explanation:
Steps to import external library or module to existing project in android studio
Explanation:
Code to send SMS
Explanation: It requires SMS permission to be added in the manifest.
Code to add menu and menu options with XML code.
Explanation: XML code is redundant... use it accordingly.
Code to add html code in strings and display it on layout.
Explanation: Java code uses formatted text and Spanned class.
Learning Android for work & Android Security
Explanation: Just go through these links.
Code to check GPS status, is ON or OFF
Explanation:
Setting font/typeface to textview/edittext etc. in android.
Explanation: First get textView id and set Typeface to it. User can also set BoldItalic, Italic, and normal values. Make sure you have font.ttf present in fonts resource directory.
Adding background music with MediaPlayer to activity/fragment in android
Explanation: user can also use player.pause() in onPause() and player.start() in onResume().
Code to open options menu on click/method called.
Explanation: Here, openMenu method called on some button click. You may use it accordingly.
Using AutocompleteTextView android
Explanation:
Code used in Splash activity.
Explanation: If table found, then mainHOME is opened otherwise exception caught and Login activity is opened.
Intent to send email via gmail to multiple recipients and passing value.
Explanation:
Button in linear layout is still clickable after set visibility GONE to linear layout.
Explanation:
Proper code to get data, any file from default gallery app and receive in onActivityResult.
Explanation: Here uploadTask is the Async that receives data to process. Here used intent.setType("*/*"); user can use it accordingly as .setType("image/*"). User can get nameFile to replaceAll special characters, it also removes .(period).
Using SharedPreferences, getting and putting, commiting.
Explanation:
Adding header view on listview and also onClickListener on it.
Explanation: onItemClick will throw an error java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 but remember to add this @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { if(i>-1) Toast.makeText(Fill_Details.this, "value: "+arrayListBig.get(i).name, Toast.LENGTH_SHORT).show(); }
Issue related to mksdcard in ubuntu linux while installing android studio.
Explanation:
Adding Fragment in an activity using fragment transacation.
Explanation: Here content_frame is any Layout. If some fragment is already added use transaction.replace(R.id.content_frame, fragment);
Using ProgressDialog with inbuild loader and message.
Explanation:
Android code to connect to FTP server.
Explanation: Make sure to add internet permissions. Also run this method in background using Async task.
Android code to access and list files and folders on FTP server.
Explanation: Make sure to add internet permissions. Also run this method in background using Async task.Make sure FTP client is connected before using this method. This method returns Arraylist , developer can use it accordingly.
Android code to download file from FTP server.
Explanation: Make sure to add internet permissions. Also run this method in background using Async task.Make sure FTP client is connected before using this method. This method returns true if downloaded.
Android code to upload file to FTP server.
Explanation: Make sure to add internet permissions. Also run this method in background using Async task.Make sure FTP client is connected before using this method. This method returns true if uploaded.
Code to capture image from camere and set on ImageView android.
Explanation: You must mention camera permission in the manifest.
Open Event Add Reminder by passing values programmatically android
Explanation: Make sure you have added necessary permissions. <uses-permission android:name="android.permission.READ_CALENDAR" /> <uses-permission android:name="android.permission.WRITE_CALENDAR" />
Adding event in background without using intent in android
Explanation: Make sure you have added necessary permissions. <uses-permission android:name="android.permission.READ_CALENDAR" /> <uses-permission android:name="android.permission.WRITE_CALENDAR" />
Best way to call toast and alert in separate class.
Explanation: Used static methods to directly call them.
Read content from file android
Explanation:
Code to View pager with tab having image in it android.
Explanation: Just try it.
Code to write call log to android phone programmatically.
Explanation: Add these permissions first.
Code to get calendar events and add in arraylist programmatically.
Explanation: Make an arraylist and events date time in milliseconds is added.
Explaining element in intent filter in manifest.
Explanation:
Using animated loader using textView like water waves with TitanicTextView.
Explanation:
What is the difference between ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION
Explanation:
Broadcast receiver when message sent-received, Sender and message body displayed in Toast
Explanation: Don't forget to add permissions. <uses-permission android:name="android.permission.SEND_SMS" /> <uses-permission android:name="android.permission.RECEIVE_SMS" /> <uses-permission android:name="android.permission.READ_SMS" /> <uses-permission android:name="android.permission.WRITE_SMS" /> <receiver android:name=".IncomingSMS " > <intent-filter> <action android:name="android.provider.Telephony.SMS_SEND" > </action> <action android:name="android.provider.Telephony.SMS_RECEIVED" > </intent-filter> </receiver>
Using Picasso library to load/download image directly get set to ImageView.
Explanation:
Setting your app as default SMS app and more on this.
Explanation:
Using Custom Broadcast Receiver
Explanation: Make sure action name and setAction argument string should be same("hit in this case").
XML code animation to zoom plus fade.
Explanation:
Using AlarmManager that runs after specific interval and print toast in receiver.
Explanation:
Code to check is my app is running at top ie. its onResume is active.
Explanation: This method is normally used in Receivers.
Call Notification method, Show it and Cancel it programmatically.
Explanation:
eeee34343
Explanation: eeeeee
d123
Explanation:
Getting MAC Address in every phone specially after Android 5.0 +
Explanation: In case ethernet address is got getMACAddress("eth0") returns the address.
Encoding/Decoding the password or any value with Base64
Explanation:
Getting first n characters and last n characters from string java using substring.
Explanation:
Create and get .vcf file path and get total contacts.
Explanation: Contacts class given above. It contains two static methods one that counts and other that will return the json string as: {"Count":"921","Path":"\/storage\/sdcard0\/CONTACTS_29_Nov_2016_04_41_pm.vcf"} Contacts.totalContacts(context) returns total contacts in integer format.
Adding listivew using default adapter in few simple steps.
Explanation:
Get width and height of screen android
Explanation:
Complete Google maps code to get user's location and putting marker on it.
Explanation: Make sure you have added necessary permissions in Android Manifest.
Complete Google maps code to get user's location and putting marker on it .
Explanation: Make sure you have added necessary permissions in Android Manifest.
Login form in alert dialog java code with xml.
Explanation:
Simple show alert dialog with AlertDialog.
Explanation:
One another way to use shared preferences android.
Explanation:
Turn volume to full android
Explanation: It displays the original volume but also increase the media volume to maximum
How to get version name of app programmatically android
Explanation:
Code to run ongoing thread no need to while , run directly with handler.post
Explanation:
Using countDownTimer to run thread in android
Explanation:
Enabling ComponentName to call broadcast receiver with action declared in manifest that onConnectivityChange a class that extended BroadcastReceiver be called eg. NetworkChangeReceiver called.
Explanation: Make sure you have included necessary permissions.
Contacts class that make backup file of contacts, return json that contains path, size of file created.
Explanation:
Get battery regarding information android.
Explanation: KTBatteryInfo ktBatteryInfo=KTBatteryInfo.getInstance(); ktBatteryInfo.calculate(getApplicationContext()); for(int i=0;i<3;i++) Toast.makeText(this, "onCreate: BatteryLevel: "+ ktBatteryInfo.getBatteryLevel()+"\n"+ "onCreate: BatteryTechnology: "+ ktBatteryInfo.getTechnology()+"\n"+ "onCreate: BatteryHealth: "+ ktBatteryInfo.getHealth()+"\n"+ "onCreate: BatteryChargingState: "+ ktBatteryInfo.getChargingState()+"\n"+ "onCreate: BatteryVoltage: "+ ktBatteryInfo.getVoltage()+"\n"+ "onCreate: BatteryTemperature: "+ ktBatteryInfo.getTemperature()+"\n", Toast.LENGTH_SHORT).show();
Play alarm ringtone programatically android.
Explanation:
Regarding sms content provider android.
Explanation:
Recording audio with MediaRecorder
Explanation:
Get user email addresses in his phone android.
Explanation:
Alert dialog without xml file andorid.
Explanation:
Making a json string with example: json array having json object.
Explanation: {"d":[{"name":"amanpreet singh","designation":"android developer","hobbies":"unlimted"}]}
Adding password edittext having eye at right side.
Explanation:
Showing a map in android with marker features
Explanation: In the manifest : <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Adding a image from resources on marker and set zoom level.
Explanation:
Google Maps code to get location GPS, also requestPermission.
Explanation: Make sure your GPS is on. and access fine location permission are added in manifest.
Programmatically register reciever with using Custom Broadcast receiver
Explanation:
Using attractive loaders / progress bars.
Explanation:
Fetch Location using Fused Location api.
Explanation: <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.INTERNET" />
Using ViewFlipper (auto animation/sliding of images) in android programmatically.
Explanation:
Add Bubble like custom icon on marker that display the address using Geocoder, also get distance using SphericalUtil
Explanation: Make sure you added necessary permissions in the manifest.
Regarding use jsoup in android.
Explanation: Make sure that you have added this repository in your gradle. compile 'org.jsoup:jsoup:1.7.3'
Code to parse duration from Google Maps API
Explanation:
Code to add image from URL in push notification android.
Explanation: Make sure you have added Internet permission in manifest.
Hide soft keyboard android.
Explanation:
Send message to whats app, open whatsapp intent to share your message with users.
Explanation:
Code to get email addresses with name in phone programmatically.
Explanation: Make sure you have added Read Contacts permission.
Using Rounded ImageView android.
Explanation:
Code to make your own ClickListener or custom click listener
Explanation:
EditText with placeholder which shifts at top on focus.
Explanation: Make sure you have included design support library in app gradle. compile 'com.android.support:design:25.1.0'
Readymade signup form with logo, title, fields and button.
Explanation: Make sure you have design support library in app gradle. compile 'com.android.support:design:25.1.0'
Image scroll/movement imageview com.flaviofaria.kenburnsview.KenBurnsView
Explanation: Make sure you have added this as follows in your app gradle. compile 'com.flaviofaria:kenburnsview:1.0.7'
Animated sliders with pager indicators.
Explanation: Make sure you have added this as follows in your app gradle. compile 'com.daimajia.slider:library:1.1.5@aar' compile 'com.android.support:design:25.1.0' compile 'com.squareup.picasso:picasso:2.3.2'
Code to image upload after selecting it from gallery and pass post parameters to php using volley library.
Explanation: You must include this volley library in your app gradle. compile 'com.mcxiaoke.volley:library-aar:1.0.0'
Awesome animations android.
Explanation:
Get email addresses from phone and make json array json object of it and return string.
Explanation: Make sure you have added get accounts permission in the manifest.
Proper steps to show google map in release mode.
Explanation:
Using NameValuePair to sent parameters to web service android
Explanation: Make sure you have added useLibrary 'org.apache.http.legacy' in your gradle's android bracket.
PHP code to update and get result if updated or not in db.
Explanation:
Using DatePicker to select date and using date picker listenener
Explanation:
Code to set dynamic background to linear layout using picasso in Navigation Header view.
Explanation: Have a smile and run.
Code to add contacts like icons in phone book.
Explanation: More go read about it : https://github.com/IvBaranov/MaterialLetterIcon
Adding GridView in android.
Explanation:
Using wave progress bar animation.
Explanation: Make sure you set same width height in xml.
Code running thread.
Explanation:
Code running thread. php
Explanation:
Change password php code
Explanation:
file upload code php
Explanation:
insert using php
Explanation:
delete using php
Explanation:
login using php
Explanation:
update in php
Explanation:
update in php and see affected row to get result.
Explanation:
Adding Spinner android.
Explanation:
Adding calendar android.
Explanation:
Adding calendar android.v
Explanation:
Adding calendar android.vd
Explanation:
Hitting sms android
Explanation:
Read if sms received.
Explanation:
intent filter custom receiver android read sms in activity
Explanation:
SQLite open helper complete android example
Explanation:
hack tunein
Explanation:
Enable GPS from pop up android.
Explanation:
using Webview android
Explanation:
A very very beautiful notification in android big also expandable also.
Explanation:
Dialog android simple.
Explanation:
Firebase database
Explanation:
code to insert fm channel into db firebase
Explanation:
code to insert fm channel into db firebase.
Explanation: