When switching Layouts in Android-studio, how to go back if there was no layout when app started? Or how to un-set a new layout? - layout

I‘ve developed a game in Love2d (Lua), and used love-android as the tool to make it run on android-studio. The game works perfectly in Android devices, so now I’m trying to add billingclient.
My problem is, the Project created by love-android has only 1 activity (gameActivity) that extends SdlActivity. Somehow it runs the zipped game .love, but it has no layouts.
So, when I create a button so players can buy in-apps, I set a layout. But after the onClick, I cannot get rid of this button layout, because I have no layout to setContentView back. I’ve also tried to hide the billing layout with “GONE”, “INVISIBLE”, button.enable(false), but it just goes to a black screen. Since I’m new to Android Studio and still haven’t found how the game runs after the android tool is used, I’m not sure even if it is still running after I call this button. Any suggestion on how can I implement a full working button in such case?
If you need more info, I’d be happy to provide it.

Related

Android Studio - Can't move or drag buttons freely

I'm new to Android Studio (working on Windows) and I am now using Buttons for the first time. I'm using them inside a TabHost. It seems that I can't move/drag the buttons to anywhere I want in the design, they just stay at the top of the design. I've searched this on Google and someone suggested a RelativeLayout instead of a LinearLayout. I've switched layouts already and I still can't move the Buttons as I want.
Any ideas? Thanks in advance

Android action bar home button not including activity title

I am using the home button of the main Activity of my IM app to allow the user to change their availability status. My app is using ActionBarSherlock, which falls back to the native implementation where supported.
However, the size of the tappable area is inconsistent between Android releases:
On Android 4.2.0 and before (including the compatibility library), only the icon is tappable:
On Android 4.2.1+, icon and activity name are tappable:
How can I make the tappable area consistently include icon and activity title on all versions of Android?
I am using ActionBarCompat (and you should probably update, if you haven't already), so this may not behave exactly the same. I wanted the full title to be clickable for using the navigation drawer. For some reason, using a custom logo instead of the text makes the whole thing automatically clickable, where only the icon could be clicked before:
final ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayUseLogoEnabled(true);
actionBar.setLogo(R.drawable.im_title);
I don't know if it's possible to trigger that change while still using text with the default icon, but the setDisplay... methods and flags may be a good place to start looking.

uiwebview preventing access to buttons on uitoolbar

Am I thick or what? I have a view controller, and within that there is a UIWebView. When I run the app, the WebView covers the UIToolbar at the bottom and the UIButtons there, and so you cannot navigate away from the WebView. I cannot figure out how to change the WebView size or behaviour.
Unfortunately I do not have sufficient rep to post screenshots. The WebView displays an html file with text. The WebView partially covers the status bar at the top and completely covers the taskbar at the bottom. I can touch and drag the view up to see the taskbar and buttons at the bottom, but cannot use them.
I am using storyboard to build the app, and have done similar apps before without issue (in iOS6) but iOS7 appears to have thrown me a curveball.
I cannot see how to change the size in Xcode - or should I be looking at the html code in the file that the WebView is calling?
Oddly enough this is no longer an issue, I have not made any changes to code or config, and the only thing different is I upgraded my version of X-Code

Custom navigation Titanium

I need do a very special nav or tab bar for a app, I looked this but I not have idea how to make some similar, I work with Titanium mobile, someone with experience could tell me how to make some similar with Titanium, or if someone have other navigation bar more complex that the examples on the kitchensink.
This is where I'd start. Understand that that video is obviously a complex interface and will definitely take work on your part.
This (http://softlywired.com/ticustommenu/) piece of code will get you started, but you will need to go way beyond it writing that interface control. I'd then move on to creating the boxes that pop up, without animation, down the center. After that was working, I'd look at animating them and adding the event listeners to it.
You'd be a star in the Titanium community if you got it working and released the source code to it.

Strange behaviour in my android app (Android 2.3.5) - Things get inflated wrong

I've been experiencing some very strange behavours in an app I'm developing. The app is not very advanced, it stores a couple of places in a sqlite database and is displayed in listviews, on a mapview etc. So, when browsing through my app after deploying it to my phone everything works great, but after a while one listview doesn't get inflated. A scrollbar appears as if the items were there but I can't see them. I push the back button to close the app. When revisiting the app my first view, which has two buttons, gets all messed up. The buttons fill the viewport and the background disappears etc. I can't figure out what's wrong.
Anyone else facing these problems? My phone is a HTC Desire HD with Android 2.3.5
The app is pretty "layout heavy", if you know what I mean. The listview items has custom background images, I'm using custom fonts etc. But the app is running smoothly up to the point when it freaks out and displays/don't display everything wrong.
My first thought is there is some kind of memory issue, ideas?
EDIT:
I believe this might have something to do with defining and using #00000000 as transparent color. Use #android:color/transparent instead.
SOLUTION:
So after doing some testing I found that what I previously mentioned in the edit really is the cause of this problem. I had defined the transparent color in my colors.xml as #00000000. This seems to work, sometimes... And other times it grabs a drawable instead, but not a drawable that is named "transparent", it grabs ANY drawable. Weird but true.
After some testing I finally found the cause of this problem. I had defined the transparent color in my colors.xml as #00000000. This seems to work, sometimes... And other times it grabs a drawable instead, but not a drawable that is named "transparent", it grabs ANY drawable. Weird but true.
So to fix this problem you should use #android:color/transparent instead when you want transparency on, for example, a view background.
If there are memory errors you should be able to catch them in logcat. You'll get "VM failed on xxxx byte allocation" messages (or the like).
Silly/stupid answer: often when I run into layout issues within my app, it's because I needed to do a clean build after having changed my layouts. You might want to start there.
Edit: You might also try the emulator, and if you suspect memory issues you could start the emulator with a small heap to force the issue to occur sooner. You can also check your heap usage in DDMS or with the Eclipse MAT to see if it's leaking.
I was experiencing the same problem on Galaxy tab even with #android:color/transparent. Was able to fix it only by replacing android:background="#color/transparent" with android:background="#null".

Resources