Android app force closes when theme is set - java

I'm just getting started with Android dev, done a few tutorials, now I'm working on a simple app. On both the emulator and my phone (Android 4.0.3 emulator, Android 4.1.1 Atrix HD) apps are displaying in what I think is Holo Light. I'd rather have it be Holo Dark, but when I add the following line to the application block in the Android Manifest file: android:theme="#android:style/Theme.Holo" the app compiles fine but force closes as soon as I open it.
What am I doing wrong? I'm sure it's something really simple, but as I said I'm new to this. Thanks in advance, y'all!

If you want to use a theme for all the activities of your application then you need to use
<application android:theme="#style/CustomTheme">
in AndroidManifest.xml.If you want a theme applied to just one Activity in your application, then add the android:theme attribute to the activity tag instead.So need to know what type you use in your application.However see these things which will clear you more..
http://developer.android.com/guide/topics/ui/themes.html
http://www.androidengineer.com/2010/06/using-themes-in-android-applications.html

The simplest thing you can do and you should always do is to read logs why does it crash. The log will tell you the reason of you crash. Please post the reason including logs from Logcat and only then ask about fixes:)

Related

Can I start Android App not in FullScreen mode?

I saw that youtube app can minimize to small window that displays over all other windows.
I want to do the same with my app.
What strings in manifest (or any other string) do it?
Thanks,
I am about this:
Take a look at google documentation about this topic, it is called picture-in-picture
You need to add the first two lines to your activity which will handle Picture in Picture (PIP) mode.
The third line needs to be added so that your activity will not relaunch once layout changes occur, such as device screen rotation.
android:resizeableActivity="true"
android:supportsPictureInPicture="true"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
You can find more information about this in the android documentation.
Here is a tutorial on how to implement it.
You can refer to the following tutorials which are nice to understand
picture in picture feature
https://medium.com/#mujtahidah/making-picture-in-picture-android-4120ac73efb4
http://www.zoftino.com/android-picture-in-picture-mode-example

What does "screenSize" in Android Manifest do?

Hello I have got an Activity, where I have multiple Fragments inside, where AsyncTasks are running. My current problem is, when I change the orientation of device, while AsyncTask is doin stuff, App is crashing. As far as I could read from some threats, the addigin "screenSize" like:
android:configChanges="orientation|screenSize|keyboardHidden">
should solve that problem. But now, my app is crashing every time I change the orientation - what does screenSize exactly do, and why is my app crashing while changing its orientation?
edit: is there any special thing I have to give attention while using screenSize concerning my fragments - so the app does not crash?
thank u
See this link for your error: https://gist.github.com/daichan4649/2480065
If you don't want to re-create the fragment on OnCreate, you should use setRetainInstance(true) as described in the link.

Android app crash (web_view)

So Every time i try to run my app, it crashes. Their are no errors in the code.
Its just a simple webview app. But when i run it in the eumlator, i get these errors in the logcat. I tried to look for soultions, but cant find any. I just cant figured out why it keeps crashing. I made a app just like this before, with the same code and had no errors. So i went back and compared the two code, and their the same. I dont know if its a error with android studio, becuase i did update my android studio.
http://i.imgur.com/A2NsPYJ.png
These is the logcat
You may want to take a look at your android manifest file and make sure that the android theme you are using in the webview or app is Theme.AppCompat or a descendant of Theme.AppCompat. This is a weird issue but its happened to me before and I changed the theme to comply with what the error message was telling me, and it worked.

Adverts not appearing on my Android App - Google AdMob

I have made an android application and put adverts in using Google AdMob.
On Eclipse's Graphical Layout there is a white rectangle which says 'Ads by Google' in it, which shows that it has been set up properly.
However, when I run the app on the simulator and in real life, nothing shows up. Why would this be?
Thanks in advance!
You should make sure you have setup your Android Application properly with Ads, go over the following steps and ensure that you have done them correctly.
GoogleAdMob Jar in your libs folder
GoogleAdMob Activity in your manifest
GoogleAd AdView in your main activity XML file, with your adunitId correctly inputted
And Ensure your class in which your AdMob is coded in is correct.
Let me know if these steps help you or not.

The Activity does not start with usb connected and debugging

I couldn't find if this question was asked before, sorry if it was.
I'm building an application, the MainActivity extends FragmentActivity because I have two ViewPagers that shows my fragments.
I don't know why, at the beginning I was debugging my app without problems, but after some development I can't debug my app anymore.
When I start debugging, it shows "Waiting for debbuger", then when my activity launch, it stops into white window, I have to remove my USB cable to access my application.
I have no error logs, no crash warnings, nothing, my app runs without any problem, I have no problems to plug my USB cable again.
The only thing that is showed on my pc is and DexFile.class saying the following, but I don't know how it works:
"Source not found
The JAR file ...\sdk\plataforms\android-16\android.jar has no source attachment.
You can attach the source by clicking Attach Source below..."
I created a TestActivity with a single Text View, I had no problem with the debugger, the problem looks to be on my MainActivity.
I have friends with the same problem, but we couldn't find a solution, I also tried:
Window >> Open Perspective >> DDMS >> View Menu >> Reset ADB, but nothing changed.
What is wrong? As I said, no errors on my logCat, my app does not crash, nothing, I'm facing some problems with my Service but I believe they are happening because of this issue.
Thanks in advance and forgive my English.
First, go into Project->Clean and err...clean the project ;)
Then, make your app debuggable by adding android:debugabble="true" in AndroidManifest.xml, where your application is defined:
<application android:icon="#drawable/icon"
add this---> android:debuggable="true"
It's not necessary since SDK Tools, Revision 8 (December 2010), but please give it a go.

Categories