How to Check if the number is Triangular or Square in Android

How to Check if the number is Triangular or Square in Android

Another Headache! You are stuck in Android App where you can to check if number is triangular or check if number is square but you’ve not good luck yet.

Let’s start the Android Studio, create a new empty activity, open up the XML of the activity and paste the following code.

 

Now Open the java file for that activity and paste the following code.

Replace isSquareTriangular class name with your class name, also edit the package for the class.

An output like this will be created, where you can easily put a number which the program will check if number is triangular, check if number is square or both.

[[Also check If you’re stuck at Activity must be exported or contain a Intent-Filter]]

In the below example, you can see that the Toast message shows that the number (1) is Both. If you will check other numbers it will tell you the other two parts of App if number is triangular or square.

if number is triangular

 

Final Words on Check If Number is Triangular or Square

Sometimes the university or college assignment and mini projects will ruin your happiness but not anymore, Just follow the above steps, if there anything wrong or you have a question just ask us in the comment section.

How to Run a Specific Activity in Android Studio?

How to Run a Specific Activity in Android Studio?

As title mentioned that you want to run a specific activity in Android Studio

We got a possible solution for you.

Possible Solution

Your Android Manifest will contain all the activities code, all you need is to add

This one line into your activity tag. This will allow the IDE to run a specific activity in Android Studio.

Now go the Run from the Menu or press ALT+U to open the Run drop-down menu. Choose Edit Configuration from the list.

run a specific activity in android studio

Now from the Launch Option Select the Specified Activity and start typing in the activity text input, the android studio will automatically show you the list of all activities, select one from them or write the name of your activity.

running specific activity in android studio

Hit the Apply and Ok button, and Run your App.

Final Words on Run a Specific Activity in Android Studio

So, this is how we do running of specific activity in android, if you face any problem just let us know in the comment section.

Android Error: The Activity Must be Exported or Contain an Intent-Filter

Android Error: The Activity Must be Exported or Contain an Intent-Filter

When you run the android application in the Android Studio and you face an error, The Activity Must be Exported or something like below.

Error running Dashboard: The activity must be exported or contain an intent-filter

There are possible solutions which can help in getting rid of the error.

Possible Solution 1

if you face The Activity Must be Exported error. First, you should double check the manifest code and look for below code.

Your main activity must have this code inside the activity tag. It should look like

Possible Solution 2

if The Activity Must be Exported error doesn’t go away by following the solution 1 then follow solution 2.

There is a drop-down menu beside the Green Run (play) icon. Select the “app” from the drop-down and run your app again.

The Activity Must be Exported - Android Studio

 

Coding in the android studio is not so hard but sometimes we face errors which really make us annoy but we try our best to get rid of the errors, sometimes it’s hard to find the solution to the problem or error.

Final Words for The Activity Must be Exported Error

If the problem still persists, and you’re not able to solve it, just let us know in the comment with the snap of code and little description that what you’re trying to do. We will try our best to get back to you as soon as possible.