• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Reusing part of a layout

Sorry in advance if this is something that has been answer before. I am a C# dev that never deals with UI, trying to learn android for fun and has no idea how to word his question...

I have made a layout I am happy with, like the following;

Code:
 <LinearLayout
        android:layout_column="1"
        android:layout_row="0"
        android:layout_width="300dp"
        android:layout_height="40dp"
        android:layout_marginLeft="40dp"
        android:orientation="horizontal">

            <TextView
                android:text="Run For:"
                android:textSize="30dp"
                android:layout_width="0sp"
                android:layout_height="match_parent"
                android:layout_weight=".5"
                android:textAlignment="center"/>

            <Button
                android:id="@+id/btn_down"
                android:layout_width="0sp"
                android:layout_height="match_parent"
                android:layout_weight=".15"
                android:textAlignment="center"
                android:text="-" />

            <TextView
                android:id="@+id/run_time"
                android:textSize="30dp"
                android:layout_width="0sp"
                android:layout_height="match_parent"
                android:layout_weight=".2"
                android:textAlignment="center"
                android:inputType="number"
                android:text="0" />

            <Button
                android:id="@+id/btn_up"
                android:layout_width="0sp"
                android:layout_height="match_parent"
                android:layout_weight=".15"
                android:textAlignment="center"
                android:text="+" />
    </LinearLayout>

and some handeling code;
Code:
 AppCompatTextView runTime = FindViewById<AppCompatTextView>(Resource.Id.run_time);
            AppCompatButton up = FindViewById<AppCompatButton>(Resource.Id.btn_up);
            AppCompatButton down = FindViewById<AppCompatButton>(Resource.Id.btn_down);

            up.Click += delegate
            {
                Int16 time;

                if(Int16.TryParse(runTime.Text, out time))
                {
                    if (time < 10)
                    {
                        time++;
                        runTime.Text = time.ToString();
                    }
                }
            };

            down.Click += delegate
            {
                Int16 time;

                if (Int16.TryParse(runTime.Text, out time))
                {
                    if (time > 0)
                    {
                        time--;
                        runTime.Text = time.ToString();
                    }
                }
            };

Great, all works.

How do I now repeat that 64 more times? I have a GridLayout already, I just have no idea how to repeat the buttons layout and click events. I guess I could copy and paste it 63 more times, but I feel like that might not be the best way here…

Has anyone got a example or something for me to read about how to do this?
I am writing this in C# but an example in java would be fine.

Thanks

"Set a timer for x minutes" - "go and do it yourself"

IMO we were better off when we used our hands and did actual work. We were certainly stronger for it. Today we're getting quite thin-skinned and puny, and I'm certain that tons of digital, connected 24/7 lifestyle can't be healthy in the long term.

Just from the whole pandemic I've realized from experience just at work that people (our customers) have gotten quite triggered by quite innocous things like telling them the truth about a repair or something. I think people are getting more and more used to being behind a screen or using AI to do most of the tasks (including using robotic lawn mowers!) and it's causing social interaction to break down and people are becoming more and more introverted as a result.

Sd scare

The World Economic Forum is responsible for the rather dystopian future that's supposedly planned for us come 2030. There's even a book written by its founder called "Covid-19: The Great Reset" and the things they want scare the hell out of me.

I'll stop here since any further discussion borders on political discussion which I'm sure the mods don't want any part in here.

On the p.c...

I've looked and do not see a way to delete this. You delete your email searches and old contacts, but not when you are comparing an email. It maybe I'm not finding the right words to describe your issue when googling it.

It's never really bothered me, but it rarely suggests old contacts.

Help Photos app: "No photos"

Issue has happened again, except it doesn't say No Photos this time. In the Photos tab, all I can see where there should be photos is a random date a few weeks back although my most recent photos were taken yesterday. When I hold down on the date it apparently selects 5 photos that are nonetheless invisible in this area (see attached screenshot).

The photos are still in the Library tab, and when I log into Photos on desktop, all photos seem intact in the Cloud (and indeed, on desktop Cloud I can see the 5 photos taken on the aforementioned random date).

It's just the Photos tab in the Photos app that's gone wonky so seems it might be an interface/UI issue. Tried clearing cache and restarting phone. Who can figure out how to get the photos to reappear?

343679d1648744839t-photos-app-no-photos-screenshot_20220331-123015.jpg

This happened again. This time, I noticed when I zoomed in on the Photos tab by swiping, a photo from yesterday appeared, but no other photos from yesterday or the days before. Unlocking a few photos made several non-locked photos appear, but not all. I finally found a (relatively) quick workaround: archive then unarchive all the photos.

