Professional Documents
Culture Documents
A MICRO-PROJECT REPORT ON
“WEATHER APPLICATION”
SUBMITED BY:-
GAIKWAD ATUL SUBHASH
ENROLLMENT NO:-
2216620153
UNDER GUIDANCE OF
Prof. mrs. SHRADDHA PARDESHI MA’AM
THIS IS CERTIFY THAT THE MICROPROJECT
IS SUCCESSFULLY SUBMITTED BY,
3
ABSTRACT
As a student enrolled in the P. K. Technical Campus, Chakan,
every semester we require to do a micro-project on any one topic in
the syllabus of the respective subjects. Hence, we have created a
project on Weather Application as the micro-project for the subject
MAD (22617).
4
INDEX
Sr. No. Title Page
No.
1. Acknowledgement 3
2. Abstract 4
3. Introduction 6
6. Output 13
7. Conclusion 14
8. References 15
5
Introduction
Weather forecasting is the application of science and
technology to predict the conditions of the atmosphere for a
given location and time. Human beings have attempted to
predict the weather informally for millennia and formally
since the 19th century.
Weather forecasts are made by collecting quantitative data
about the current state of the atmosphere at a given place and
using meteorology to project how the atmosphere will change.
There are a variety of end uses to weather forecasts. Weather
warnings are important forecasts because they are used to
protect life and property. Forecasts based on temperature and
precipitation are important to agriculture, and therefore to
traders within commodity markets. Temperature forecasts are
used by utility companies to estimate demand over coming
days. On an everyday basis, people use weather forecasts to
determine what to wear on a given day. Since outdoor
activities are severely curtailed by heavy rain, snow and wind
chill, forecasts can be used to plan activities around these
events, and to plan ahead and survive them. In 2009, the US
spent $5.1 billion on weather forecasting.
SIGNIFICANCE OF PROJECT –
The main significance of this micro-project is to understand
how an android application is built, perform operations in the
database, use Recycler View to show list of items and use
Alarm Manager and Broadcast Receiver to show reminder
notifications.
6
SCOPE OF PROJECT –
HARDWARE REQUIREMENTS –
1. Laptop or PC with minimum 8GB RAM and i5/i7 8th Gen
processor.
SOFTWARE REQUIREMENTS –
1. Operating System - Windows 11
2. Android Studio Electric Eel 2022.1.1
3. Android Emulator – Small Phone API(Android 13)
7
PROGRAM CODE
activitymain.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".MainActivity" android:background="#e8f4f8"
android:orientation="vertical" android:padding="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="40sp"
android:text="Weather Update"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
</View>
<EditText
android:id="@+id/etCity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:ems="10" android:hint="Enter
City Name"
8
android:inputType="textPersonName"
android:minHeight="48dp" />
<EditText android:id="@+id/etCountry"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:ems="10" android:hint="Enter
Country Code (Optional)"
android:inputType="textPersonName"
android:minHeight="48dp" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/btnGet"
android:layout_marginBottom="10dp"
android:background="#0070c7"
android:textColor="@android:color/white"
android:onClick="getWeatherDetails"
android:text="Get"
app:backgroundTint="@null" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="150dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/tvResult" />
</ScrollView> <View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
</View>
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adViewMain"
android:layout_width="wrap_content"
android:layout_height="wrap_content" ads:adSize="SMART_BANNER"
ads:adUnitId="@string/banner_adunit_id">
</com.google.android.gms.ads.AdView>
</LinearLayout>
</LinearLayout>
9
Activity.java
package com.weatherupdate;
import android.graphics.Color;
import android.os.Bundle; import
android.view.View; import
android.widget.EditText; import
android.widget.TextView; import
android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import java.text.DecimalFormat;
10
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MobileAds.initialize(this, new OnInitializationCompleteListener() {
@Override public void onInitializationComplete(InitializationStatus
initializationStatus) {
}
});
mAdView = findViewById(R.id.adViewMain);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
etCity = findViewById(R.id.etCity);
etCountry = findViewById(R.id.etCountry);
tvResult = findViewById(R.id.tvResult);
}
11
float pressure = jsonObjectMain.getInt("pressure"); int humidity =
jsonObjectMain.getInt("humidity");
JSONObject jsonObjectWind = jsonResponse.getJSONObject("wind");
String wind = jsonObjectWind.getString("speed");
JSONObject jsonObjectClouds = jsonResponse.getJSONObject("clouds");
String clouds = jsonObjectClouds.getString("all");
JSONObject jsonObjectSys = jsonResponse.getJSONObject("sys");
String countryName = jsonObjectSys.getString("country");
String cityName = jsonResponse.getString("name");
tvResult.setTextColor(Color.rgb(68,134,199)); output += "Current
weather of " + cityName + " (" + countryName + ")"
+ "\n Temp: " + df.format(temp) + " °C"
+ "\n Feels Like: " + df.format(feelsLike) + " °C"
+ "\n Humidity: " + humidity + "%"
+ "\n Description: " + description
+ "\n Wind Speed: " + wind + "m/s (meters per second)"
+ "\n Cloudiness: " + clouds + "%"
+ "\n Pressure: " + pressure + " hPa";
tvResult.setText(output); } catch
(JSONException e) { e.printStackTrace();
}
}
}, new Response.ErrorListener(){
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(getApplicationContext(), error.toString().trim(),
Toast.LENGTH_SHORT).show();
}
});
RequestQueue requestQueue = Volley.newRequestQueue(getApplicationContext());
requestQueue.add(stringRequest);
}
}
12
OUTPUT
13
CONCLUSION
In conclusion, the weather application micro project has successfully
demonstrated the integration of various technologies to provide
users with accurate and up-to-date weather information. Through the
utilization of APIs, user-friendly interfaces, and data visualization
techniques, the application offers a seamless experience for users to
access weather forecasts tailored to their location. Additionally, the
project highlights the importance of efficient data handling and
processing to ensure real-time updates and reliability. Moving
forward, further enhancements such as incorporating additional
features, refining the user experience, and optimizing performance
could enhance the application's functionality and appeal to a broader
audience. Overall, the weather application micro project serves as a
testament to the power of technology in delivering valuable and
accessible information to users worldwide.
14
REFERENCES
1. www.google.com
2. www.youtube.com
3. www.w3schools.com
4. www.geeksforgeeks.com
5. www.tutorialspoint.com
6. www.android.com
7. E-Books
15