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

Apps Code Port

hello folks. im not super experienced with java development, and im very new to android development.

i am trying to create a custom keyboard for android. its mostly for experimental purposes. the keyboard only has 10 buttons, two on the top, 1 all the way to the left, 2 stacked on the left one, three stacked on the 2 on the left, then 2 more in the remaining space. its pretty tricky to explain... kinda like this:

HTML:
<table border="1"> 
<tr>
<td colspan="2">a</td><td colspan="2">b</td>
</tr>
<tr>
<td>a</td>
<td><table border="1"><tr><td>a</td></tr>
    <tr><td>b</td></tr></table></td>
<td><table border="1"><tr><td>a</td></tr>
    <tr><td>b</td></tr>
    <tr><td>c</td></tr></table></td>
<td><table border="1"><tr><td>a</td></tr>
    <tr><td>b</td></tr></table></td>
</tr>
</table>

i found a great example of a soft keyboard in the android sdk, but im having trouble understanding it and it doesnt seem to compile anyway :(

i sketched up what im trying to do in c#, if you create these files, compile and run this, youll see exactly what im trying to do. can somebody help me port this to an android soft keyboard?


program.cs
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace csip_demo_wfa
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }
}

Form1.Designer.cs
Code:
namespace csip_demo_wfa
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.panel1 = new System.Windows.Forms.Panel();
            this.b8 = new System.Windows.Forms.Button();
            this.b4 = new System.Windows.Forms.Button();
            this.panel2 = new System.Windows.Forms.Panel();
            this.panel3 = new System.Windows.Forms.Panel();
            this.panel4 = new System.Windows.Forms.Panel();
            this.panel5 = new System.Windows.Forms.Panel();
            this.panel6 = new System.Windows.Forms.Panel();
            this.panel7 = new System.Windows.Forms.Panel();
            this.panel8 = new System.Windows.Forms.Panel();
            this.panel9 = new System.Windows.Forms.Panel();
            this.panel10 = new System.Windows.Forms.Panel();
            this.b16 = new System.Windows.Forms.Button();
            this.b32 = new System.Windows.Forms.Button();
            this.b64 = new System.Windows.Forms.Button();
            this.b48 = new System.Windows.Forms.Button();
            this.b96 = new System.Windows.Forms.Button();
            this.b112 = new System.Windows.Forms.Button();
            this.panel11 = new System.Windows.Forms.Panel();
            this.panel12 = new System.Windows.Forms.Panel();
            this.b2 = new System.Windows.Forms.Button();
            this.b1 = new System.Windows.Forms.Button();
            this.timer1 = new System.Windows.Forms.Timer(this.components);
            this.panel1.SuspendLayout();
            this.panel2.SuspendLayout();
            this.panel3.SuspendLayout();
            this.panel4.SuspendLayout();
            this.panel5.SuspendLayout();
            this.panel6.SuspendLayout();
            this.panel7.SuspendLayout();
            this.panel8.SuspendLayout();
            this.panel9.SuspendLayout();
            this.panel10.SuspendLayout();
            this.panel11.SuspendLayout();
            this.panel12.SuspendLayout();
            this.SuspendLayout();
            // 
            // panel1
            // 
            this.panel1.Controls.Add(this.b4);
            this.panel1.Controls.Add(this.b8);
            this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
            this.panel1.Location = new System.Drawing.Point(0, 0);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(533, 79);
            this.panel1.TabIndex = 0;
            // 
            // b8
            // 
            this.b8.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255)))));
            this.b8.Dock = System.Windows.Forms.DockStyle.Left;
            this.b8.Enabled = false;
            this.b8.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.b8.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.b8.Location = new System.Drawing.Point(0, 0);
            this.b8.Name = "b8";
            this.b8.Size = new System.Drawing.Size(267, 79);
            this.b8.TabIndex = 0;
            this.b8.Text = "9  8  10";
            this.b8.UseVisualStyleBackColor = false;
            // 
            // b4
            // 
            this.b4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(255)))));
            this.b4.Dock = System.Windows.Forms.DockStyle.Left;
            this.b4.Enabled = false;
            this.b4.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.b4.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.b4.Location = new System.Drawing.Point(267, 0);
            this.b4.Name = "b4";
            this.b4.Size = new System.Drawing.Size(267, 79);
            this.b4.TabIndex = 1;
            this.b4.Text = "5  4  6";
            this.b4.UseVisualStyleBackColor = false;
            // 
            // panel2
            // 
            this.panel2.Controls.Add(this.panel5);
            this.panel2.Controls.Add(this.panel4);
            this.panel2.Controls.Add(this.panel3);
            this.panel2.Dock = System.Windows.Forms.DockStyle.Left;
            this.panel2.Location = new System.Drawing.Point(0, 79);
            this.panel2.Name = "panel2";
            this.panel2.Size = new System.Drawing.Size(267, 241);
            this.panel2.TabIndex = 1;
            // 
            // panel3
            // 
            this.panel3.Controls.Add(this.b112);
            this.panel3.Dock = System.Windows.Forms.DockStyle.Left;
            this.panel3.Location = new System.Drawing.Point(0, 0);
            this.panel3.Name = "panel3";
            this.panel3.Size = new System.Drawing.Size(66, 241);
            this.panel3.TabIndex = 0;
            // 
            // panel4
            // 
            this.panel4.Controls.Add(this.panel10);
            this.panel4.Controls.Add(this.panel6);
            this.panel4.Dock = System.Windows.Forms.DockStyle.Left;
            this.panel4.Location = new System.Drawing.Point(66, 0);
            this.panel4.Name = "panel4";
            this.panel4.Size = new System.Drawing.Size(66, 241);
            this.panel4.TabIndex = 1;
            // 
            // panel5
            // 
            this.panel5.Controls.Add(this.panel9);
            this.panel5.Controls.Add(this.panel8);
            this.panel5.Controls.Add(this.panel7);
            this.panel5.Dock = System.Windows.Forms.DockStyle.Fill;
            this.panel5.Location = new System.Drawing.Point(132, 0);
            this.panel5.Name = "panel5";
            this.panel5.Size = new System.Drawing.Size(135, 241);
            this.panel5.TabIndex = 2;
            // 
            // panel6
            // 
            this.panel6.Controls.Add(this.b48);
            this.panel6.Dock = System.Windows.Forms.DockStyle.Top;
            this.panel6.Location = new System.Drawing.Point(0, 0);
            this.panel6.Name = "panel6";
            this.panel6.Size = new System.Drawing.Size(66, 120);
            this.panel6.TabIndex = 0;
            // 
            // panel7
            // 
            this.panel7.Controls.Add(this.b16);
            this.panel7.Dock = System.Windows.Forms.DockStyle.Top;
            this.panel7.Location = new System.Drawing.Point(0, 0);
            this.panel7.Name = "panel7";
            this.panel7.Size = new System.Drawing.Size(135, 80);
            this.panel7.TabIndex = 0;
            // 
            // panel8
            // 
            this.panel8.Controls.Add(this.b32);
            this.panel8.Dock = System.Windows.Forms.DockStyle.Top;
            this.panel8.Location = new System.Drawing.Point(0, 80);
            this.panel8.Name = "panel8";
            this.panel8.Size = new System.Drawing.Size(135, 80);
            this.panel8.TabIndex = 1;
            // 
            // panel9
            // 
            this.panel9.Controls.Add(this.b64);
            this.panel9.Dock = System.Windows.Forms.DockStyle.Top;
            this.panel9.Location = new System.Drawing.Point(0, 160);
            this.panel9.Name = "panel9";
            this.panel9.Size = new System.Drawing.Size(135, 80);
            this.panel9.TabIndex = 2;
            // 
            // panel10
            // 
            this.panel10.Controls.Add(this.b96);
            this.panel10.Dock = System.Windows.Forms.DockStyle.Top;
            this.panel10.Location = new System.Drawing.Point(0, 120);
            this.panel10.Name = "panel10";
            this.panel10.Size = new System.Drawing.Size(66, 120);
            this.panel10.TabIndex = 1;
            // 
            // b16
            // 
            this.b16.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
            this.b16.Dock = System.Windows.Forms.DockStyle.Fill;
            this.b16.Enabled = false;
            this.b16.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.b16.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.b16.Location = new System.Drawing.Point(0, 0);
            this.b16.Name = "b16";
            this.b16.Size = new System.Drawing.Size(135, 80);
            this.b16.TabIndex = 1;
            this.b16.Text = "17 16 18";
            this.b16.UseVisualStyleBackColor = false;
            // 
            // b32
            // 
            this.b32.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
            this.b32.Dock = System.Windows.Forms.DockStyle.Fill;
            this.b32.Enabled = false;
            this.b32.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.b32.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.b32.Location = new System.Drawing.Point(0, 0);
            this.b32.Name = "b32";
            this.b32.Size = new System.Drawing.Size(135, 80);
            this.b32.TabIndex = 2;
            this.b32.Text = "33 32 34";
            this.b32.UseVisualStyleBackColor = false;
            // 
            // b64
            // 
            this.b64.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
            this.b64.Dock = System.Windows.Forms.DockStyle.Fill;
            this.b64.Enabled = false;
            this.b64.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.b64.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.b64.Location = new System.Drawing.Point(0, 0);
            this.b64.Name = "b64";
            this.b64.Size = new System.Drawing.Size(135, 80);
            this.b64.TabIndex = 3;
            this.b64.Text = "65 64 66";
            this.b64.UseVisualStyleBackColor = false;
            // 
            // b48
            // 
            this.b48.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
            this.b48.Dock = System.Windows.Forms.DockStyle.Fill;
            this.b48.Enabled = false;
            this.b48.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.b48.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.b48.Location = new System.Drawing.Point(0, 0);
            this.b48.Name = "b48";
            this.b48.Size = new System.Drawing.Size(66, 120);
            this.b48.TabIndex = 2;
            this.b48.Text = "49 48 50";
            this.b48.UseVisualStyleBackColor = false;
            // 
            // b96
            // 
            this.b96.BackColor = System.Drawing.Color.Yellow;
            this.b96.Dock = System.Windows.Forms.DockStyle.Fill;
            this.b96.Enabled = false;
            this.b96.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.b96.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.b96.Location = new System.Drawing.Point(0, 0);
            this.b96.Name = "b96";
            this.b96.Size = new System.Drawing.Size(66, 120);
            this.b96.TabIndex = 2;
            this.b96.Text = "97 96 98";
            this.b96.UseVisualStyleBackColor = false;
            // 
            // b112
            // 
            this.b112.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(64)))), ((int)(((byte)(0)))));
            this.b112.Dock = System.Windows.Forms.DockStyle.Fill;
            this.b112.Enabled = false;
            this.b112.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.b112.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.b112.Location = new System.Drawing.Point(0, 0);
            this.b112.Name = "b112";
            this.b112.Size = new System.Drawing.Size(66, 241);
            this.b112.TabIndex = 2;
            this.b112.Text = "113 112 114";
            this.b112.UseVisualStyleBackColor = false;
            // 
            // panel11
            // 
            this.panel11.Controls.Add(this.b2);
            this.panel11.Dock = System.Windows.Forms.DockStyle.Top;
            this.panel11.Location = new System.Drawing.Point(267, 79);
            this.panel11.Name = "panel11";
            this.panel11.Size = new System.Drawing.Size(266, 120);
            this.panel11.TabIndex = 2;
            // 
            // panel12
            // 
            this.panel12.Controls.Add(this.b1);
            this.panel12.Dock = System.Windows.Forms.DockStyle.Top;
            this.panel12.Location = new System.Drawing.Point(267, 199);
            this.panel12.Name = "panel12";
            this.panel12.Size = new System.Drawing.Size(266, 120);
            this.panel12.TabIndex = 3;
            // 
            // b2
            // 
            this.b2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(128)))));
            this.b2.Dock = System.Windows.Forms.DockStyle.Fill;
            this.b2.Enabled = false;
            this.b2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.b2.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.b2.Location = new System.Drawing.Point(0, 0);
            this.b2.Name = "b2";
            this.b2.Size = new System.Drawing.Size(266, 120);
            this.b2.TabIndex = 2;
            this.b2.Text = "2";
            this.b2.UseVisualStyleBackColor = false;
            // 
            // b1
            // 
            this.b1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
            this.b1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.b1.Enabled = false;
            this.b1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.b1.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.b1.Location = new System.Drawing.Point(0, 0);
            this.b1.Name = "b1";
            this.b1.Size = new System.Drawing.Size(266, 120);
            this.b1.TabIndex = 2;
            this.b1.Text = "1";
            this.b1.UseVisualStyleBackColor = false;
            // 
            // timer1
            // 
            this.timer1.Enabled = true;
            this.timer1.Interval = 5000;
            this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(533, 320);
            this.Controls.Add(this.panel12);
            this.Controls.Add(this.panel11);
            this.Controls.Add(this.panel2);
            this.Controls.Add(this.panel1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.Name = "Form1";
            this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
            this.Text = "sip";
            this.TopMost = true;
            this.panel1.ResumeLayout(false);
            this.panel2.ResumeLayout(false);
            this.panel3.ResumeLayout(false);
            this.panel4.ResumeLayout(false);
            this.panel5.ResumeLayout(false);
            this.panel6.ResumeLayout(false);
            this.panel7.ResumeLayout(false);
            this.panel8.ResumeLayout(false);
            this.panel9.ResumeLayout(false);
            this.panel10.ResumeLayout(false);
            this.panel11.ResumeLayout(false);
            this.panel12.ResumeLayout(false);
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.Panel panel1;
        private System.Windows.Forms.Button b4;
        private System.Windows.Forms.Button b8;
        private System.Windows.Forms.Panel panel2;
        private System.Windows.Forms.Panel panel5;
        private System.Windows.Forms.Panel panel9;
        private System.Windows.Forms.Button b64;
        private System.Windows.Forms.Panel panel8;
        private System.Windows.Forms.Button b32;
        private System.Windows.Forms.Panel panel7;
        private System.Windows.Forms.Button b16;
        private System.Windows.Forms.Panel panel4;
        private System.Windows.Forms.Panel panel10;
        private System.Windows.Forms.Button b96;
        private System.Windows.Forms.Panel panel6;
        private System.Windows.Forms.Button b48;
        private System.Windows.Forms.Panel panel3;
        private System.Windows.Forms.Button b112;
        private System.Windows.Forms.Panel panel11;
        private System.Windows.Forms.Button b2;
        private System.Windows.Forms.Panel panel12;
        private System.Windows.Forms.Button b1;
        private System.Windows.Forms.Timer timer1;
    }
}

