Technical world

Here, I am gonna explore coding, Debugging, Error fixing, My articles and other technical posts. So stay tuned.

Starting one activity to another in android studio | how to go to another activity in Android studio

Starting an Activity 




As we know Website is a collection of web-pages linked with each other. And the Android app just a collection of Activities linked with each other.  So we need to provide a link to open new activity.


  • Create two Activities in your Android studio.Let say Activity A and Activity B.
  • In both of the create a button A and Button B .
  • In Activity first Go to Java file of it and initialize the button object of button A. As shown in figure below.


  • Then with the Object of button A call the function setOnclickListener() as shown in code below.

  • As this function takes the argument of onClick function. So in the onclick function make the object of Intent class which is used to start the next activity.

  • In the Image above i created the object i of Intent class and this Intent class have one constructor which take the context and the name of the java file of new activity with extention .Java . After that call the function startActivity() and pass the object of the Intent class. Then your hole code will be look like the image given below.


so use this code to open the new activity.

==============================================

I hope you like the way to my teaching to please don't forget to comment below and share with your friends.  

=============================================








All about PUBG game | PUBG game facts | PUBG mobile | Interesting and Fun PUBG Facts - Unbanster

PUBG

PLAY UNKNOWN BATTLE GROUNDS



As we can see this game is on Trending now. If there is a computer ,xbox and mobile. This game is crushing the every game. And it become very popular now a days. In India everyone is playing this game. first off let me tell you why it is so popular.


It is very Popular because firstly is the multiplayer game and we can interact with each other. This become very Unique for mobile phones users and this feature was not available in any of other game. So this thing sound unique to everyone And in India there is Alot of Smartphone users that's it is more popular in India. Its like a kind of open world game and Multiplayer we can play it with friend and family so that is the reason why it is so famous game Now a days.   
  

Let's Just talk about some the facts of pubg game:-

  • It brakes the record of the game DOTS 2. There is 134,280 Players playing this game PUBG at a time. So it brakes the records.

  

  • In pubg the is 100 Players playing game But in reality there is only 70-80 real peoples are planing only and other 20-30 are bots. means these are programmed by developer to play inside a single match. this is because to decrease the difficulty of the game.So  as No one can bored or frustrate with this game more and more play this game. and this the strategy of the developer that every one can play game without getting bored and frustrated.


  • So as you can when you win in this game then there is massage over there is that "Winner Winner Chicken Dinner"


     
this line is very old when peoples were play in casinos or beats. Then they really dose Chicken Dinner after winning the match. In those was very costly and only some people can afford the chicken and when they win some money Then they dose Chicken dinner.
  • There is 2 million copies of this game were sold in just one month.

  • we can record 3D Cinematic view in PUBG computer. Like movie we can take shoots from different angles.



  • This game is not advertised any more. the Success behind the popularity of this game is we People. This game is popular with the help of Word of mouth. like i play this game and i tell my friend to play and my friends tell other peoples. and so on.

  • Brendan Greene known as Player Unknown likes to be anonymous on occasion. Rumour has it he took his default nickname in ARMA 2 was Player 1, so he changed it to player unknown to create a character on the server. He liked the sound of it, so Greene used his nickname in the video game brand and his company.

  • Driving around the PUBG map will be much faster to reach places. The Dacia is the best car you can drive in, providing you speed, protection to take cover and carries four people if you are playing in a team.








We hope you enjoyed reading these 12 interesting PUBG facts!

Please dont forget leave your comments down below and Shere is post with your PUBG lovers friends.
=====================================================================


===================================================================== 
pubg mobile cheats

Use of this keyword in Java | Java This Keyword - Java Programming

This key word 

Lets create class A and in this class let me define a constructor A which takes a int value in a variable and in the class A there is a Private instance variable. As shown in figure below.


And it also have another show method to display massage. 
So focus on constructor A what we are doing there is we assigning the value of a in the variable x.
so this will work correctly.


But what if we do this.


Now compiler will be confused and it make the instance variable in the constructor to Local Variable.
To over come this confusion we use THIS keyword.



Thank You

  

What is SharedPreferences in Android Studio | All about SharedPreferences in Android. | How to use SharedPreferences in android app

SharedPreference

So welcome Guy to my blog. I explain everything as much as possible to me by using images.
So lets get started


SharedPreference is just a simple mechanism to store data. It stores data in Key-Value pairs.

In the data there is something on the right side is Value and something on the left side is Key. 
So store that some data in the form of key and value. and to access some value we need to know about key. we can access any value with the help of key.We can store data like Username, Password,apptheme etc.




