Questions Thread - September 16, 2016

Questions Thread - September 16, 2016


Questions Thread - September 16, 2016

Posted: 16 Sep 2016 05:09 AM PDT

This thread is for simple questions that don't warrant their own thread (although we suggest checking the sidebar, the wiki, or Stack Overflow before posting). Examples of questions:

  • How do I pass data between my Activities?
  • Does anyone have a link to the source for the AOSP messaging app?
  • Is it possible to programmatically change the color of the status bar without targeting API 21?

Important: Downvotes are strongly discouraged in this thread. Sorting by new is strongly encouraged.

Large code snippets don't read well on reddit and take up a lot of space, so please don't paste them in your comments. Consider linking Gists instead.

Have a question about the subreddit or otherwise for /r/androiddev mods? We welcome your mod mail!

Also, please don't link to Play Store pages or ask for feedback on this thread. Save those for the App Feedback threads we host on Saturdays.

Looking for all the Questions threads? Want an easy way to locate today's thread? Click this link!

submitted by /u/AutoModerator
[link] [comments]

I made an app for my university. Do I ask for compensation?

Posted: 16 Sep 2016 06:57 AM PDT

Hi everyone. I've got a question I was hoping someone here could give me their input on.

The university I'm attending right now used to have an app that would display what food was being served in the dining centers that day. It's been used by students for about 5 years. This year, however, the student who made it told the university they could only continue using the app if they paid the developer $15,000. There was a disagreement, and the developer killed the app.

When I got back to school this year I realized the app was broken. So I spent the first weekend on campus making my own dining app. It was relatively simple, but it displayed everything I wanted it to.

I did have the university name and logo on a couple parts of the app, so to avoid any legal issues I decided I should contact the university before publishing it. The email I sent was passed around, and I eventually got a meeting with the head of dining services.

At the meeting he brought up a few features he wanted me to add, and told me that after I completed the app, but before publishing, I should send them the source code so they can convert it to an iOS version as well. I told him that sounded all well and good, and I left the meeting.

It's been a couple weeks now, and I've added everything I possibly could. I reached out to the head of dining again, and I have a meeting with him later today. Here's where I need some input.

I initially made the app just so my friends and I could use it. But now, with the amount of time I've invested in it, I don't know if it would be bad form for me to ask for some sort of compensation. Payment was not discussed at any point in our last meeting, so I don't know if it's even on the table, but is that something that's within my right to ask for? If anyone has thoughts or advice on what I should do, please share. I'm a little out of my element here...

EDIT: Alright, thanks for all the feedback guys. I just met with them, and I'll now be paid by the hour for any work, and my meal plan fee has been waived. All things considered, I think it was a good trade off. :)

submitted by /u/iMakeRandomCrap
[link] [comments]

SwiftKey adds neural network predictions to the stable version of its keyboard (are they using TensorFlow or what?)

Posted: 16 Sep 2016 09:09 AM PDT

Step-by-step guide to adding unit tests to a demo MVP project

Posted: 16 Sep 2016 10:46 PM PDT

Why not distribute the support libraries in a similar manner as Google Play Services?

Posted: 16 Sep 2016 12:37 PM PDT

I've been thinking about this lately, and it seems to me like distributing the support libraries to Android devices in a fashion similar to how the Play Services libraries are distributed could make a lot of sense. (That being said, I will preface the rest of this post by saying that I'm sure I'm overlooking some things here; I welcome discussion!)

Feasibility

Let's address the obvious question first: Is this a realistic and feasible idea? I believe the answer is yes!

