• Breaking News

    Monday, March 7, 2022

    Android Dev - Weekly Who's Hiring Thread - March 07, 2022

    Android Dev - Weekly Who's Hiring Thread - March 07, 2022


    Weekly Who's Hiring Thread - March 07, 2022

    Posted: 07 Mar 2022 06:00 AM PST

    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]

    Jetpack Compose Tutorials i have been working on over a year with subjects Widgets, Layout, SubcomposeLayout, custom Layouts, State, Recomposition, LaunchedEffect, side-effects, Gesture, Navigation, Canvas, and UIs like Whatsapp and more https://github.com/SmartToolFactory/Jetpack-Compose-Tutorials

    Posted: 06 Mar 2022 11:48 PM PST

    Are there functionalities in Android which are easier to implement than in iOS?

    Posted: 07 Mar 2022 07:52 AM PST

    Some functionalities seems easier to implement in iOS than Android for e.g. In iOS maintaining the backstack for each bottom menu seems implemented by default. But in Android, we have to write lot of workaround code for it. So I would like to know the vice versa

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

    Display a line chart using MPAndroidChart

    Posted: 07 Mar 2022 03:14 PM PST

    Hello, I have the following json response back from a GET request:

    https://gist.github.com/sabiou/8dab51709b59560c0c100c9e024a967b

    I want to create a simple line chart using the MPAndroidChart library with the following values:

    - annee for x axis

    - valeur for y axis

    Any idea on how I can achieve this ?

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

    Pushing updates to an Unpublished app

    Posted: 07 Mar 2022 04:21 AM PST

    I'm wondering if anyone has experience with updating an unpublished app regularly. We're on the market for more than 10 years now and we have a Free and a PRO version of our app. We've decided to do it this way, since we couldn't have IAP's in app in our country when the Google Play store was launched. Therefore we needed to launch two separate versions of our app. This is kind of inconvenient for users.

    Now we want to just offer an IAP in our Free version to remove ads and get the additional features. The problem is that we still have around 100k users on the PRO version. We don't want to abandon those users and still want to provide updates to them. Does anyone have experience with unpublishing an app and then publishing updates regularly to this specific app? Will the paying users still be able to find the PRO version on the Google Play store if we unpublish it?

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

    Main thread priority equals background thread priority

    Posted: 07 Mar 2022 02:11 PM PST

    We track Thread priority for main threads (nice value. Not JVM thread priority). In 90% of cases, the correct value is set. That is -10. But For 6% of users, it's setting a nice value of 0. background thread priority is also similar. This value is zero across os version and device manufacturer. Can we explicitly set this to -10 by calling Process.setThreadPriority()? Will this have any negative effects?

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

    Sending View Model Events to the UI (is this how people are handling Navigation and Snackbars now?)

    Posted: 07 Mar 2022 03:38 AM PST

    Wear OS Complication weirdness

    Posted: 07 Mar 2022 12:20 PM PST

    I'm seeing something strange in regard to consuming complications, and wondering if there's something I'm missing in all this.

    My watchface was coded so that the complication was set to accept the SHORT_TEXT type, because I wanted to use it to display the step count on my Fossil Gen 5.

    First weirdness: Just a minor thing, but on the watch, the step count is listed under "Google Fit." On the Android Studio emulator, it's under "General" (I guess because AFAIK you can't install "Fit" on the emulator), but not on the actual watch.

    Here's the biggest issue, or confusion, or weirdness. In the code I modified the acceptable complication input to add three additional types:

    supportedTypes = { ComplicationData.TYPE_SHORT_TEXT,
    ComplicationData.TYPE_ICON,
    ComplicationData.TYPE_RANGED_VALUE,
    ComplicationData.TYPE_SMALL_IMAGE};

    ... and when I did, "Steps" no longer appears as a selectable complication to display on the watch. It only appears if the supportedTypes contains solely SHORT_TEXT.

    Perhaps I've always misunderstood supportedTypes, but this doesn't make sense to me. Can anybody explain this behavior?

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

    Optical color pattern recognizer - Android

    Posted: 07 Mar 2022 11:28 AM PST

    Hello,

    I started learning to program a few months ago, took the CS50 course, watch some youtube courses and know I'm taking a Java course or Coursera. I already developed some simple GUI java applications that interact with databases and excel workbooks, nothing more.

    I found this video interesting, and started thinking how easy would be to develop an android app that could do what that machines does.

    https://www.youtube.com/watch?v=BQO95JR3FJY

    The smartphone camara would be fixed and the background would always be white. The person should place the connector (it will always be in the same positions on the vertical axis, due to the stop), the app should take a picture and the user would define a rectangular area. Some algorithm would get the sequence of colors of that area, that are not white (as the background), and save it as "saved pattern". Then an infinite loop that activate each millisecond, as example, would compare the actual pattern to the "saved pattern".

    Do you think this is possible, and if so, can you suggest some frameworks or some keywords (for me to search and start learning) that could help me on developing this project, I don't have a starting point yet and never developed any java app for android.

    Much appreciated.

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

    MVVM state management using Jetpack Compose

    Posted: 07 Mar 2022 04:24 AM PST

    Got this message after starting an app I hadn't used in a while, how was it made?

    Posted: 07 Mar 2022 01:07 AM PST

    Can anyone with access to a samsung A52s please confirm a bug for me?

    Posted: 07 Mar 2022 03:15 AM PST

    Hi all, an update to my app just went live and i'm seeing an odd behaviour on my Samsung a52s, but not on the Huawei device I also have. I don't have access to any more physical devices to check the issue.

    If you wouldn't mind downloading the app and pressing two buttons simultaneously, i'd really appreciate it, let me know and I'll tell you the specifics over DM.

    Thanks a lot

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

    Please Help cant get Android studio to show my app on the AVD

    Posted: 07 Mar 2022 06:09 AM PST

    Please Help cant get Android studio to show my app on the AVD

    Hey guys may I ask for your help? so I'm new to android studio and Kotlin and I just started learning but for some reason I just couldn't get the app to show on the Pixel 5 AVD any suggestions?? please help I really want to learn how to code Android apps. My device is a Thinkpad T490 Windows 11

    https://preview.redd.it/aqq0uakhyyl81.png?width=1366&format=png&auto=webp&s=2f24f679ab9b82c29dd2aef071f311d9ea5d1186

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

    Using activity instead navigator in composable

    Posted: 06 Mar 2022 08:57 PM PST

    Does it make sense to use activity per screen that hold composable, and navigate between them with intent startActivity, instead of one main activity with all composable screens inside navigator?

    will performance hurt?

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

    Navigation drawer - cannot return home after navigation

    Posted: 07 Mar 2022 05:22 AM PST

    Hi,

    I created a new project with Navigation Drawer Acitvity template. I added a new button to my home fragment, than created a new navigation action to my gallery fragment. Than set up the onclicklistener to navigate:

    Navigation.findNavController(view).navigate(R.id.action_nav_home_to_nav_gallery); 

    After the click of the button I can navigate to my gallery fragment, but when I open the navigation drawer I can navigate everywhere, but home.

    Sample project: https://github.com/totokpatrik/NavigationTest

    any help is appriciated

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

    Triggering LiveData observers

    Posted: 07 Mar 2022 04:27 AM PST

    Hi. During the start of the app, I request for the list of profiles from Room database and observer is set. When I insert a new profile and also set its observer, the observer that is triggered is only from this insertion. To my understanding, LiveData observers will be triggered if there are changes from the database especially if they are on the same table whether insertion or just requesting a list.

    Am I wrong with this? Should I call again the profile list request to trigger its observer and get the updated list?

    Thank you!

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

    Null check operator used on a null value

    Posted: 07 Mar 2022 03:47 AM PST

    class _HomePageState extends State<HomePage> {

    LatLng? _pickUp;

    void getCurrentLocation() async {
    LocationPermission permission = await Geolocator.requestPermission();
    final geoposition = await Geolocator.getCurrentPosition(
    desiredAccuracy: LocationAccuracy.high);
    setState(() {
    _pickUp = LatLng(geoposition.latitude, geoposition.longitude);
    });
    }

    void _onMapCreated(GoogleMapController controller) async {
    setState(() {
    if (_pickUp == null) {
    getCurrentLocation();
    }
    ...
    });

    }

    ...

    GoogleMap(
    ...
    onMapCreated: _onMapCreated,
    initialCameraPosition: CameraPosition(
    target: _pickUp!,
    zoom: 11,
    ),
    ...

    }

    Despite that I have assigned my _pickup in _onMapCreated, the _pickUp! used in target results in the title error, may i know whats the reason for this?

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

    Best way to a/b two different views in xml?

    Posted: 06 Mar 2022 11:11 PM PST

    I'm using an imageview in xml right now. I've created a new custom Imageview class. I want to use this new class conditionally in XML, so control group is old view and test group is new view. What's the best way to accomplish this? Would a view stub work?

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

    please i need help

    Posted: 07 Mar 2022 09:46 AM PST

    my mi 9t go into fastboot automatically i cant get around it

    it start when i gave naptime battery saver app permission to disable google services when screen is off then the phone restarted into fastboot

    THINGS I HAVE TRIED:

    1- using twrp i wiped cache, system, and data and flashed stock rom miui 12.0.8.0 (i had miui 12.0.9.0 before) after that instead of booting into fast boot it boot into twrp

    submitted by /u/Level-Ad2247
    [link] [comments]

    Where (app or backend) the data to be shown to the user should be formatted in terms of performance?

    Posted: 07 Mar 2022 01:22 AM PST

    For e.g. we maybe required to show the field representing amount whose value is 1000 as ₹ 1000.00, date stored in database as 2022-03-07 10:00:00 need to display to user as 7 Mar 2022 10:00 AM etc. So whether we should write the code for the formatting/conversion in the app or the backend with response also containing the display value? My doubt is if more code in backend will take more time to fetch data from backend. If more code in app make it slower (on low end devices)

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

    Please help me to optimize code in C++.

    Posted: 07 Mar 2022 12:34 AM PST

    Now question is when I using large capacity usb flash disk ota(16G,100,000 files) it will reboot.

    I check source code finding the reason it was Check function, so I add some code below.Now the flash disk don't reboot .

    but how can I opimize code to kill thread and fix large more disk (ex.256G flash disk)?

    My os is Android automotive10,ram and rom is 4+32G, cpu is mx8q

    the diff file is

    diff --git a/system/vold/fs/Vfat.cpp b/system/vold/fs/Vfat.cpp

    old mode 100644

    new mode 100755

    index 4f1e982eb3..d2bac6fc7b

    --- a/system/vold/fs/Vfat.cpp

    +++ b/system/vold/fs/Vfat.cpp

    @@ -41,7 +41,30 @@

    #include "Utils.h"

    #include "Vfat.h"

    #include "VoldUtil.h"

    -

    +#include "../../core/libutils/include/utils/Thread.h" //wp add

    +#include <inttypes.h>

    +#include <pwd.h>

    +#include <sched.h>

    +#include <signal.h>

    +#include <stdbool.h>

    +#include <sys/cdefs.h>

    +#include <sys/epoll.h>

    +#include <sys/eventfd.h>

    +#include <sys/resource.h>

    +#include <sys/socket.h>

    +#include <sys/sysinfo.h>

    +#include <sys/time.h>

    +#include <time.h>

    +#include <unistd.h>

    +#include <cutils/properties.h>

    +#include <cutils/sched\_policy.h>

    +#include <cutils/sockets.h>

    +#include <../../core/lmkd/include/lmkd.h>

    +#include <log/log.h>

    +#include <log/log\_event\_list.h>

    +#include <log/log\_time.h>

    +#include <../../core/lmkd/libpsi/include/psi/psi.h>

    +#include <system/thread\_defs.h>

    using android::base::StringPrintf;

    namespace android {

    @@ -55,10 +78,32 @@ bool IsSupported() {

    return access(kMkfsPath, X_OK) == 0 && access(kFsckPath, X_OK) == 0 &&

    IsFilesystemSupported("vfat");

    }

    +//wp add

    +class CheckThread:public Thread {

    +public:

    + CheckThread(std::vector<std::string> cmd, int fd):

    + mCmd(cmd),mFd(fd) {

    + }

    + virtual ~CheckThread() {

    + }

    +

    + virtual bool threadLoop() {

    + //int rc = ForkExecvp(mCmd, sFsckUntrustedContext);//fork进程,check卡等待结果

    + int rc = ForkExecvp(mCmd, nullptr, sFsckUntrustedContext);

    + write(mFd, &rc, sizeof(int));//把结果写入管道

    + LOG(WARNING) << "xwg:rc = " << rc;

    + return false;//返回false,不循环了

    + }

    +

    +private:

    + std::vector<std::string> mCmd;

    + int mFd;

    +}; //wp end

    +

    status_t Check(const std::string& source) {

    int pass = 1;

    - int rc = 0;

    + int rc = 3;

    do {

    std::vector<std::string> cmd;

    cmd.push_back(kFsckPath);

    @@ -66,9 +111,41 @@ status_t Check(const std::string& source) {

    cmd.push_back("-f");

    cmd.push_back("-y");

    cmd.push_back(source);

    -

    + //wp add

    + int pipefd[2];

    + if (pipe(pipefd) < 0) { //管道

    + LOG(INFO) << "xwg 0303 pipe failed";

    + return -1;

    + }

    + CheckThread* thread = new CheckThread(cmd, pipefd[1]);

    + thread->run("");//开启线程,执行fork进程,等待结果,同时把管道一端给它

    + int mEpollFd = epoll_create(2);

    + struct epoll_event eventItem;

    + memset(& eventItem, 0, sizeof(epoll_event));

    + // zero out unused members of data field union

    + eventItem.events = EPOLLIN;

    + eventItem.data.fd = pipefd[0];

    + epoll_ctl(mEpollFd, EPOLL_CTL_ADD, pipefd[0], & eventItem);

    + struct epoll_event eventItems[2];

    + int eventCount = epoll_wait(mEpollFd, eventItems, 2, 10000);//使用epoll机制,设置timeout为5min

    + LOG(WARNING) << "xwg:eventConut = "<<eventCount;

    + for (int i = 0; i < eventCount; i++) {

    + LOG(WARNING) << "xwg:int i = "<<i;

    + int fd = eventItems[i].data.fd;//有管道数据,说明check好了,返回结果就在管道中

    + LOG(WARNING) << "xwg:fd = "<<fd;

    + uint32_t epollEvents = eventItems[i].events;

    + if (fd == pipefd[0]) {

    + if (epollEvents & EPOLLIN) {

    + read(fd, &rc, sizeof(int));

    + }

    + }

    + }//end for,直接timeout了,说明10秒还没有check完

    + close(mEpollFd);

    + close(pipefd[0]);//关闭fd

    + close(pipefd[1]);

    + //wp end

    // Fat devices are currently always untrusted

    - rc = ForkExecvp(cmd, nullptr, sFsckUntrustedContext);

    + rc = 0;

    if (rc < 0) {

    LOG(ERROR) << "Filesystem check failed due to logwrap error";

    @@ -86,6 +163,12 @@ status_t Check(const std::string& source) {

    errno = ENODATA;

    return -1;

    + case 3://3说明check超时了,wp add

    + //SLOGE("xwg 0303 Filesystem check outime");

    + LOG(INFO) << "xwg 0303 Filesystem check outime";

    + errno = ENODATA;

    + return -1;

    +

    case 4:

    if (pass++ <= 3) {

    LOG(WARNING) << "Filesystem modified - rechecking (pass " << pass << ")";

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

    Hi,I am getting back into flutter after 2 years and as i was going through my old apps , i noticed a lot of things have changed and all udemy courses are rather old . So i would like to start with basic crud app with simple login( firebase preferably) can anyone suggest me a good tutorial ?

    Posted: 07 Mar 2022 12:06 AM PST

    No comments:

    Post a Comment