Type of data We can store 

  • Ints
  • floats
  • booleans
  • Long
  • Strings
  • Double 



Some uses of SharedPreferences

  • we can check for update or status of last update. Simply we can stored the time and date of the file
  • Remembering the user name and password or we can say the login information
  • Remember User settings.
  • Location Caching.



How to use it .

First, How to store data in it.

STEP-1

Get a reference to the SharedPreferences objact:

use : GetSharedPreferences(String name , int mode);
So here now what String name and int mode is. String name is for the name of your file name. like when we store data in SharedPrefereances it create a file in XML automatically in the app file. So we need to give the name of that file So that we can call that file with its name and we can access the data from that file. And the int mode is who can access your this file there are many modes in your android system like MODE_PRIVATE which means only you app can access that file, MODE_WORLD_READABLE Which means all the apps can read that file, MODE_WORLD_WRITEABLE all apps can write that file etc
for Example : 
SharedPrefereances SP= GetSharedPreferences("Data",Context.MODE_PRIVATE);

By doing this what will happens is that there is a file will be created in your android system with name Data.xml So this is first step After then yes we need to edit that file we need to add some values in it so then.

STEP-2

use: SharedPreferences.Editor edit=SP.edit();

In this We create the object of editor class with name edit and call the method edit() with the object of  SharedPreferences whis is SP in my Example.

SharedPreferences.Editor edit=SP.edit();

STEP-3

Then we need to add some values to our file. so call the method putString() by useing the object of Editor. like in my Example i used edit.

putString(Key, value);

As i said before that we can store any vale in it . like int, float,String etc 

edit.putString("name","Hemunt Sharma");
edit.putString("password","abc");


STEP-4

And in the last we call Commit() method to write these values into that Data file.

edit.Commit();






NowHow to Receive data from it.

STEP-1

Again create the object of SharedPreferences and give the file name in String and int mode
use: GetSharedPreferences(String name , int mode);
for Example : 
SharedPrefereances SP= GetSharedPreferences("Data",Context.MODE_PRIVATE);


STEP-2

Now time to get some values for the file Data.xml which we have created. Call the function getString().

use: getString(key, default value); 

for Example : 
SP.getString("name", "");
SP.getString("password", "");

Here the default value means of there is no value in any key then it will show up the default value.
Now store that value in any variable and and you can access that value

for Example :

String name = SP.getString("name", "");
String Password = SP.getString("password", "");



You can use there variables anywhere.So thats it for this one guys thank you for watching.



So thats all for  this one guys. if you want Video example on this topic then comment below.
and don,t forget to share this with your other friend who needs this kind of stuff more.


What is Context in android | Explanation of context class in android.

Context in Android

It is the Abstract class and it is present in android.content.Context package. 

There is many use of this context class and let me explain here everything about it.

Here is the following uses of Context class :
  1. It allows access to application-specific resources and classes.
  2. It works in launching activities.
  3. Broad Casting
  4. Receiving intents, etc
Now there is many use of Context the question is what is context.In simple words "What ever related to the application environment Context will help you in that cause". It is a Abstract class. So There is no need to make a object of it.Its implementation is provided by the android system.

What is view in Android | All about view class in Android studio


View in Android

This class represents basic building components. Building components like EditText, Buttons, or other UI (User interface) Components. What ever we see in the Android screen is View.



Whatever is in your Android screen is View like buttons, Radio Buttons, etc
View occupies a rectangular area of your screen and responsible for event Headlining.  
As shown in image below.




View is the base class of all the widgets. Base class means View is the Parent class of all the widgets in android studio. And widgets are nothing but the UI components. 


  • AnalogClock.
  • Button.
  • Chronometer.
  • ImageButton.
  • ImageView.
  • ProgressBar.
  • TextView.
  • ViewFlipper.

So here the new thing introduces is that View Groups Which is the Subclass of the  View class
What dose I means is the View is a parent class and view Group is the child class which inheritance
the base class view. View Group is the Invisible containers which contain other views and other UI components. 


   
The image above is just only showing view groups But in java there is another format we will discous is later

So ViewGroup is invisible container. what dose it means is that it only contains some other widgets in it. 
These are some of the invisible containers or we can say layouts :
  • Grid View.
  • Linear Layout.
  • Frame Layout.
  • Relative Layout.
  • Table Layout.
  • Card Layout.
  • etc.

View is Present in the android.view package.