Form1.cs
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace csip_demo_wfa
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private int counter = 0;

        private void timer1_Tick(object sender, EventArgs e)
        {
            Console.WriteLine(counter.ToString());

            displayVal(counter);

            if (counter < 128)
            {
                counter++;
            }
            else
            {
                counter = 0;
            }

        }


        private void displayVal(int val)
        {
            b1Update(val);
            b2Update(val);
            b4Update(val);
            b8Update(val);
            b16Update(val);
            b32Update(val);
            b64Update(val);
            b48Update(val);
            b96Update(val);
            b112Update(val);
        }

        private void b1Update(int val)
        {
            Boolean buttonDepressed = false;
            Byte[] bValA = {System.Convert.ToByte(val)};
            System.Collections.BitArray bVal = new System.Collections.BitArray(bValA);
            buttonDepressed = bVal.Get(0);
            if (buttonDepressed)
            {
                b1.Text = "";
            }
            else
            {
                b1.Text = (1 + val).ToString();
            }
            return;
        }

        private void b2Update(int val)
        {
            Boolean buttonDepressed = false;
            Byte[] bValA = { System.Convert.ToByte(val) };
            System.Collections.BitArray bVal = new System.Collections.BitArray(bValA);
            buttonDepressed = bVal.Get(1);
            if (buttonDepressed)
            {
                b2.Text = "";
            }
            else
            {
                b2.Text = (2 + val).ToString();
            }
            return;
        }


        private string buttonString(int BVAL, System.Collections.BitArray depressions, int CURVAL)
        {
            string ret = "";

            if (depressions.Get(0) && !depressions.Get(1))
            {
                ret = (BVAL + CURVAL).ToString() + " " + (1 + BVAL + CURVAL).ToString();
            }
            else if (!depressions.Get(0) && depressions.Get(1))
            {
                ret = (2 + BVAL + CURVAL).ToString() + " " + (BVAL + CURVAL).ToString();
            }
            else if (!depressions.Get(0) && !depressions.Get(1))
            {
                ret = (2 + BVAL + CURVAL).ToString() + " " + (BVAL + CURVAL).ToString() + " " + (1 + BVAL + CURVAL).ToString();
            }
            else if (depressions.Get(0) && depressions.Get(1))
            {
                ret = (BVAL + CURVAL).ToString();
            }
            return ret;
        }

        private void b4Update(int val)
        {
            Boolean buttonDepressed = false;
            Byte[] bValA = { System.Convert.ToByte(val) };
            System.Collections.BitArray bVal = new System.Collections.BitArray(bValA);
            buttonDepressed = bVal.Get(2);
            if (buttonDepressed)
            {
                b4.Text = "";
            }
            else
            {                
                b4.Text = buttonString(4, bVal, val);
            }
            return;
        }

        private void b8Update(int val)
        {
            Boolean buttonDepressed = false;
            Byte[] bValA = { System.Convert.ToByte(val) };
            System.Collections.BitArray bVal = new System.Collections.BitArray(bValA);
            buttonDepressed = bVal.Get(3);
            if (buttonDepressed)
            {
                b8.Text = "";
            }
            else
            {
                b8.Text = buttonString(8, bVal, val);                
            }
            return;
        }

        private void b16Update(int val)
        {
            Boolean buttonDepressed = false;
            Byte[] bValA = { System.Convert.ToByte(val) };
            System.Collections.BitArray bVal = new System.Collections.BitArray(bValA);
            buttonDepressed = bVal.Get(4);
            if (buttonDepressed)
            {
                b16.Text = "";
            }
            else
            {
                b16.Text = buttonString(16, bVal, val);                
            }
            return;
        }

        private void b32Update(int val)
        {
            Boolean buttonDepressed = false;
            Byte[] bValA = { System.Convert.ToByte(val) };
            System.Collections.BitArray bVal = new System.Collections.BitArray(bValA);
            buttonDepressed = bVal.Get(5);
            if (buttonDepressed)
            {
                b32.Text = "";
            }
            else
            {
                b32.Text = buttonString(32, bVal, val);
            }
            return;
        }

        private void b64Update(int val)
        {
            Boolean buttonDepressed = false;
            Byte[] bValA = { System.Convert.ToByte(val) };
            System.Collections.BitArray bVal = new System.Collections.BitArray(bValA);
            buttonDepressed = bVal.Get(6);
            if (buttonDepressed)
            {
                b64.Text = "";
            }
            else
            {
                b64.Text = buttonString(64, bVal, val);                
            }
            return;
        }

        private void b48Update(int val)
        {
            Boolean buttonDepressed = false;
            Byte[] bValA = { System.Convert.ToByte(val) };
            System.Collections.BitArray bVal = new System.Collections.BitArray(bValA);
            buttonDepressed = bVal.Get(4) && bVal.Get(5);
            if (buttonDepressed)
            {
                b48.Text = "";
            }
            else
            {
                b48.Text = buttonString(48, bVal, val);                
            }
            return;
        }

        private void b96Update(int val)
        {
            Boolean buttonDepressed = false;
            Byte[] bValA = { System.Convert.ToByte(val) };
            System.Collections.BitArray bVal = new System.Collections.BitArray(bValA);
            buttonDepressed = bVal.Get(5) && bVal.Get(6);
            if (buttonDepressed)
            {
                b96.Text = "";
            }
            else
            {
                b96.Text = buttonString(96, bVal, val);                
            }
            return;
        }

        private void b112Update(int val)
        {
            Boolean buttonDepressed = false;
            Byte[] bValA = { System.Convert.ToByte(val) };
            System.Collections.BitArray bVal = new System.Collections.BitArray(bValA);
            buttonDepressed = bVal.Get(5) && bVal.Get(6) && bVal.Get(4);
            if (buttonDepressed)
            {
                b112.Text = "";
            }
            else
            {
                b112.Text = buttonString(112, bVal, val);                
            }
            return;
        }
    }
}



