Como faço para adicionar um evento a uma tecla física no android?

Por exemplo, quando declaro um botão no arquivo xml, posso usar o método onClick para acionar o seu comportamento. Mas como fazer isso através de uma tecla física? Quando eu clicar no botão voltar, ou volume, por exemplo.

privacy – What’s the best way to protect my rooted Android 7 from malware and hacking?

Considering I have to use cellular data and being not connected to the internet is not an option, what measures can I take or tools I can use to keep myself protected from prying eyes?

My first step will be to do a clean rom flash in case I’m infected already, but as soon as I do that, I’d like to ensure that I remain clean and protected because I would be using my phone for very private data. What can I do? Besides the obvious and common sense stuff of course.

Android 7 | Rooted | Moto C Plus

What is needed to have an Android app as a copy for test mode [migrated]

Is there a way to have same app twice on same device using some simple patch?

  1. One copy is current version downloaded from the store
  2. A testing copy is an APK coming out of a CI/CD system (built using React Native)

What I have tried so far:

  • Replace app name in the source file src/main/res/values/strings.xml; but on one device the copy replaces the original, on another device the install routing reports a general error without further detail.

android layout – Flutter ListView: Only one item name on the list is called when onDismissed

I am using a ListView.Builder to display my data to the screen which is working very fine, then i implimented the Dismisse and onDismisse function which seem to be working fine but it i try to dismisse item-A it will dismiss it from the screen but on the showSnackBar its displaying that Item-Z was deleted, if i deleted item-B it still gives me the name of of item-Z on the showSnackBar, i added more items to the data List which made item-Z now item-X but if i swipe its still shows me that the new item-Z has been deleted, then i tried deleting the Last Item which is the item-Z and it gave me an error

(. Exception caught by animation library
═════════════════════════════════ The following RangeError was thrown
while notifying listeners for AnimationController:
RangeError (index): Invalid value: Not in inclusive range 0..3: 4

When the exception was thrown, this was the stack
#0 List.() (dart:core-patch/growable_array.dart:177:60)
#1 _ListsState.build.. package:another_test/list_widget.dart:81. )

this is the code down bellow

import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
import './list_model.dart';

class Lists extends StatefulWidget {
  @override
  _ListsState createState() => _ListsState();
}

class _ListsState extends State<Lists> {
  List<ItemLists> items = (
    ItemLists(
      title: 'Best Music of the Year',
      discription: 'Davido',
      favorite: false,
    ),
    ItemLists(
      title: 'Best Album Cover design',
      discription: 'Brighter Press',
      favorite: false,
    ),
    ItemLists(
      title: 'Best Vocalist',
      discription: 'Simi-Sola',
      favorite: false,
    ),
    ItemLists(
      title: 'Best Danced',
      discription: 'Black Camaru',
      favorite: false,
    ),
    ItemLists(
      title: 'Best Performance',
      discription: 'Shofeni-Were',
      favorite: false,
    ),
    ItemLists(
      title: 'Best Act',
      discription: 'You Want to See Craze',
      favorite: false,
    ),
  );

  @override
  Widget build(BuildContext context) {
    return Container(
      child: ListView.builder(
        scrollDirection: Axis.vertical,
        shrinkWrap: true,
        itemBuilder: (context, index) {
          return Dismissible(
            key: ObjectKey(items(index)),
            background: Container(
              color: Colors.red,
            ),
            child: Card(
                child: ListTile(
              leading: new IconButton(
                  icon: Icon(
                    Icons.star,
                    color: items(index).favorite ? Colors.green : Colors.grey,
                  ),
                  tooltip: 'Add to Favorite',
                  onPressed: () {
                    setState(() {
                      items(index).favorite = !items(index).favorite;
                    });
                  }),
              title: Text('${items(index).title}'),
              subtitle: Text('${items(index).discription}'),
              trailing:
                  IconButton(icon: Icon(Icons.calendar_today), onPressed: null),
            )),
            onDismissed: (direction) {
              // Remove the item from the data source.
              setState(() {
                items.removeAt(index);
              });
              Scaffold.of(context).showSnackBar(
                SnackBar(
                  content: Text('${items(index)?.title} Deleted'),
                ),
              );
            },
          );
        },
        itemCount: items.length,
      ),
    );
  }
}

and the data model code down bellow

class ItemLists {
  String title;
  String discription;
  bool favorite;

  ItemLists({this.title, this.discription, this.favorite});
}

from the screenshoot bellow you will see i deleted a different item but it was still showing me that i deleted the last item which is still on the page

enter image description here

adding hotspot functionality – Android Enthusiasts Stack Exchange

I am currently trying to enable hotspot functionality on the relatively new 3.5″ Palm phone. Designed to be a companion phone to a larger, more fully-equipped phone on the Verizon network, now it is available unlocked. I would like to do the opposite and have this as my primary phone while using a larger phone as a companion when needed.

I have tried some hotspot apps, but thus far all seem to rely on the phone already natively having hotspot support. Are there any apps or other methods for imbuing hotspot capabilities to this type of phone, or is it forever limited to being a companion device?

storage – Is it possible to backup data from a locked android phone?

is it possible to get files from a locked android phone with PC ? I searched the entire internet but couldn’t get any reliable source. Although i can simply hard reset the phone to bypass the lock, but the data inside is really important to me. I want to try adb command to remove the pin lock but unfortunately i didn’t turn on the usb debugging .. Anyone have any ideas on this?

Info
My phone model: Vivo 7 Plus
USB debugging: Not turned on

Chrome Suicides after Update – Android Enthusiasts Stack Exchange

Since the last two versions of Chrome available in the Google Play Store, one from March 12 and the other from April 13, the update process sort-of removes Chrome from the phone:

  • Chrome icon is removed.

  • Chrome disappears from the the application menu.

  • Chrome is still shown in the Google Play Store under Installed Apps only has an Uninstall button (no Open).

  • In the Settings > Applications menu, the updated version of Chrome is listed but can only be uninstalled too.

This is happening on the same Moto G5 Android phone I have been using for years and every Chrome update until March 2021 worked without issues. I tried a few times by uninstalling (which reverts to the stock version) Chrome and doing the update from various intermediate versions bu the last two suicide every time the update!

What is going on there? Does that mean the hardware is too old to support these Chrome releases? The Moto G5 is running on Android 7.0 with security patch May 2017 and no System Updates are offered.