Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Sereri
Sep 30, 2008

awwwrigami

A few weeks ago I reinstalled windows and everything. I downloaded the current version of eclipse, installed all the plugins. Now that I actually started to program again I ran into this weird problem: If I connect my phone and try to run the app on it, eclipse will load for a while then crash because it runs out of heapspace. However if I remove the phone and run it in the emulator, everything is fine. In fact, if I reconnect the phone it will now run fine on that too.

:psyduck:

Adbot
ADBOT LOVES YOU

Sereri
Sep 30, 2008

awwwrigami

i like tacos posted:

So I'm following the steps on developer.android.com and I can't get past this. It says my Android support library is out of date so I click Install/Upgrade and it doesn't work. It says it fails to create that path. Also when I try to download the extras in the Android SDK it just says access denied. Am I doing something wrong? Is there anything I can do to fix it?




Like any other program the sdk manager can't write to /Program Files unless it is run as admin. You should reinstall the sdk, it installs to AppData nowadays.

Sereri
Sep 30, 2008

awwwrigami

Mogomra posted:

I've been trying to do just that on a fresh install of Windows 7 on and off for the past couple days. The installer refuses to recognize that I have JDK installed.

My PATH variable has "C:/Program Files/Java/jdk1.7.0_07/bin" in it, just for good measure, I've created a JAVA_HOME variable with the same thing. When I'm in any windows command line and I type "java -version" it outputs
code:
java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)
So what gives? All my searching only gives me results where people say "Add java to your PATH variable" and "create a JAVA_HOME variable."

Is there some issue with JDK 1.7.0_07 and the newest version of ADK? I've never had any trouble installing it before...

Drop the /bin from the path and it should work

Sereri
Sep 30, 2008

awwwrigami

I connect my device via usb, enable dev mode, press run in eclipse and it works :downs:

Sereri
Sep 30, 2008

awwwrigami

A few reasons I can think of right now (there are probably a lot more)

Device fragmentation is high (which can lead to bugs on some devices but not others, so you should test on a few), as is supposedly piracy. Users sometimes void their warranty (they root) just to block ads. User reviews are terrible difficult though that might change with the g+ comments (probably not).

Sereri
Sep 30, 2008

awwwrigami

Karthe posted:

Is it just me or is Eclipse terrible for debugging? I get an error like this in LogCat and I'm left feeling as though there should be more information attached to it to help me identify which part of the cited line is faulty:
code:
02-22 08:50:32.832: E/AndroidRuntime(3005): Caused by: java.lang.NullPointerException
02-22 08:50:32.832: E/AndroidRuntime(3005): at com.example.testapp.FragmentSearch.onCreateView(FragmentSearch.java:59)
The error points to this line of code:
Java code:
db = new DBHelper(getView().getContext());
According to the error, db or getView().getContext() could be the problem. Based on my experience, I'm probably using getView().getContext() incorrectly, but you wouldn't know it just by looking at the LogCat error output. Having done a few pet projects with C# in VS before, Eclipse's debugging feels lackluster. Am I just not using it correctly? Are there some better tools or settings I can implement that would improve the quality of LogCat's error logs?

And would getView().getContext() return null from within a fragment? I'm trying to pass along the app's context to the helper class from within a fragment that will display the results of a SQL query.

If that is the line, getView returns null and you try to call getContext on null which causes the NPE.

Sereri
Sep 30, 2008

awwwrigami

kitten smoothie posted:

http://developer.android.com/about/dashboards/index.html

So they've changed the way they count device versions. Before it was based on devices' automatic check-ins over a 2-week period, so basically every device out in the field. Now it's based on devices where the user actually opened the Play store.

I can't tell if this is goalpost-moving or if this actually is a better metric. It does seem to more accurately reflect the user base of one of my apps, for whatever it's worth.

