主页按钮或音量增大/减小按钮如何工作(Android)?按此按钮会产生硬件中断吗?

时间:2016-07-07 09:23:12

标签: android smartphone interrupt-handling android-hardware hardware-programming

我想知道主页按钮或音量增大/减小按钮在Android中是如何工作的?按此按钮会产生硬件中断吗?

我想按下这个home / volume键来执行一段具有更高权限的代码(在内核中)。可能吗?有什么指针吗?

如果按下这些按钮会产生硬件中断,我想我必须修改中断处理程序来执行我想要执行的代码。这是对的吗?

提前致谢!

1 个答案:

答案 0 :(得分:0)

namespace KasseDelegate
{

    public partial class Form3 : Form
    {
        public event ListViewUpdatedEventHandler ListViewUpdated;
        SQLiteDataReader dr1;
        public Form3()
        {
            InitializeComponent();

        }
        public Form3(SQLiteDataReader dr)
        {
            InitializeComponent();
            dr1 = dr;
        }

        private void Form3_Load(object sender, System.EventArgs e)
        {
            if (dr1 != null)
            {

                while (dr1.Read() == true)
                {
                    ListViewItem LVI = new ListViewItem();
                    LVI.SubItems.Add(dr1[0].ToString());
                    LVI.SubItems.Add(dr1[1].ToString());
                    LVI.SubItems.Add(dr1[2].ToString());
                    LVI.SubItems.Add(dr1[3].ToString());
                    LVI.SubItems.Add(dr1[4].ToString());
                    listView1.Items.Add(LVI);

                }
            }



        }

        private void button2_Click(object sender, System.EventArgs e)
        {



            string sVareNummer = listView1.SelectedItems[0].SubItems[1].Text;
            string sBeskrivelse = listView1.SelectedItems[0].SubItems[2].Text;
            string pris = listView1.SelectedItems[0].SubItems[4].Text;
            string enpris = listView1.SelectedItems[0].SubItems[5].Text;
            if (ListViewUpdated != null)
            {
                ListViewUpdated(this, new ListViewUpdatedEventArgs() { VareNummer1 = sVareNummer, Beskrivelse1 = sBeskrivelse, Pris1 = pris, Enpris1 = enpris });
            }


        }
    }
    public class ListViewUpdatedEventArgs : System.EventArgs
    {
        private string VareNummer;
        private string Beskrivelse;
        private string pris;
        private string enpris;
        public string VareNummer1
        {
            get
            {
                return VareNummer;
            }
            set
            {
                VareNummer = value;
            }
        }
        public string Beskrivelse1
        {
            get
            {
                return Beskrivelse;
            }
            set
            {
                Beskrivelse = value;
            }
        }
        public string Pris1
        {
            get
            {
                return pris;
            }
            set
            {
                pris = value;
            }

        }

        public string Enpris1
        {
            get
            {
                return enpris;
            }
            set
            {
                enpris = value;
            }

        }
    }
}

您可以找到更多键here