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.


How to quickly get approved by google adsense ?


How to create and customize robots.txt file on blogger 

    Google AdSense is a CPC (cost-per-click)-based advertising program that allows website owners to earn revenue from the ads installed. Since its first appearance, many website owners have competed to register as an AdSense publisher in Indonesia. It is proven that until now there have been around 2 million more AdSense publishers spread all over the world and every year it is always increasing.

    Google Adsense can be a great way to make some extra cash. However, it can be difficult to get approved. Here are a few tips to quickly get approved:


1. Make sure your website is well-designed. 


    If your website looks amateur, it will likely be rejected. Improve the appearance of your website. You can do this by changing the color, font used, background and so on. Make your website easy for browsers to load. Make sure there are no errors when the website is loaded. Create a website with the best performance. You can use lighthouse to test your website.


2. Make sure your website is relevant to your keywords. 


    If your website is not related to your keywords, Google may not approve it. Keywords that match your content are important in attracting visitors, if your keywords do not match the content of your website, visitors will be disappointed and leave your website. and maybe these disappointed visitors never come back to visit your website. In addition to having an impact on the loss of visitors, keywords that do not match the content of the website will also have an impact on rejection when you try to flatten your website on Google Adsense.


3. Make sure your website is well-written. 


    Poor grammar and poor writing will likely disqualify your website from being approved. Good article writing can also make your website visitors feel at home for a long time reading your article. It can also attract their interest to come back to visit your website at a later time. You can use tools to write articles such as grammarly and so on so that your article writing results are better.




4. Make sure your website is easy to navigate. 


    Poor navigation will likely disqualify your website from being approved. Do not create circular navigation or hidden navigation that makes it difficult for visitors to access it. Make the navigation simple first. Later, if your website has been approved by Google Adsense, you can change the navigation to your liking


5. Make sure your website is mobile-friendly. 


    Poor mobile design will likely disqualify your website from being approved. Now there are more mobile users than desktop users. So you have to make your website mobile friendly.


6. Create 20 articles of minimum. 


    If  your articles less than 20 articles will likely disqualify your website from being approved. on the grounds of low content value. So make a lot of articles but quality ones, not the results of copy and paste from other websites. Copy paste articles will be rejected by Google Adsense.


7. Use custom domain. 


Use default domain from blogger will likely disqualify your website from being approved.


8. Your domain age must be more than a month. 


If domain age lees than 1 month will likely disqualify your website from being approved.



    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

My google play console account was terminated

A few days ago I received a notification email from Google that my Play Console account has been terminated. The message content is as below...