thanks all!
 
As a 100% Linux user I can't run c# - or if I can I don't know how. So a picture would have been better than code. But I do know how to make a graphic screen on Android with any conceivable layout of buttons, and attach event handlers to each one. It's fairly complex so I can't separate out usable code from the app it's part of (Easy Coder) but I might be able to give some hints if this is the general area you're looking in.
 
Thanks, any starting point is helpful.
Sorry about the c#, .net languages are really all im any good for. the html i posted kinda give an indication of what i wanted the keyboard to look like. I cant post a screen shot because im a new user. the rules said i have to wait for a while. Ill give it a shot anyway, sample

edit: ah, it worked!

Could you link me to the example you were talking about? I didnt see it on easy coder.

thanks!
 
Also, it is important that it is a keyboard, it should be installable as a keyboard and, if selected as the default keyboard should persist from app to app... just like any other keyboard
 
I didn't mean to imply I had a layout resembling your (curious but very interesting) one. A graphic array of buttons is quite straightforward, however; the closest Easy Coder example would be the calculator. The size and positioning issues are trivial; the biggest part of the job is that of managing the various buttons so each one reports when it's tapped. For this I create a stack of individual "button" objects each of which knows its own size, position, etc, how to draw itself when passed a Canvas and what to do when tapped. The entire stack is managed by a "stage" object that extends View and overrides onDraw() and onTouch(). In the latter it calls each button in turn from front to back (to allow for overlapping) to see if the tap happened inside its boundary, whether it's a drag gesture etc.

I hope this helps a little.

(P.S. I'm not yet experienced enough to know how to set up and install a system keyboard or other services, but you've now got me wondering if I could get Easy Coder to do such things.)
 
Back
Top Bottom