Move from one activity to another activity with data in android studio

 

Hello everyone, in this post I will share a simple tutorial for those of you who are just learning to make android applications using android studio.


In this tutorial we will learn to move from one activity to another activity with data in android studio.



1. Create New Project


   The first thing we have to do is of course create a new project in android studio. In this tutorial I named the project "MoveActivity".




2. Create desain user interface


   Open activity_main.xml in the folder layout, then add element as follows



   Right click on layout folder then select "New" and "Layout resource file " and then fill the file name with second_activity , then add element as follows




move from activity android studio

4. Add Java File

Open MainActivity in java folder, then copy the code below




Right click on java folder then select "New" and "Java Class File"  and then fill the file name with "SecondActivity"






5. Edit AndroidManifest XML



6. Run the project




Convert Byte to Hex, Byte to Dec, Byte to Int java android studio

 


1. Convert Byte to Hex


    To convert byte to Hexadecimal we can use void or function below :




2. Convert Byte to Reversed Hex




To convert byte to Reversed Hexadecimal we can use void or function below :




3. Convert Byte to Dec


To convert byte to Decimal we can use void or function below :





4. Convert Byte to Reversed Dec


To convert byte to Decimal we can use void or function below :


5. Convert Byte to Int




To convert byte to Integer we can use void or function below :



6. Converter Class to Convert byte data


Here is example an converter class, we can use it to convert data from byte.



7. Convert byte to String


We can use command "toString()"

Example :

1. There are data byte :[B@4528055b

If the data convert to Hex Become : 48656c6c6f20576f726c642121

How to make RecyclerView in android studio?

 

    Hello everyone, in this post I will share a simple tutorial for those of you who are just learning to make android applications using android studio.


In this tutorial we will learn to create a recyclerview in android studio.


1. Create New Project


The first thing we have to do is of course create a new project in android studio. In this tutorial I named the project "Recyclerview".




2. Adding permissions in Manifest


Open AndroidManifest.xml then add internet permissions so that the application can access the internet. This is required so that images loaded from urls can be displayed.


3. Added dependencies in Gradle


Add recyclerview, cardview and glide libraries.

4. Create class data


This data class is used to store data



5. Desain user interface




How to create recyclerviev android studio

Open activity_main.xml, then add recyclerview as follows


Create a new layout with the name item_list.xml for each item's view. This is where we put the cardview. In this example we display the image, title and post date of the article.


6. Making adapters


Here is the complete code for the adapter for recyclerview. In this adapter we also add an action when the item is clicked, it will open the selected article.


7. Prepare data


Here I prepare dummy data in the form of ArrayList





8. Showing data in recyclerview


To display the data, we just need to send the data to the adapter with the addItems function and don't forget to add notifyDataSetChanged() to refresh our recyclerview.


9. MainActivity.kt full code


Here is the complete code for MainActivity.kt


10. Run the project

If there are no errors, the result will be the same as the image below.


How to create recyclerviev android studio

 Okay, that's enough for now from me, if you have any questions, please comment in the comments column. If something goes wrong I apologize. Hopefully helpful, and thank you.


Featured Post

How to fix CLS issue in your blog or web ?

  Fixing CLS issues is a big deal. That's because most of your competitors won't fix CLS problems and as a result won't rank wel...