appsetup documentation
This commit is contained in:
39
docs/documentation/android/appSetup.md
Normal file
39
docs/documentation/android/appSetup.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# Setting up a android app
|
||||
|
||||
## How to make your project from a empty project
|
||||
|
||||
### Layout
|
||||
You first need to make the layout of the app. This can be done in the res folder where you can make a android recource file. When you open that file you can drag and drop elements in the layout.
|
||||
|
||||
### Code
|
||||
Then need to make the main class. The class will probably look like this.
|
||||
|
||||
```java
|
||||
package com.fitbot.fitbot;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// set activity_main to your respective layout file
|
||||
setContentView(R.layout.activity_main);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Manifest
|
||||
For the app to be able to build you need to add the activity to the manifest file. You can do this by adding this to the manifest file.
|
||||
|
||||
```xml
|
||||
<activity android:name=".MainActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
```
|
||||
The class name that is ran first is defined in the first line of the class.
|
Reference in New Issue
Block a user