Skip to main content

Posts

How to: JSON Data Fetching and Parsing Android Studio Tutorial in Java

Here is the Summary! We will only be using one activity named MainActivity.java  in this whole project.  This activity will be doing the data fetching as well as displaying that JSON data. For this, we will be declaring the MainActivity.java in the AndroidManifest.xml file. Look at the AndroidManifest.xml file below. AndroidManifest.xml . <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.abhishekpanwar.receivedatajson"> <uses-permission android:name="android.permission.INTERNET"/> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity">

How to create a one time Splash Screen in Android Studio. Android tutorials for beginners.

SplashScreen.java import android.content.Intent; import android.content.SharedPreferences; import android.os.Handler; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class SplashScreen extends AppCompatActivity { SharedPreferences sharedPreferences; Boolean firstTime; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash_screen); sharedPreferences = getSharedPreferences("MyPrefs",MODE_PRIVATE); firstTime = sharedPreferences.getBoolean("firstTime",true); if (firstTime){ new Handler().postDelayed(new Runnable() { @Override public void run() { SharedPreferences.Editor editor = sharedPreferences.edit(); firstTime = false; editor.putBoolean("firstTime",