public class View 
extends Object implements Drawable.CallbackKeyEvent.CallbackAccessibilityEventSource








So the above image explains every thing about the View which is that In android View is the base class of all the widgets and View group they both extends view class and the View group class is the 
parent of all the invisible components or we can say containers.

  Thank You 





Creation a new project in Android Studio | Making new project in Android Studio with full explanation.


Creation new project in Android Studio with full explanation.


There is a lots of tutorial on internet that they show you how to create a new project on Android Studio. But whats new in this post is that i will explain every thing which you see in every window of creating a new project.
So This is going to be the first post related to Android studio Tutorials. 

Before we start let me give you the link of android Studio So Download it and we will go ahead 
So now i suppose that you downloaded the Android Studio. Install it and Run it.Create a new project
When you Run android studio. you will see there is a tab called create new project.



  • Click on the Create new project when you will click that you will see something like this as shown in the image below.




so in the image there is some numbers and let me explain one by one 
1. So,There is a text field there which says Application Name So as the name say. Here we need to enter the name of the Application.
2.  Second is may be little bit confusing. don,t worry i will tell you whats that. so second text field says Company domain. so if you have any company (Example: Microsoft) then write or if you don't the let that thing default. Basically what that thing is that is the name of your company or your domain which will be shown in the Play-Store below the name of your app.
   3. Location of your project as the name says. you need to set the location where you want to  place the project or you can leave it default.
Basically when your project will be created then on that location you will the android studio make some folders and there folder is basically your android app.
4. There is a check box which says to include the C++ support. Like if you are good in C++ the you can include the C++.you can code in C++ 
5.  Kotlin it is the New language introduced in September 2017 by google For Android so if you wanna include the kotlin in the project then click that check box.
6. That is the warning massage 



  •  Hit Next when you will done with the first window and  move on to the next one. Now there will be the new window opens which says Target Android Device as Shown in image below.  


So now in this window we see there is 4 sections which is highlighted.
so first one is impotent instead of others
  1.  So the first option says to select the SDK and Devise. So as we making the app for android mobile device. We can also make the app for wear, TV But for now lets select the Phones and tablets.When you check on phone and tablets then you need to select the API level (Application Program interface) which we can say Android version.So question is which api level we need to select. The smaller your api level is then is maximum chance that you app will run in may devices. If you select latest version like oreo then there is very less users of oreo and your app will run only in orio version.If you select the lower version/API level like ice cream sandwich then your app will run in all ice cream sandwich and the lower once.
      
  2. In the second section you can select the check box for wear. and its API level
  3. Here you can select this box if you want to make app for TV.
  4. In the last section you can select for other android devices like now a days android we can use in cars. 
After the you if you select the device and API level then Hit Next and lest move on to the next window.



  • New in window is for selecting an activity




  So Now the question is what is an activity. In easy words like in PC there is window of some software / application and in android we say activity. Like a site is collection of web-pages linked with each other like that an android app is nothing just a collection of activities linked with each other.
There is lots of activities available here which is created by android studio. we can select any for now lets select Empty activity.And click next.



  •   New we at the last step of the Creating new project.



Again there is 4 Number which i have given in the image so lets explore the last step one by one:
  1. First text box is to give the name of your java file or main activity file Basically when we create an android app we design a layout in Xml and code in Java / kotlin so this first text box is for giving the name to java file.
  2. Second is the check box which tells to generate the layout file we need to tick this one because yes we want to make a layout file so as to work on xml.
  3. Then the third one is to to name the layout file name. basically here we give the name to xml file.
  4. Android apps can be backward-compatible without checking this checkbox.If false, this activity base class will be Activity instead of AppCompatActivity Android studio is letting you know that if you uncheck the "Backwards Compatability(Appcompat)" box, then you'll be including & using the library Activity instead of AppCompatActivity. For a more detailed comparison between the two, check this: Activity, AppCompatActivity, FragmentActivity, and ActionBarActivity: When to Use Which? Generally, what do android developers prefer? enabling backwards compatibility or without it? A comment written by "CommonsWare" explains this best An activity created with that checkbox checked is no more backwards compatible than is one without that checkbox checked. Checking the checkbox gives your app a particular look and feel that will retain that look and feel on some older devices; leaving the checkbox unchecked means that some aspects of your look and feel will be different on pre-Android 5.0 devices. This does not impact the core functionality of the activity. 
        After doing these two steps
========================================================================
Then hit finish and your project will be build in 2-3 minuets.
========================================================================

Please don't forget to Share this post with you friend who want to learn something.
THANK YOU