The main activity is the one which starts before the other ones.
Questions tagged [main-activity]
201 questions
0
votes
1 answer
Android app crashes onDestroy while a location service is running
I wrote an app that starts a location service, the service gets an Address using Intent, and pops a notification when the location is inside and outside a pre-defined radius.
The problem is when i'm trying to destroy the MainAvtivity. I want the…

Tomer
- 1
0
votes
2 answers
How to stop the sound of my MediaPlayer when the app closes?
I got three questions.
How can I do it that the sound of my MediaPlayer stops when i switch/close the App/Activity?
How can I do it that sound1 stops when I press on sound2?
How can I stop and play the sound on one button? I mean that when I press…

Aaron Waller
- 175
- 4
- 21
0
votes
1 answer
If i try to integrate Google AdMobs my app crashes
I tried to integrade Google AdMobs into my application.
I wrote that in my XML:

Aaron Waller
- 175
- 4
- 21
0
votes
1 answer
Creating new CanvasView
I am a beginner in programming... so maybe this question sounds funny to you.
I have a problem on creating a new CanvasView inside the MainActivity because it has something written inside its brackets.
Here is my MainActivity:
public class…

nok4
- 1
- 1
0
votes
2 answers
Error:(69, 20) error: method onCreate(Bundle) is already defined in class MainActivity
I am creating a simple app. I am running into one problem to finalize the app.
I am trying onclick image WebView in tabbed view.
However, only the first button opens the scanner. The second button does not do anything.
This is my current code from…

Dipesh Bhoir
- 1
- 2
0
votes
1 answer
Set default activity, execute before main Activity
I want to make register_activity is first run if application open. But, still MainActivity run first. Can anybody help me to fix this.
This is my Manifest :

Denny Kurniawan
- 168
- 1
- 3
- 21
0
votes
1 answer
Start application after crash
I want to restart my application after crash. So I created a crash handler on Application class:
public final class MyApp extends Application {
private static Thread.UncaughtExceptionHandler mDefaultUEH;
private…

cimenmus
- 1,386
- 4
- 18
- 31
0
votes
1 answer
MainActivity gets recreated multiple times while measuring certain SIM Data
I recently started Android Development and am creating an app that measures certain SIM data, however when some data about the SIM changes mainActivity recreates itself each time certain data changes so I lose all the old data that I need to log and…

Shivam Dave
- 1
- 1
0
votes
1 answer
Missing styles. Is the correct theme chosen for this layout, (can not resolve AppCombatActivity)
I need help because i build this project(from udacity course of android beginner)
its ok but when i clean it and reopen it shows an error related to my theme used. Please any help would be appreciated.
apply plugin:…

D.Hajdari
- 1
- 3
0
votes
1 answer
What classes to put the progress bar code in?
I am building a circular progress bar with the library that can be found here on github. And I have gotten the circle to display with the xml given and added the dependencies to the build.gradle. Along with adding the correct attrs and the dimes to…

Fidel_Willis
- 31
- 7
0
votes
2 answers
Why does this code seem not to find the MainActivity?
We are writing an android based Application that tracks several Mobilephone sensors now I tried compiling the code when suddenly this happend
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.max.pswi, PID:…

Joshua Berghoff
- 1
- 3
0
votes
0 answers
android: make function to launch the main site of an app
I have a tutorial how to use my app when it is first launched, but I can't get to my original app. I need a function for opening the main site of my app.
Tried this but it didn't work:
private void launchMainScreen() {
…

nolags
- 633
- 1
- 11
- 30
0
votes
1 answer
Refer Custom Class to MainActivity.java
Apologize for this question. it might be bogus. but I need help as I m searching for the answer from back two days. I cant find any solution.
How to connect any individual class to MainActivity.java
Here. For instance. I have custom java class…

Marsh
- 35
- 6
0
votes
1 answer
Android Studio: MainActivity.java file is depreacted
Suddenly my Android Studio is giving me deprecated MainActivity.java files for any new projects.
I resinstalled Android Studio, but still the problem is not solved.

Amit Chhatbar
- 93
- 1
- 9
0
votes
1 answer
android - Sending a broadcast to MainActivity and then showing a TextView
I want to unhide a TextView once a method is called in another View file.
The TextView is in MainActivity.
For this, I am planning to send a broadcast from the View file to MainActivity, but it didn't work.
How would I achieve this?

Eddev
- 890
- 1
- 10
- 21