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

  • SEARCH
  • Home
  • 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 6642051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:53:04+00:00 2026-05-25T23:53:04+00:00

I am making my own Pattern Lock for android phone, i have Done the

  • 0

I am making my own Pattern Lock for android phone, i have Done the coding as when i click on an image it stores an integer in an array and when the user re-enters the same password it matches both the arrays and Open the lock accordingly, my code is working fine But Now i have to add gesture in the form of a line while going from one image to another (as in pattern lock) also i want to store the integers in the array when i touch an image instead of clicking it…

guide me how to do this below is my sample code for image click events

public void Image1(View view) {
            // Toast.makeText(this, "You clicked Image 1!",
            // Toast.LENGTH_SHORT).show();
            myArray[0] = 1;
            // builder.append("" + myArray[0] + " ");
            // Toast.makeText(this, myArray, Toast.LENGTH_LONG).show();
            ImageView kk = (ImageView) view;
            Drawable d = getResources().getDrawable(R.drawable.unlock);
            kk.setImageDrawable(d);

        }

        public void Image2(View view) {
            // Toast.makeText(this, "You clicked Image 2!",
            // Toast.LENGTH_SHORT).show();
            myArray[1] = 2;
            ImageView kk = (ImageView) view;
            Drawable d = getResources().getDrawable(R.drawable.unlock);
            kk.setImageDrawable(d);
        }

        public void Image3(View view) {
            // Toast.makeText(this, "You clicked Image 3!",
            // Toast.LENGTH_SHORT).show();
            myArray[2] = 3;
            ImageView kk = (ImageView) view;
            Drawable d = getResources().getDrawable(R.drawable.unlock);
            kk.setImageDrawable(d);
        }

        public void Image4(View view) {
            // Toast.makeText(this, "You clicked Image 4!",
            // Toast.LENGTH_SHORT).show();
            myArray[3] = 4;
            ImageView kk = (ImageView) view;
            Drawable d = getResources().getDrawable(R.drawable.unlock);
            kk.setImageDrawable(d);
        }

        public void Image5(View view) {
            // Toast.makeText(this, "You clicked Image 5!",
            // Toast.LENGTH_SHORT).show();
            myArray[4] = 5;
            ImageView kk = (ImageView) view;
            Drawable d = getResources().getDrawable(R.drawable.unlock);
            kk.setImageDrawable(d);
        }

        public void Image6(View view) {
            // Toast.makeText(this, "You clicked Image 6!",
            // Toast.LENGTH_SHORT).show();
            myArray[5] = 6;
            ImageView kk = (ImageView) view;
            Drawable d = getResources().getDrawable(R.drawable.unlock);
            kk.setImageDrawable(d);
        }

        public void Image7(View view) {
            // Toast.makeText(this, "You clicked Image 7!",
            // Toast.LENGTH_SHORT).show();
            myArray[6] = 7;
            ImageView kk = (ImageView) view;
            Drawable d = getResources().getDrawable(R.drawable.unlock);
            kk.setImageDrawable(d);
        }

        public void Image8(View view) {
            // Toast.makeText(this, "You clicked Image 8!",
            // Toast.LENGTH_SHORT).show();
            myArray[7] = 8;
            ImageView kk = (ImageView) view;
            Drawable d = getResources().getDrawable(R.drawable.unlock);
            kk.setImageDrawable(d);
        }

        public void Image9(View view) {
            // Toast.makeText(this, "You clicked Image 9!",
            // Toast.LENGTH_SHORT).show();
            myArray[8] = 9;
            ImageView kk = (ImageView) view;
            Drawable d = getResources().getDrawable(R.drawable.unlock);
            kk.setImageDrawable(d);
        }
  • 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-05-25T23:53:04+00:00Added an answer on May 25, 2026 at 11:53 pm

    Implement onTouchEvent(MotionEvent ev), with ACTION_DOWN, ACTION_MOVE, ACTION_UP. As your finger moving, draw a line from previous Coordinate to current Coordinate.
    Get coordinate by using ev.getX() ev.getY()
    I’ve just thought of two solution currently:

    1. When detecting touch event, at ACTION_DOWN, draw a transparent VIEW on top of parent view, make it Canvas and draw as long as ACTION_MOVE is under processing.
    2. Use SurfaceView instead of regular View. A sample on SurfaceView to draw: http://www.droidnova.com/playing-with-graphics-in-android-part-ii,160.html
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making my own web browser for the iPad, and I have a problem
How can I log in user from page header without making my own login
Iam making my own custom login in wordpress using wp_signon function. Whenever a user
I'm currently making my own social network and I have a php problem which
I'm making my own minor mode for emacs. Now I want to add button
I'm making my own ControlTemplate for a standard Button in WPF. I want to
I'm making my own scheduler, which is going to be used in one of
I'm making my own website using html and php, and a database using mysql
i am making my own framework and would like to allow easy direct access
I am making my own installer and it's almost complete. The only thing lacking

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.