What originally triggered this idea was the announcement of "Instant Apps" at I/O—more specifically, the fact that Instant Apps would be supported back to Android 4.1 (API level 16). Instant Apps seem like a fairly complex technological feat, but (while I don't have any concrete ideas) my thinking is that some similar challenges would be encountered for shared support libraries, and those challenges might have solutions already (or some groundwork already in place, at least).

In addition, we all know that the Google Play Store already has the ability to distribute multiple versions of an APK. So we just provide a version of our APK without the support libraries built-in (obviously the tooling would need to support this, so there is that). If we get into a situation where a device (or an app) wouldn't support sharing the support libraries, then that device or app can fall back to the using the full APK on a case-by-case basis (this would, presumably, also be the case for apps which are installed by some means other than the Play Store).

The Play Store is also already set up to distribute things like the Google Play Services libraries, the System Webview, etc. This leads me to believe that it wouldn't be too difficult to set up something similar for the support libraries.

I don't think this needs to change how apps are developed, however; developers would obviously still have the same level of access to the support libraries' internals and such as they do today since they would still need to build "full APKs" to support corner cases.

Benefits

The most obvious benefit is, of course, smaller app sizes. APK sizes would be smaller both on device and during initial download, which is great for everyone (see the "Unknowns" section for a note about method counts).

Device storage space could also be reclaimed since the code for the support libraries would be shared. Now, obviously not every app would be using the same version of the support libraries. However, the worst case scenarios here are:

  1. A device—or all of the apps on a device—won't support it, so nothing really changes; and/or,
  2. Every app on a device uses a different version of the support libraries, so nothing is really being "shared" per se

The net effect of either/both of these scenarios pretty much boils down to "the current state of things". Said another way, I don't see how such a system could make things worse storage-wise.

Finally, I believe this would be transparent to users, and require little-to-no work for most app developers (short of upgrading their tooling, and possibly uploading multiple versions of their APK, though perhaps the latter might be unnecessary with future developments as well).

Risks

I'm honestly having a bit of difficulty coming up with real "risks"; many of them seem more like "unknowns".

That being said, there is always risks which result from "bugs in the system" or "undefined behavior":

  • What if an app's "full APK" and "slim APK" function differently due to some new permutation of {device/emulator, slim/full APK, etc}?
  • What if something is messed up on the device's version of the support library which goes undetected since it works fine in the local version?
  • What if a slim APK finds its way onto a device (sideloading, etc) which doesn't support it?

I think most of these kinds of risks tend to fall into the buckets of "can be avoided through testing" or "out of scope".

Unknowns

There are many unknowns here, mostly stemming from my lack of knowledge and/or lingering questions:

  • I have no idea what this might mean for method count limits and such. Obviously the best case scenario is that we wouldn't have to factor in the methods from the support library, but I don't know enough to answer such questions. That being said, it is sort of a non-starter due to the assumption that we'd still need full APKs for corner cases.
  • Would it be appropriate for the emulators to use this slim APKs? My gut reaction is "no", because it increases the burden on Google (and developers) to keep the emulator images up to date. But, I could understand the argument that developers should be able to test this on emulators (i.e., what if their real device doesn't support slim APKs?).
  • It has crossed my mind that this could require a new APK structure, and if that would be necessary then I wouldn't be surprised if older versions of Android couldn't support this
  • If we were to assume that such a system is feasible, how much benefit would it really end up providing (that is, what is the ratio of supported and unsupported apps? Devices? Versions of Android?), and would it justify the work needed to implement it?
  • Has something like this been tried before?

Miscellaneous

  • Ideally, such a system would be reliable and transparent enough that developers could just trust that slim and full APKs would perform the same way 😉. However, I assume that there would be a way to explicitly choose whether to install a slim or full APK for testing purposes.

Thanks for reading this giant wall of text; I'm interested to hear what everyone thinks.

submitted by /u/bkromhout
[link] [comments]

Android Dialogs, Ryan Harter: AutoValue and Annotation Processors

Posted: 16 Sep 2016 11:43 AM PDT

Could Kotlin's run-time null checks entail a performance problem on Android?

Posted: 16 Sep 2016 10:47 AM PDT

In Kotlin, as far as I can tell, every function that could be called from Java generates a run-time null check for every parameter and return value that is a non-nullable reference type.

Here's a simple example:

fun parse(text: String) { // do stuff } 

This is roughly equivalent to the following Java code:

public static void parse(@NotNull String text) { kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull(text, "text"); // do stuff } 

This doesn't apply to private functions, because Java code could not call them (and of course the Kotlin compiler wouldn't allow Kotlin code to provide null).

Given how strict the d.a.c performance tips sound, I wonder whether these extra method calls could entail performance problems on Android — for example, calling a public function with several non-nullable parameters inside a tight loop.

Does anyone have any comments? I'm not hugely experienced with the cost of method calls on Android.

(I tried asking on the Kotlin forum here, but at the time of writing there are no replies, and it's more of an Android question than a Kotlin one.)

submitted by /u/tomjb_
[link] [comments]

Advice on learning

Posted: 16 Sep 2016 12:36 PM PDT

Hi Devs

I really want to learn how to create apps for my own needs.

Here's where I'm at. My programming skills pretty much resume to my beloved autohotkey. I did create a simple soundboard app for my brother (press button, sound plays) in Android Studio by following examples from other people. I then tried to create another app, one where you'd input text, click GO and it would take you to a new activity with the inputs name (type "spain" and it would go to a page about Spain). Thats when I almost threw my computer out the window!!!

What are some good ways to learn? I have time and I'm willing to spend a little money if necessary (maybe 500 bucks?). Are there any online courses worth paying for? Should I jump to android programming or take the time to learn java first?

Any help is appreciated!

submitted by /u/Skibiribiripoporopo
[link] [comments]

Custom Android Builds: Tools and Techniques for Manual and Automated Tests

Posted: 16 Sep 2016 07:20 AM PDT

Android studio question: Turning off inspection for ONE module, not the whole project

Posted: 16 Sep 2016 10:43 AM PDT

Basically, I have a project that consists of Android and plain Java modules.

For some reason, in the Java modules, it is giving android specific inspection errors, which it shouldn't be. These inspections don't actually affect my project compiling and running - it is just annoying to have every other line underlined in red.

I can turn of inspection in the settings, but then that will affect my Android modules.

Any ideas? Thanks for the help.

(I tried creating a lint.xml config file for the module, and it didn't work. Only project level config files seem to work)

submitted by /u/Recolumn
[link] [comments]

Weird problem with JNI - error loading package (

Posted: 16 Sep 2016 02:50 PM PDT

I am working on a sample app that I'm trying to modify slightly (dlib). The sample uses a library that is accessed over JNI (.so file). The library that comes with the sample works fine. I recompile that library (need to add a function) but now it won't load it, and it throws this error:

dlopen failed: cannot locate symbol "__aeabi_memcpy" referenced by "/data/app/com.tzutalin.dlibtest-1/lib/arm/libpeople_det.so" 

I thought it was a mismatch between the target SDK, so I made sure everything was set to SDK version 24, but I still get this error.

Any ideas? I'm using Android Studio on Windows 10.

Thanks.

submitted by /u/PuffThePed
[link] [comments]

GitHub - kofigyan/StateProgressBar: Android library to realize the various states and transitions in a ProgressBar. Particularly useful in game applications,forms etc.

Posted: 16 Sep 2016 05:02 PM PDT

Problem with Interpolators/ValueAnimators in android 7?

Posted: 16 Sep 2016 08:16 AM PDT

Got a report that an animation isn't running right on an app I've recently done. Checked it out and it seems that on Android API 24 indeed it doesn't run as it should.

Did some debuging and found out that while creating a ReverseInterpolator for a ValueAnimator, the ValueAnimator won't reverse.

This isn't the case for Android API <24.

Tested on: Nexus 6P (android 7.0) Nexus 5X (android 7.0) OnePlusTwo (android 6.0) GalaxyS4 (android 5.0)

Created a sample app to demonstrate: https://github.com/Axladrian/interpolatorProblem/tree/master

Curious if this is a known issue or not.

As well, maybe someone has something similar and should know of the issue.

(yay, 1st post on reddit)

submitted by /u/axladrian
[link] [comments]

Keyboard Making Tutorial?

Posted: 16 Sep 2016 12:21 PM PDT

I want to make a Free keyboard that can take Telegram sticker packs. I'm not really sure where to start.

I know java and xml reasonably well, but I've never managed to get any android app to do anything I wanted it to do. I've tried to follow the tutorials multiple times, and inevitably found a point in the tutorial where it wouldn't do what it said it was supposed to do, no matter how many ways I tried to fix it... But I'm hoping I can put together a keyboard more easily. Hoping.

submitted by /u/danhakimi
[link] [comments]

Oracle JDK?

Posted: 16 Sep 2016 02:37 AM PDT

Since android studio 2.2 is using openjdk, does that mean oraclejdk no longer needs to be installed?

submitted by /u/abhijitht007
[link] [comments]

I'd like some feedback on my first Android app

Posted: 16 Sep 2016 01:20 AM PDT

Weekly "anything goes" thread!

Posted: 16 Sep 2016 06:08 AM PDT

Here's your chance to talk about whatever!

Although if you're thinking about getting feedback on an app, you might want to wait until tomorrow's App Feedback thread.

Remember that while you can talk about any topic, being a jerk is still not allowed.

submitted by /u/AutoModerator
[link] [comments]

How does implementing external payments in your app affect review-time of your app for the play store?

Posted: 16 Sep 2016 02:35 AM PDT

We're building an app for a client in which there's a possibility for the user to buy certain products. We're not using Google Play In-app Billing, we're using our own payment-thing. It doesn't matter why, but what we're a bit stressed about is if that will affect the review-time of our app.

You see the client wants to have the app finished in a week and there's no room for delays. Does anyone have experience with this and know if this makes a difference?

important edit: Okay so I just figured out that I'm posing this question wrong. I'm not the android developer on this team to be honest, but the android developers are kinda stressed out so they gave me this task. So anyhow, now I read in most places that google does not have a review time for apps. So let me pose the question differently: does that change when you have use payment-methods that are not Google Play In-app Billing?

submitted by /u/live_love_laugh
[link] [comments]
Thanks for reading my news about Questions Thread - September 16, 2016 at my blog Custom Droid Rom if you want too share this article, please put the resource, and if you think this article is very usefully dont forget to bookmark this site with CTRL + D on your keyboard to web browser.

New and Hot Article's :

Note: only a member of this blog may post a comment.