Sent this feedback to Google:

No photos were appearing in the Photos tab of the Photos app. They were in the folders and Cloud, just not in that tab in the app. Clearing cache and restarting phone did not help. It seems I could technically select all photos from this month using the check-circle, but the photos still didn't appear. Last time this happened I had to clear app data to resolve it, but I shouldn't have to do this. This time, I discovered a quicker workaround: archiving then unarchiving the photos. But this issue should not be happening to begin with and the fact it has happened multiple times nearly a half year apart is not acceptable. Why hasn't this been fixed yet?

Screenshot_20221021-064300.png

Thunderbird on Android - BirdBox

All - We have launched a mobile version of Thunderbird through our UserLAnd platform named BirdBox! Our app will launch the desktop version of Thunderbird on any of your Android devices so you can have all of the functionality that you are used to. Definitely great on chromebook and tablet. Let us know your thoughts! Thanks and link below:

https://play.google.com/store/apps/details?id=tech.ula.birdbox&hl=en_US&gl=US

Pixelation after stitching

I have disabled hardware encoding and decoding and this seems to have fixed it. Thanks

You are the absolute GOAT (greatest of all time). I searched the whole internet, installed APK`s on my phone (app), contacted SAMSUNG support and even tried to disable hardware encoding and decoding, but didnt restart the app. I almost gave up, my last google search brought me to this page and I just tried it again, it works.

I dont know if you will ever read this, but thank you so much.
Finally i have some clean 360 vids.

Thanks man

Set first day of week to Sunday

The way I understand the reasoning behind which days are the begining of the week is due to the last day of the week.

It is biblical, and the difference is between Jews and Christians.

The Earth was created in 7 days according to scripture.
The 7th day of the week was to be the Sabbath, a day of rest.

The Jews use Saturday, and the Christians use Sunday.

There are certain sects (Seventh Day Adventist, for example) that vary on this.

Interestingly enough, the names of the days of the week are Pagan in origin.

http://mountzioncog.com/pagan-origin-days-of-the-week/

System screen saver.. On a moto edge plus..

The OP is referring to Daydream, once a standard feature of Android 4.1 Jelly Bean and made it to subsequent versions but given the increasing lack of customization lately I'd not be surprised if it got axed.

As for changing the boot animation, you need root for that. That's even harder today than in the glory days of 2009. Being a moto, however, there are instructions online on their site to unlock the bootloader which is required for root, even though it's quite a process. Unfortunately, I never could make the boot animations make sound since version 6.0 Marshmallow. I think the code got axed as well--since I attempted to make a very TouchWiz-themed ROM run on my Nexus 6 years back and even though I successfully got the Samsung Galaxy SII boot animation to play, no sound ever played. It was one of the best boot animations around:
https://www.youtube.com/shorts/JCX0DzJDTk0

Poor download speed over wifi on phone

A phone's MAC address is just a device identifier, it doesn't have any direct relation to WiFi bandwidth speeds. Instead, you need to focus on either the coverage range of the router providing the WiFi network you're connecting to, or the bandwidth speed of the ISP's signal of the modem that feeds the router.
-- Is this slow issue with just one WiFi network or all WiFi networks? If just one that's likely to be a problem with the router. If all, that indicates your phone is having a problem.

-- Is this happening with just your home WiFi network, or elsewhere (i.e. workplace) If at home, have you tried just restarting your router?

-- If it is at home, do you rely upon an ISP's combined modem/router unit or do you have your own separate router?

-- Have you done any kind of coverage range testing? If you have good WiFi connectivity standing within a few feet of the router but it becomes more erratic as you move further away, that's a likely occurrence. You might be able to improve WiFi range but relocating/repositioning the router.

How do I restore a chat backup I already restored?

When you use the backup option in the WhatsApp app it will prompt you to select where you want the default save folder is located. Choose your Google Drive as your preference.
It's safer to have it saved to an online storage service anyway, and it makes it a lot easier to just do a restore or a transfer.
https://faq.whatsapp.com/744445782709185/?locale=en_US

Galaxy watch voice notes apps

Well, no, I use google keep all the time. I'm just not a fan of smartwatches, so that's the component I'm missing. ;) FWIW, have you tried keep? I can, though I don't often, take notes with it using OK google.

I used to Keep briefly a long time ago but that was on my smartphone. I'll have to take a look and see if it's available for my Galaxy watch.

Thanks for the reply!

Filter

Back
Top Bottom