Questions Thread - June 04, 2016

Questions Thread - June 04, 2016


Questions Thread - June 04, 2016

Posted: 04 Jun 2016 05:06 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!

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

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

[Meta] How about a weekly thread where we all share our apps and give each other feedback?

Posted: 04 Jun 2016 12:39 AM PDT

*Can the mods comment on this?

/u/rkcr, /u/pandanomic

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

Vector Graphics: Poll

Posted: 04 Jun 2016 12:26 PM PDT

Do you use vector graphics in your android apps?

Why/why not, what vector programs do you use to create your graphics? (Inkscape, etc.)

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

Android Tutorials Hub | Android Application Development Tutorials

Posted: 04 Jun 2016 07:45 AM PDT

Bring up menu by sliding finger from edge of screen

Posted: 04 Jun 2016 03:38 PM PDT

Hi,

I want to implement a feature that brings up a side menu when a user slides his/her finger from the edge of the screen towards the center. Additionally, the item selected is the item that the user's finger was on when their finger is released I am relatively new to android development, so I'm not too familiar with what libraries are out there. If anyone has any advice and can point me in the right direction, I would greatly appreciate it.

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

We should all compile a list of situations where Instant Run fails and then file a bug

Posted: 04 Jun 2016 10:18 PM PDT

For eg:

I'm using the canvas/bitmap API and the following simple code is causing problems:

 canvas.drawText("Text", x, y, paint); 

You run it the first time, it works fine. Then 'instant run' it the second time and your canvas actually draws two bitmaps because for some reason Instant Run doesn't refresh the heap(?) or something.

I keep finding tons of these little annoyances. Maybe we should compile a list or something, with steps for the android studio team to recreate the bugs and fix them.

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

Devs, why do you use Dropbox instead of Google Drive to sync app files?

Posted: 04 Jun 2016 10:31 AM PDT

I'm not a developer. But I noticed that most Android apps that offer some form of external cloud syncing, generally use Dropbox instead of G Drive. Why is that? Why not Drive, or the option to choose between DB and GD?

edit: just to clarify, I'm talking about apps. Why do many syncing apps store data in drop box instead of drive?

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

How can I find out which libraries have the most methods?

Posted: 04 Jun 2016 08:31 AM PDT

I have 30+ dependencies and 60k methods (by that method count plugin thingy). I don't want to get any closer.

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

Utterly confused about testing with MVP

Posted: 04 Jun 2016 03:39 AM PDT

I have started to write unit tests for my production app. To start with the easiest I thought of writing tests for deeplinks. To start with I moved around the code from Activity and added it to a new class DeeplinkRouter.

Context is passed in the constructor. It has a method route(Uri uri) which returns Intent. Deeplink routing activity calls this intent.

I started writing tests for DeeplinkRouter using JUnit and Mockit. I had to mock Context and Uri. The returned Intent is always null. I learned it hard way that Intent should also be mocked but then what should I even test? I moved these tests to AndroidTest and used AndroidJUnit to run the tests with. It worked.

This doesn't feel right. There's something missing. If I were to write DeeplinkRouter, how would I go about it? I thought of something like this.

public class DeeplinkRouter { private Class<?> clazz; private String action; } 

I got stuck again. What do I do about Bundle? I can add Map<String, Object> but copying the items to Bundle and what about Parcelable? There are so many questions that I am surrounded with.

In my Activity, I have static methods which return Bundle when passed the parameters it requires. So I usually use that.

Now, the question arises about deeplink. We use deeplinks which generally have parameters with them. eg. search query, title, etc. Whose responsibility is it to parse the Uri parameters? Should my DeeplinkRouter parse these parameters and generate Bundle or should it just parse the uri host and re-route and let activities parse uri?

Currently, my presenters are not also testable because I get the bundle via static method and call view.navigateToProfile(extras).

Apart from this my presenter use Bundle in attachView(Bundle extras) so that it can process the input parameters. How to go around this?

What are the best practices around this? How do you manage navigation in your app?

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

[Newbie question]Imported Sample projects are full of errors.

Posted: 04 Jun 2016 12:06 PM PDT

Hello guys, new to this subreddit but i just couldn't find anything and i didn't want to post this on stackoverflow.

So, i downloaded a sample project from the dev site (This for example) and when i import using "Import project" from the main startup window, i get lots of errors caused by unknown imports. Like: import android.support.v4.app.Fragment; which is not recognized. I was thinking it's somekind of SDK or API configuration error ( I only have the 6.0 5.0 and 4.2 downloaded) but i just don't know how to properly get those sample projects to run.

Care to help a beginner? Cheers!

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

Advanced Espresso at #io16 - Square Island

Posted: 03 Jun 2016 11:45 PM PDT

I really, really wish there was a way to respond to crash / ANR reports.

Posted: 04 Jun 2016 09:20 AM PDT

I'd love to be able to send a reply to those users that have experienced crashes, for example to ask for more information, or to inform them a patch has been released that fixes the issues.

A similar technology already exists with reviews, and it's extremely beneficial to both devs and customers.

At least, it's impossible as far as I can tell. I'd love to be proven wrong though?

Jake

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

Dynamically creating Preference Screens on Android

Posted: 04 Jun 2016 02:55 AM PDT

Drawer Behavior for CoordinatorLayout

Posted: 03 Jun 2016 11:12 PM PDT

Keep Your Droid Clean

Posted: 04 Jun 2016 02:20 AM PDT

Thanks for reading my news about Questions Thread - June 04, 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.