• Breaking News

    [Android][timeline][#f39c12]

    Thursday, December 28, 2017

    12 Practices every Android Development Beginner should know — Part 1 Android Dev

    12 Practices every Android Development Beginner should know — Part 1 Android Dev


    12 Practices every Android Development Beginner should know — Part 1

    Posted: 28 Dec 2017 02:33 PM PST

    Simplified Realm usage with Monarchy (based on Android Architecture Components and LiveData)

    Posted: 28 Dec 2017 08:43 AM PST

    What are some must watch talks on Android Development?

    Posted: 28 Dec 2017 09:42 AM PST

    Meaningful Motion: Circular Reveal and Shared Elements

    Posted: 28 Dec 2017 06:19 AM PST

    Do you guys use Constraint Layout?

    Posted: 28 Dec 2017 06:57 AM PST

    I'm fairly new to Android development and I'm wondering is Constraint layout a good base to build apps on?

    submitted by /u/5arg
    [link] [comments]

    How to convert simple OpenCV script into android?

    Posted: 28 Dec 2017 03:21 PM PST

    Hi guys, I'm needing some help. I was trying to bring a simple tutorial I found on OpenCV that's working into Android. Basically it takes a pic and finds the rectangles. I wanted to try to do a paper scanner basically.

    After making it work I'd like to advance it and make it a bit more complex, make the user capable of adapting the box around the paper per example. But right now I just wanted something that would run the script (wrote in python) on photos from the camera or gallery.

    How complex should this be? Is there any tutorial that could give the basics and that I could work with to try to make this?

    I know a bit of ReactJS,Python,Java but nothing too deep.

    Thanks a ton!

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

    TIL - Kotlin "map" or "forEach" seems more expensive than a simple for loop.

    Posted: 27 Dec 2017 09:37 PM PST

    I wrote some simple code:

    val t = arrayOf(1,2,3,4,5,6,7,8,9,10) for (a in t) { println("q") } t.map { println("p") } 

    Should do roughly the same.

    Here's the code decompiled into Java:

     Integer[] t = new Integer[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int i; for(int var6 = 0; var6 < t.length; ++var6) { i = t[var6]; String var7 = "q"; System.out.println(var7); } Object[] $receiver$iv = (Object[])t; Object[] $receiver$iv$iv = $receiver$iv; Collection destination$iv$iv = (Collection)(new ArrayList($receiver$iv.length)); int j; for(j = 0; j < $receiver$iv$iv.length; ++j) { Object item$iv$iv = $receiver$iv$iv[j]; int it = ((Number)item$iv$iv).intValue(); String var11 = "p"; System.out.println(var11); Unit var16 = Unit.INSTANCE; destination$iv$iv.add(var16); } 

    The for loop doesn't call any functions, but the map code does (actually, map calls two functions and an allocation - why doesn't kotlin optimize destination$iv$iv, considering that it sees that it's never used) cost a function call.

    What about where you use forEach (so no receiver) and use it?

    val t = arrayOf(1,2,3,4,5,6,7,8,9,10) for (a in t) { println(a.toString()) } t.forEach { println(it.toString()) } 

    This turns out to be:

    int var4; for(var4 = 0; var4 < t.length; ++var4) { int a = t[var4]; String var5 = String.valueOf(a); System.out.println(var5); } Object[] $receiver$iv = (Object[])t; for(var4 = 0; var4 < $receiver$iv.length; ++var4) { Object element$iv = $receiver$iv[var4]; int it = ((Number)element$iv).intValue(); String var7 = String.valueOf(it); System.out.println(var7); } 

    Again, the simple loop costs one function call (actually two, if you count Println) and the forEach costs two (or three if you count Println).

    I UNDERSTAND ABOUT PREMATURE OPTIMIZATION ETC.

    But I always heard that one of the big advantages of functional style programing is speed (the compiler can optimize it for multicore, etc). But from the decompiled code it seems that "map" should come out slower.

    Am I missing something here?

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

    A look back at the most read Google Play posts on Medium in 2017

    Posted: 28 Dec 2017 10:15 AM PST

    api token strategy

    Posted: 28 Dec 2017 06:09 AM PST

    Hi all. I'm writing an app which talks to my api backend. The backend also has a portal where users can sign in with a username/password. I want the users to sign in also on the android app, so that the app can make authenticated requests to the server.

    What is the best practice for making authenticated api calls, do I save the username/password on the device and send it on every api request?

    Do I generate a token based on the username/password which I then save on the device and use that on every request?

    How about the token expiration, basically I want the user to only sign in once, unless they uninstall the app, so do I make it a non expiring token? I'm thinking a refresh token & token might be too much. I'm planing to use https for the backend and maybe ssl pinning for the app, so I'm not that worried about someone stealing the token.

    How do you do it?

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

    RecyclerView Pro Tips — Part 2

    Posted: 27 Dec 2017 11:33 PM PST

    Just after someone to point me in the right direction

    Posted: 28 Dec 2017 04:02 AM PST

    Hello everyone, I'm sorry if this is in the wrong subreddit, I'm not sure where to aim the question.

    I have a problem I want to solve, and the audience is going to be 2 people so it's not worth learning a massive new skillset so I want to achieve it in the quickest possible way.

    I have a spreadsheet of 1,000 films that I have on hard drives etc. On the spreadsheet, I have columns to say what genre the film is, whether it's part of a series (and the number in the series it is), and whether or not I have seen it. In the spreadsheet, there are some options (to allow me to exclude or include certain genres) and a Random button, which returns a random film I haven't seen that match the tickbox criterias. If the film it picks is part of a series, it instead returns the earliest film in the series that I haven't seen. All this is written in VBA which I'm ok at writing. I manually put a Y in the Seen column as and when, and manually add new entries if I get new films.

    This all works well, no problems with that.

    However, when me and my partner are in a film mood, we don't particularly want to turn on the laptop, wait for it to boot, open excel and run the macro. Takes a bit too long. So I need something I can run from our phones.

    I hoped saving the macro enabled spreadsheet in Google Drive would work, but Google Drive strips out macros.

    So, then I thought up the idea of building an app that replicates the functionality of the spreadsheet.

    I've never built an app at all, the only language I'm familiar with is VBA. It only needs to be for Android and installed on our two phones. I'm not even sure an app is the best solution for what I want but I'm out of ideas.

    Can someone help point me in the right direction?

    Thanks in advance.

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

    Android Debugging with Visual Studio Code

    Posted: 27 Dec 2017 04:49 PM PST

    Best resource to learn WifiP2pmanager and NSD?

    Posted: 27 Dec 2017 06:13 PM PST

    Is it just me or are these topics quite hard?I am making an app that is based solely on these and some file handling.I know java socket programming but I want to be using wifidirect for my app and everything feels so new.Anyone experienced this?What resources you used for learning these?Help appreciated.

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

    I need a Markov chain generator to replace the one in my app Predictoe

    Posted: 27 Dec 2017 11:18 PM PST

    I followed the advice from /r/androiddev and added my source code to GitHub. I need to see what kind of help I can receive to improve the Markov system found in MainActivity. It currently adds suffix words (in the next position) to a list value of the key word. It instantiates a Vector, which I've heard is deprecated. Right now, I can only add suffix words one or two positions ahead of the key word. This is a major problem, because the output is much easier to generate with longer phrases in the list of choices.

    Then, I simply return the suffix words for the most recent word to make a list of choices for the user. If I wanted to use higher order Markov chains, there must be some change to tipFinder in order to select not only the final word, but the final 2 or 3 words to get the list of suffix words. This would cause the output to make more sense by giving more logical choices to the user for the next word.

    I couldn't add the methods to a new class as this sub suggested because of my app structure. I would need to do a lot of reorganizing and I'm not excellent at that task yet.

    Open Source Android Project for Predictoe on GitHub - new link -- MainActivity.java

    Predictoe: The Novel Writer on Google Play

    EDIT: I think I can use the system in place (tipFinder, addWords, and generateInk) with some modifications in order to achieve what I want. For example, instead of finding just one word in generateInk, I could generate phrases of different lengths and populate the list of choices with those. In addition, I could implement the "_start" keys generated in addWords by modifying them to add the first word of each new sentence to the values. Then, I could follow a punctuation mark with a more logical choice instead of generating 15 random words (current). I wanted to add this edit for anyone looking at my code. By posting the source code, I got a pretty good look at the structure of my project.

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

    Correct way to implement a long view with lists and other views on it (like YouTube's page under video)?

    Posted: 27 Dec 2017 10:09 PM PST

    If you open Android's YouTube app and click a video on a phone, there is a small video window on the top, and there is a long page on the bottom, in which there are different sorts of UI elements like channel name, subscribe button, advertisement, Up next list, Comment list.

    In theory, I think I could make the bottom part using a single RecyclerView, and returning different item UI for such things. But it will make the implementation very complicated.

    I tried put a RecyclerView and other things inside a NestedScrollView. It looked and worked as I wanted... except for one thing: The scroll of the RecyclerView was slow and short.

    I have searched StackOverflow and found two solutions but none of them looked very desirable. The first was "isNestedScrollingEnabled:false". It was quick and easy, but according to comments, it disables recycling of items, which may defeats the benefits of RecyclerViews. The second was handling the RecyclerView's scrolling on my own using its "smoothScrollToPosition()" or other methods. This seems to be a lot of work for a basic thing like scrolling.

    Is the latter one the best way? How did Google's YouTube app solve this problem? Or did I use RecyclerView improperly inside a NestedScrollView, and there is a better way to achieve it?

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

    Making an App for Sending SMS Messages in Android studio : Please vote guys.

    Posted: 28 Dec 2017 01:06 AM PST

    No comments:

    Post a Comment

    Fashion

    Beauty

    Travel