It doesn't reflect the actual Android world anymore since a lot of the old devices maybe get used to check gmail or as a phone but not to download and play Angry Bird 12. On the other hand it offers a better overview for developers since people that don't open the market at all (and thus don't have to be targeted anyway) don't appear in the graph. Since the site is for developers I think it's for the better though I guess they did it because it looks better on them.

Sereri
Sep 30, 2008

awwwrigami

Hello intelliJ, get hosed eclipse

Sereri
Sep 30, 2008

awwwrigami

Doctor w-rw-rw- posted:

Hey now, I didn't phrase it nearly so harshly at the keynote. >:/ though I agree, it was totally dodged. Sad. I hope that the questions get them to think harder about the problem, at least. That was my intention, anyway.

Wait, that was you?

Sereri
Sep 30, 2008

awwwrigami

Soviet Canuckistan posted:

So here's a question: how do I hook the default share mechanism in Android? I know it's possible because apps like Andmade Share do it, but I can't figure out how to. Googling around just seems to recommend hooking android.intent.action.SEND, but that doesn't seem to do anything.

I think this is what you're looking for.

Sereri
Sep 30, 2008

awwwrigami

Glimm posted:

You're just trying to share stuff to other applications right? What exactly are you trying?

This is probably a good place to start: http://developer.android.com/training/sharing/shareaction.html

If I'm understanding correctly have wants to replace the share dialog itself. Andmade proofs it's possible.

I guess you could always try to reverse engineer the app but this is going into :filez: territory.

Sereri
Sep 30, 2008

awwwrigami

Tunga posted:

A couple of Android developer advocates were asked about this on G+ or something, I saw it recently. Their answer was that if you're already using ABS then there's no great requirement to recode your app, but for new apps you should probably use Google's version since you know it'll keep working in the future.

But isn't it just dropping the ABS, including the library and removing all the Sherlock prefixes?

Sereri
Sep 30, 2008

awwwrigami


Where is MenuItemCompat coming from? Is that a static call?

Sereri
Sep 30, 2008

awwwrigami

Karthe posted:

Can I reference an existing string in strings.xml when I define another string? For example:
XML code:
<string name="foo">Foo</string>
<string name="bar">@string/foo + Bar</string>
I want the "bar" string to return "fooBar" right now or "ShittyBar" later if I change the value of the "foo" string to "lovely".
I don't think that works. You could try this:
XML code:
<string name="foo">Foo</string>
<string name="bar">%s Bar</string>
Java code:
String foobar = String.format(context.getString(R.string.bar), context.getString(R.string.foo));
Or of course some good old string concatenation.

Sereri
Sep 30, 2008

awwwrigami

Jarl posted:

On developer.android.com have I been able to find information about how an icon should look if it is enabled or disabled, but I have not been able to find information about what if it is selected; i.e. I want to toggle a feature and I want the icon to look the official way a toggled icon should look, whatever that may be.

This isn't really a thing in holo. You could either make the icon different for either state, make it obvious which option is activate (maybe a toast or something, changing the option text) or roll your own non-holo option which uses an activated state with a special color, like the holo blue that signals it's active.

Example would be in gmail where it toggles between a read and unread button.

Sereri
Sep 30, 2008

awwwrigami

Jarl posted:

Thanks for the information. I don't get what you mean with "maybe a toast" though.

Like a toast that goes "X enabled" or something. That's probably the worst option though.

Sereri
Sep 30, 2008

awwwrigami

Chrome(/Firefox):

Webview, 'Browser':

:negative: a usable GeckoView can't come soon enough. Or ChromeView. I don't care, just gently caress WebView forever.

Sereri
Sep 30, 2008

awwwrigami

Sereri posted:

:negative: a usable GeckoView can't come soon enough. Or ChromeView. I don't care, just gently caress WebView forever.

Playing with it in the emulator as the N5 hasn't arrived yet and I'm not going to flash any lovely XDA roms on my personal phone.

Mostly consistent CSS, debuggable in Chrome, if someone'd tell me that it handles gifs in a sane way it'd make my day.

Sereri
Sep 30, 2008

awwwrigami

Any ideas what would cause this:

nimper posted:

I don't think this is supposed to happen.



According to him no changes to fonts were made and it reverted to normal upon restarting the app.

Sereri
Sep 30, 2008

awwwrigami

baka kaba posted:

Complete speculation, but it could be the text glyphs being pushed to the hardware rendering pipeline, but the stencil masks are getting lost along the way. They're all basic quads, the right colour and shape and position, so they just might not be getting composited properly.

If that's the case I'm not sure what you could do about it, it's an internal thing right? If it only happened once I'd chalk it up to a fun glitch

Yeah that's basically what I was thinking. I've actually seen this before but that was a good year ago.

Sereri
Sep 30, 2008

awwwrigami

GenJoe posted:

So I have an app that authenticates the user with a third party website using account information that the user supplies. Right now I am storing their username/passwords in plaintext on the app's internal file storage so they don't have to supply this information every time the app connects to the website. The files are supposed to be private to the application, but I would still like to encrypt the user information because of obvious reasons.

Hashing here isn't going to work, because the app has to post the unencrypted passwords to the website, so what is going to be the best way to encrypt and decrypt the data to and from storage? I don't have much experience with cryptography, doubly so with doing it in the context of an android app, so any help would be appreciated.

Do you have to present the password with every request? Can't you just save cookies or something similar?

Sereri
Sep 30, 2008

awwwrigami

Jarl posted:

Is there a way to get a method invocation from the OS, when a user uninstalls the app, so that relevant files created on the disk can be deleted (like an uninstaller in windows would)?

Stack Overflow posted:

Sadly android at the moment does not give you a possibility to perform code at the moment your app is uninstalled.

All the settings that are set via the SharedPreferences are deleted together with everything in the Aplication Data an Cache folder.

The only thing that will persist is the data that is written to the SD-Card and any changes to phone settings that are made. I don't know what happens to data that is synchronized to the contacts through your app.

You could however place your files on the SD card with Context.getExternalFilesDir(). Files in this directory will be removed with the app.

Sereri
Sep 30, 2008

awwwrigami

serious norman posted:

I'm developing a game in HTML5/JS and want to port it to Android. This should be pretty straight forward (putting the html in asset and load it with Webview) but will my HTML/js-code be visible for the end user (I guess yes?). If so, is there any way to get around it? If not I might considering porting my code to native android code instead.
TIA

Your code will not be visible to an end user unless they open up the apk (not that easy if distributed via Google Play) and extract it.

You should also look into PhoneGap/Cordova or something similar before writing your own wrapper.

Sereri
Sep 30, 2008

awwwrigami

kitten smoothie posted:

Three strikes and you are banned for life from the store.

According to what I've read this does not only apply to the developer side but they'll ban your entire Google account (mail, g+, play store purchases, etc). For life.

Sereri
Sep 30, 2008

awwwrigami

Material Design compatibility guide posted:

The material theme is only available in the Android L Developer Preview. To configure your app to use the material theme on devices running the Android L Developer Preview and an older theme on devices running earlier versions of Android:
  1. Define a theme that inherits from an older theme (like Holo) in res/values/styles.xml.
  2. Define a theme with the same name that inherits from the material theme in res/values-v21/styles.xml.
  3. Set this theme as your app's theme in the manifest file.

Yeah I bet this will catch on very soon.

Sereri
Sep 30, 2008

awwwrigami

Has anyone material design-ified their apps yet? Any tips?


Also whats is up with Android Studios updater? Half the time it updates itself, the other half it sends me to a download site.

Sereri
Sep 30, 2008

awwwrigami

Tunga posted:

ListViews seem to be unnecessarily complicated. Anyone have a good article explaining the best way to get a bunch of structured data (in my case some JSON) into a ListView with multiple text/image items on each line? I'm guessing I need a custom View which inherits from whatever a ListView displays?

Basically yes. You need a ListView, an adapter and a view that the adapter inflates, stuff your data into and puts into the ListView.


Actually well explained by ^^^

Sereri fucked around with this message at 13:26 on Nov 7, 2014

Sereri
Sep 30, 2008

awwwrigami

I wanted to use AppCompats Light theme but it turns everything on the actionbar toolbar black except for the drawer arrow.

I tried a couple of things but I can't figure out how to turn everything white.

The weirdest thing is that the drawable looks white in AS but it's black in the app.

Sereri
Sep 30, 2008

awwwrigami

It was occurring on all versions.

I just managed to solve it by applying app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" on the toolbar.
Since I want white icons whether it's my normal or light theme, this seems to work.

Sereri
Sep 30, 2008

awwwrigami

Just came across this by chance:

stackoverflow posted:

I have a Preference activity which uses a List Preferences as defined by my XML file. How would I set the summary of the list activity to the value that is selected?

Thank you!

stackoverflow answer posted:

The simplest way to do this is just to have Android do it for you. Assuming you want the summary to match the selected value, you can simply set the summary of the ListPreference to "%s".

Android will replace %s with the current string value of the preference, as displayed by the ListPreference's picker.

I spent far too much time mucking about with SharedPreferences listeners before I discovered this. As a bonus, the list's summary will be set correctly when you enter the activity.

:aaaaa:

I'm currently at work and can't try this but it would probably cut down Awful's settings.java by like 80%.

Are there more magical tricks like this I don't know of?

Sereri
Sep 30, 2008

awwwrigami

What are people here using for crash reporting/analysis?

Awful has been using Bugsense for a couple of years now, but I've never been really happy with it and would love some input.

Sereri
Sep 30, 2008

awwwrigami

ButtaKnife posted:

A bit late with this, but Crashlytics is fantastic. I'm really liking it so far. What solution did you end up with?

Well I'm late with the reply too so it all balances out :). I'm still using ACRA/Bugsense or whatever it's called now. I'm currently looking at Crashlytics and it looks decent, I might give it a shot soon.

Sereri
Sep 30, 2008

awwwrigami

My guess is that it's not an issue with the keyboard but instead the layout works different on Lollipop. The edittext probably just has no height, the other two elements take too much space or something similar.

Sereri
Sep 30, 2008

awwwrigami

Any idea what would cause emojis to be displayed like this:


Might as well be a forum problem I guess.

Sereri
Sep 30, 2008

awwwrigami

I'm trying to get twitter embedding working in Awful. I mostly just updated the SALR JavaScript that was split from the chrome version ages ago. Problem is, only half of it it works. The script looks for Twitter links, parses them and asks the twitter json api for information. These contain an embed code that I inject into Awful's thread view. This works, however it also contains a JavaScript link which styles the whole thing (by turning the div into an iframe IIRC). This never happens and I don't quite understand why. I have already updated the webview settings to allow universal file access where needed so I don't think that's it. Any ideas?

Sereri
Sep 30, 2008

awwwrigami

Does anyone have a good idea for implementing something like this aside from a PopupWindow containing a Viewpager with 2 Fragments?

Sereri
Sep 30, 2008

awwwrigami

That's what I feared. While I'm on it, is there a way to prevent my edittext from losing its selection when touching a menuitem in the action bar? Is it even suppose to do that?

e: never mind, I just added an item to the theme that lets the contextual action bar overlap the actual toolbar. This way the button isn't visible now anyway.

Sereri fucked around with this message at 15:20 on May 15, 2015

Sereri
Sep 30, 2008

awwwrigami

I'm thinking about ripping out the backend of Awful.apk and replacing it with a new one (that actually does what it should). Maybe ripping out the view apart from the layouts too.

What is currently being used for networking, what are the current trends for app architecture?

To give an idea, current Awful.apk basically sends a request via some slighty customised Volley and saves the processed data to a sqlite database (for offline browsing for example) . It then outputs the data via contentproviders to the webview. I think, I'm currently not at a computer.

So, what be a current way to build something like that?

Sereri
Sep 30, 2008

awwwrigami

Has anyone here ever come across this:

I have a webview that does not accept data via loadDataWithBaseURL(). It just stays with empty html and body tags. I can get the html code in via loadData() just fine but that won't allow me to load files from the asset folder.
Interestingly it also works fine with loadDataWithBaseURL() on my phone with an updated system webview but won't work if I uninstall the updates. Still won't help with my non-updated emulator or system webviews.

Adbot
ADBOT LOVES YOU

Sereri
Sep 30, 2008

awwwrigami

Vesi posted:

I do it like this, it was done several years ago so I no longer remember why but it's been tested on hundreds of devices:

with


Thanks for the reply. However my html code is generated at runtime. Also webView.loadDataWithBaseURL() for some reason does apparently absolutely nothing. The weird thing is that Awful.apk has 2 other webviews with mostly the same code and everything is working fine there. Only this one just doesn't want to play ball.
I think as a last resort I might just load the javascript and css via stream from the asset folder and inline it into the html, then just use loadData() :suicide:

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply