• Breaking News

    Monday, April 20, 2020

    Android Dev - Weekly "who's hiring" thread!

    Android Dev - Weekly "who's hiring" thread!


    Weekly "who's hiring" thread!

    Posted: 20 Apr 2020 05:44 AM PDT

    Looking for Android developers? Heard about a cool job posting? Let people know!

    Here is a suggested posting template:

    Company: <Best Company Ever>
    Job: [<Title>](https://example.com/job)
    Location: <City, State, Country>
    Allows remote: <Yes/No>
    Visa: <Yes/No>

    Feel free to include any other information about the job.

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

    Weekly Questions Thread - April 20, 2020

    Posted: 20 Apr 2020 03:56 AM PDT

    This thread is for simple questions that don't warrant their own thread (although we suggest checking the sidebar, the wiki, our Discord, 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 this week's thread? Click this link!

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

    It's just a makeup kit. Had to learn and use flutter for company project (from Dec 2018). This is what I feel now.

    Posted: 19 Apr 2020 09:29 PM PDT

    Why does Android Room lack flexibility?

    Posted: 20 Apr 2020 06:41 AM PDT

    I'm currently in the process of refactoring my application in order to make data access more flexible. This is however nearly impossible with Android Room without having to write boilerplate code.

    Consider the following situation:

    The user can see a list of people. Sometimes they want to see only user older than 20 years old, ordered by name ascending. Other people want to see every user order by age descending BUT with additional data such as which pets they have.

    Writing a single function that can handle the relation, ordering, filtering and so forth is possible with something like Entity Framework in C#. You build a query with C#, send it to EF and it'll convert the code to a SQL query. Even Kotlin can do filtering and ordering with models!

    Since Android Room requires queries to be compiled at compile-time, this eliminates flexibility. Yeah yeah I get it, runtime safe queries bla bla.


    What solutions are available?

    • Use ORDER BY CASE WHEN :someVariable = SomeValue in the @Query. Yeah this works but creates a huge query and still doesn't allow flexibility

    • Write raw queries. No, I'd rather be sure my queries work while programming. Also, what's the purpose of an ORM when you're required to write raw queries?

    • Use Views. Again, this doesn't solve the flexibility issue. It only makes it easy for you to write boilerplate code. You will still end up with 10 different functions like getUsers(sortOrder: Int, ascend: Boolean, limit: Int = 10), getUserWithPets() etc.


    Is downgrading Room to Realm the only option here? At least Realm allows writing dynamic queries like

    val result = realm.where(User.class) if (shouldLimit) { result.limit(limit) }


    Apparently a query builder does exist for Room, except it's third party. I'll give it a try

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

    What is something you wish you knew when you started monetizing your app(s)?

    Posted: 19 Apr 2020 04:13 PM PDT

    I'll be publishing my first app soon and I am still thinking about if I should monetize it.

    I am not expecting many downloads so I am aware I am not making much money with it if I decide to monetize it, but I'd like to know from your experience, fellow developers, what have you learned with your apps regarding monetization?

    I've been doing a little research on my own and found about Admob and Mopub, but I am still not sure which one would be better to use while getting started.

    Also I've seen many people suggest using IAP instead because ad revenue tends to be much lower.

    Would really appreciate your opinion/advise on this :)

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

    UI preferences: side vs bottom navigation drawer

    Posted: 20 Apr 2020 07:37 AM PDT

    What do you and your users find more handy and easier to use between a side navigation drawer like in almost all Google apps (Keep, Mail, Calendar etc) versus a bottom navigation sheet like in Google Tasks?

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

    Android Subscriptions / "Pending payment" ..

    Posted: 20 Apr 2020 07:00 AM PDT

    Hi everyone.

    Few time ago, I'm launched my first app, which I developing all last year fulltime. For VIP features, I use Android-subscriptions.

    Most popular term: 1 year, trial: 2 week, grace: 1 month(changed to 1 week).

    I have ~250 active subscriptions. But now, when the trial period is over ... Not a single subscription has been paid.

    Example of subscription:

    https://snipboard.io/Nw60Hm.jpg

    (trial period is finished on April 12th), but now 20 and "pending payment"... And all subscription the same..

    I thought maybe problem with cash-payments in this country, but I have subscriptions from 10+ countries... And everywhere status "pending payment".

    I can understand a lot, but I do not believe that the conversion from trial to paid subscriptions is less than 1% :)

    - I wrote 3 time to Google Dev Support, but didn't recieve any answer that would say what is happening.

    - I checked "acknowledge" status of subscription, everywhere is 1. And forcibly set 1 to everyone from the server.

    - I updated payment technology (from aidl to billingclient:billing:2.0.3) and added 3day trial + 7w grace for test GEO's.

    So I did everything, but have not any result..

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

    Looking for Beta Testers, is someone interested?

    Posted: 20 Apr 2020 06:02 AM PDT

    I recently changed a lot in my app and because the approval takes days, I don't want to publish a new release without having it tested by multiple users. Is someone interested in it? I imagine I could also test others, so it like an exchange via apks. Please contact me via levion.software@gmail.com if you're interested 🤙

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

    Want to connect Database to an App!

    Posted: 20 Apr 2020 05:16 AM PDT

    Hello I want to create an App that's connected to a Database. But I cant find anything on Youtube or trough Google searches that helps me ! Has anyone some advice were I can find good resources to tackle that task ?

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

    20 Android Studio Shortcuts To Accelerate Your Workflow

    Posted: 20 Apr 2020 04:56 AM PDT

    Room advice: String or Char array?

    Posted: 20 Apr 2020 03:27 AM PDT

    I've never used SQLite before, only MySQL/Maria & Postgres. I'm trying to make a table with a two-letter country code in one column:

    data class Foo( @PrimaryKey(autoGenerate = true) val id: Long = 0L, val countryCode: String?, val somethingElse: Int? ) 

    I should be using CharArray(2), like I would for a normal DB, right? That won't compile, unfortunately ("Expecting comma or ')'"). What's wrong with CharArray here, and how do I declare it in this example?

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

    Designing a webapp for an Android developer

    Posted: 19 Apr 2020 11:27 PM PDT

    Last time I wrote a public-facing web front end was 10 years ago. At that time I used jQuery and the bootstrap CSS framework.

    I know it's a total different world right now. And I'd like to know what's the state of the art as of today.

    I got used and now love the ConstraintLayout's way of building my UI. I'm scared to go back to editing CSS file and googling my way to know how to vertically center a div, like I used to do 10 years ago. Also, now everything has to be mobile-ready as well which wasn't the case back then.

    As an Android dev, what's your way of designing beautiful web front ends?

    Thanks for your help, I can't be the only one in that situation :)

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

    What is the best Linux distro for Android Studio?

    Posted: 20 Apr 2020 01:17 AM PDT

    On the official site it says " GNOME or KDE desktop. Tested on gLinux based on Debian."
    Can you guys tell me the best Linux distro for this?

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

    Fast computing on Android..

    Posted: 19 Apr 2020 03:16 PM PDT

    Hello Guys!

    I am learning software development on my own for about almost 2 years now. Recently I got into Android, making apps for glitch effects. Datamoshing was pretty easy, but now I am moving to pixel sorting.

    Now the app works perfectly but it is sooo slow. I have red, that you can use the GPU or parallel computing to make the process faster.

    I have found Renderscript, Opengl ES for that porpuse, but they works on each pixel at a time.

    Please give me a hint, how do I start implementing something like that.

    The pseudo code i want to achive:

    • get an image as input (okay, thats basic) -for every row of that image sort the pixels on some criteria (brightness, rgb values etc...)

    Thank you! Cheers!

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

    TextInputLayout change boxStrokeColor programatically

    Posted: 19 Apr 2020 10:37 PM PDT

    TextInputLayout change boxStrokeColor programatically

    Hey everyone.

    I made a custom view which consists of two TextInputLayout

    https://preview.redd.it/913hulejswt41.png?width=484&format=png&auto=webp&s=63d3b25b238bbf2232934bac270a3db8e04b746a

    I set the underline color to blue through xml applying a selector to the boxStrokeColor of both ViewGroups. Both of them should change to red at some point, but when I change the same property programatically, only the one that is focused changes color.

    https://preview.redd.it/97ezs6zctwt41.png?width=739&format=png&auto=webp&s=8b22878d01c62f3ad698438a6a2ac5ff9b5f3053

    The selectors for blue and red have the same states. This seems to be the behavior Google has added to these components. Any ideas how to set the underline color programatically?

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

    Where are some good tutorials to learn ARCore?

    Posted: 19 Apr 2020 06:23 PM PDT

    I'm trying to learn how to implement AR into my apps, but can't find any good tutorials. Does anyone have some good recommendations? Thanks

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

    Publishing apps without uploading to playstore

    Posted: 19 Apr 2020 07:44 PM PDT

    Hi guys, anyone knows how to make an app available via a download link or a downloadable file that does not reside on the playstore? I heard that somehow I can create an APK from my app but is that the best way to go about doing this? The people who need to download this app requested for this app to not be on the playstore cause its an app with kinda sensitive information. Thanks in advanced!

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

    Any way I can open MDB files in Android?

    Posted: 19 Apr 2020 05:37 PM PDT

    People are saying that they convert it to sqlite, but I can't find any libraries for doing that. If anyone knows where to start on this id really appreciate any help. I've searched thoroughly and I can't seem to find something resembling what I'm looking for.

    I'm trying to basically be able to read and write to MDB and .accdb files

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

    Bluetooth Scan in App not working

    Posted: 19 Apr 2020 03:29 PM PDT

    Hi,

    With the below code im trying to scan and connect to bluetooth devices in range of the device running the app. The problem is that the receiver object doesnt catch any devices.

    What could be the problem?

    package com.example.ble import android.app.Activity import android.bluetooth.BluetoothAdapter import android.bluetooth.BluetoothDevice import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import android.content.IntentFilter import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.util.Log import android.widget.AdapterView import android.widget.ArrayAdapter import kotlinx.android.synthetic.main.activity_main.* import org.jetbrains.anko.toast class MainActivity : AppCompatActivity() { private var defaultAdapter: BluetoothAdapter? = null lateinit var pairedDevices: Set<BluetoothDevice> val REQUEST_ENABLE_BLUETOOTH = 1 companion object { const val EXTRA_ADDRESS: String = "Device_address" } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) defaultAdapter = BluetoothAdapter.getDefaultAdapter() if (defaultAdapter == null) { toast("Dieses Gerät verfügt über keine Bluetooth Adapter. Sie können diese App nicht benutzen") return } if (!defaultAdapter!!.isEnabled) { val enableBluetoothIntent = Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE) startActivityForResult(enableBluetoothIntent, REQUEST_ENABLE_BLUETOOTH) } searchButton.setOnClickListener { startDiscovery() } val filter = IntentFilter(BluetoothDevice.ACTION_FOUND) Log.i("receiver", "registering receiver") registerReceiver(receiver, filter) } private val receiver = object : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { toast("maybe i find new device who know") when (intent.action) { BluetoothDevice.ACTION_FOUND -> { // Discovery has found a device. Get the BluetoothDevice // object and its info from the Intent. val device: BluetoothDevice? = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE) val deviceName = device?.name val deviceHardwareAddress = device?.address // MAC address Log.i("BLUETOOTH DEVICE", "NEW DEVICE CAUGHT $deviceName") toast("device $deviceName was found") } BluetoothAdapter.ACTION_DISCOVERY_FINISHED -> { context.unregisterReceiver(this) } } } } private fun startDiscovery() { if (defaultAdapter!!.isDiscovering) { toast("scan already in progress") } else { toast("starting discovery") defaultAdapter!!.startDiscovery(); } } private fun pairedDeviceList() { pairedDevices = defaultAdapter!!.bondedDevices val list: ArrayList<BluetoothDevice> = ArrayList() if (!pairedDevices.isEmpty()) { for (device: BluetoothDevice in pairedDevices) { list.add(device) Log.i("device", "" + device) } } else { toast("keine verbundene Geräte gefunden.") } val adapter = ArrayAdapter(this, android.R.layout.simple_list_item_1, list) select_device_list.adapter = adapter select_device_list.onItemClickListener = AdapterView.OnItemClickListener { _, _, position, l -> val device: BluetoothDevice = list[position] val address: String = device.address val intent = Intent(this, ControlActivity::class.java) intent.putExtra(EXTRA_ADDRESS, address) startActivity(intent) } } override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) if (requestCode == REQUEST_ENABLE_BLUETOOTH) { if (resultCode == Activity.RESULT_OK) { if (defaultAdapter!!.isEnabled) { toast("Bluetooth wurde angemacht") } else { toast("Bluetooth wurde deaktiviert") } } else if (resultCode == Activity.RESULT_CANCELED) { toast("Bluetooth kann von System aus nicht aktiviert werden") } } } } 
    submitted by /u/vintuitive1
    [link] [comments]

    ViewPager - TabLayout with LiveData

    Posted: 19 Apr 2020 03:25 PM PDT

    I have a list of products in a recycler view. once an item is pressed it will take u to the second activity to show more info related to that product. I'm trying to implement viewPager. was following a tutorial from CodingWithMitch but in his example, he has random data and could easily fetch them.

    ArrayList<Fragment> fragments = new ArrayList<>();

    Hat[] hats = Hats.getHats();

    for(Hat hat: hats){

    ViewPagerItemFragment fragment = ViewPagerItemFragment.getInstance(hat);

    fragments.add(fragment);

    }

    MyPagerAdapter pagerAdapter = new MyPagerAdapter(getSupportFragmentManager(), fragments);

    mMyViewPager.setAdapter(pagerAdapter);

    mTabLayout.setupWithViewPager(mMyViewPager, true);

    Unfortunately, for me, the data r fetched from Livedata object. How do I loop or iterate over the livedata to extract all the products object so I can set the fragments!

    also, this shows the whole product. but how to show the pressed item first. the one that the user clicked. and then the user will be able to swap left and right browsing the whole list!?

    I tried something like this but it doesn't work. shows a blank screen. when i debug the fragment array size is 0

    ArrayList<Fragment> fragments = new ArrayList<>();
    final MarketViewModel marketViewModel = new ViewModelProvider(this).get(MarketViewModel.class);
    marketViewModel.getProductInfo("parentID");
    marketViewModel.getProductInfo("parentID").observe(this, products -> {
    for (int i = 0; i < products.size(); i++) {
    Product product = products.get(i);
    ProductInfoFragment fragment = ProductInfoFragment.getInstance(product);
    fragments.add(fragment);
    }
    });
    ProductPagerAdapter adapter = new ProductPagerAdapter(getSupportFragmentManager(), 0, fragments);
    viewPager.setAdapter(adapter);
    tabLayout.setupWithViewPager(viewPager, true);

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

    No comments:

    Post a Comment