Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8800831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:41:35+00:00 2026-06-14T00:41:35+00:00

Hi I’m trying to combine 2 projects 1. that tells me wen button on

  • 0

Hi I’m trying to combine 2 projects
1. that tells me wen button on arduino pressed
2. make a call on android

what im trying to do is when button pressed on arduino make a call..
but with no luck 🙁

Call

    package net.mitchtech.adb;

    import net.mitchtech.adb.simpledigitalinput.R;
    import android.app.Activity;
    import android.content.ActivityNotFoundException;
    import android.content.Intent;
    import android.net.Uri;
    import android.os.Bundle;
    import android.util.Log;

    public class phonecalls extends Activity {

    private void call() {
        try {
            Intent callIntent = new Intent(Intent.ACTION_CALL);
            callIntent.setData(Uri.parse("tel:048598077"));
            startActivity(callIntent);
        } catch (ActivityNotFoundException activityException) {
            Log.e("dialing-example", "Call failed", activityException);
        }
    }

        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.input);
        }
    }

buttons

package net.mitchtech.adb;

import net.mitchtech.adb.simpledigitalinput.R;
import net.mitchtech.adb.phonecalls;

import org.microbridge.server.AbstractServerListener;
import org.microbridge.server.Server;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.TextView;

public class ButtonView extends FrameLayout {
    private static final String TAG = ButtonView.class.getSimpleName();

    private final View mButtonView;

    private Server mServer;

    private final int BUTTON1 = 2;
    private final int BUTTON2 = 3;

    public ButtonView(Context context, AttributeSet attrs) {
        super(context, attrs);

        LayoutInflater inflater = (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        mButtonView = inflater.inflate(R.layout.input, this);
    }

    public void setServer(Server server) {
        mServer = server;

        mServer.addListener(new AbstractServerListener() {

            @Override
            public void onReceive(org.microbridge.server.Client client, byte[] data) {
                if (data.length < 2)
                    return;

                final int pinNumber = data[0];
                final int pinState = data[1];
                Log.i(TAG, "data[0]:" + pinNumber + "  data[1]:" + pinState);

                final TextView positionText = (TextView) findViewById(R.id.activeText);

                class InputAction implements Runnable {

                    public void run() {

                        switch (pinNumber) {
                        case BUTTON1:
                            if (pinState == 1) {
                                call();
                                positionText.setText("Button 1 Active");

                            } else {
                                positionText.setText("");
                            }
                            break;
                        case BUTTON2:
                            if (pinState == 1) {
                                positionText.setText("Button 2 Active");
                            } else {
                                positionText.setText("");
                            }
                            break;

                        default:
                            break;
                        }
                    }
                };

                InputAction action = new InputAction();
                post(action);
            }
        });
    }

    public View getmButtonView() {
        return mButtonView;
    }
}

and another activity

package net.mitchtech.adb;

import java.io.IOException;

import net.mitchtech.adb.simpledigitalinput.R;

import org.microbridge.server.Server;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

public class SimpleDigitalInputActivity extends Activity {

    private final static String TAG = SimpleDigitalInputActivity.class.getSimpleName();

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.main);

        Server server = null;
        try
        {
            server = new Server(4567);
            server.start();

            ButtonView buttonView = (ButtonView) findViewById(R.id.inputView);
            buttonView.setServer(server);
            } catch (IOException e)
        {
            Log.e(TAG, "Unable to start TCP server", e);
            System.exit(-1);
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T00:41:37+00:00Added an answer on June 14, 2026 at 12:41 am

    Your call() function is declared in your activity, but you’re trying to access it in your ButtonView class. Try moving it into ButtonView (copy & paste).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.