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 7953951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:16:40+00:00 2026-06-04T03:16:40+00:00

One of the activities in my app needs to display a static map (a

  • 0

One of the activities in my app needs to display a static map (a local png file) with pre-determined map pin locations. The static map is 480 px x 904 px in size, and I have implemented it with a scrollview so that I can scroll up and down to view the map and its various pin locations. The pins are implemented as ImageButtons (created programmatically instead of using xml), and clicking them will launch other corresponding new activities. I would like to know how to implement a simple zoom feature where the user can double-tap anywhere on the map and it will zoom in (2x for instance) to the tapped area (and so the pin ImageButtons around the tapped area will be zoomed also). There will be no pinching or multi-touch actions allowed so just simple double tapping to zoom into the tapped area and double tap again to zoom out. BTW, my activity is in landscape mode only so no need to worry about switching orientation. Any advise?

Here is a portion of my xml file for the activity

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/rlayoutResultMap"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:padding="0dp" >

    <ScrollView
        android:id="@+id/scrollResultMap"
        android:fillViewport="true" 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:scrollbars="none" >

        <RelativeLayout
            android:id="@+id/rlayoutScrollMap"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" >

            <ImageView
                android:id="@+id/imgResultMap"
                android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:layout_alignParentTop="true"
                android:src="@drawable/map_base"/>

        </RelativeLayout>
    </ScrollView>
    ...
</RelativeLayout>

And here is a portion of my java class:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.result_map);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

    mapLocArray = getMapCoordinates();

    RelativeLayout rl = (RelativeLayout) findViewById(R.id.rlayoutResultMap);

    // Loop through and create the map location buttons
    int x, y;
    for (int i=1; i<=maxMapLoc; i++ ) {
        mapLocation = i;
        ImageButton btnMapLoc = new ImageButton(ResultMapActivity.this);
        RelativeLayout.LayoutParams vp = new RelativeLayout.LayoutParams(
                LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        x = mapLocArray[i-1].getX();
        y = mapLocArray[i-1].getY();
        vp.setMargins(x,y,0,0);         
        btnMapLoc.setLayoutParams(vp);
        btnMapLoc.setBackgroundColor(Color.TRANSPARENT);
        btnMapLoc.requestLayout();

        String imgNameNormal = "map_loc_" + mapLocation + "_normal"; 
        int idNormal = getResources().getIdentifier(imgNameNormal,"drawable",getPackageName());
        btnMapLoc.setImageResource(idNormal);

        rl.addView(btnMapLoc, vp);

         ...
    }
    ...        
}

Thanks in advance.

  • 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-04T03:16:42+00:00Added an answer on June 4, 2026 at 3:16 am

    why you don’t make y

    <ZoomButton
    android:id="@+id/zoomButton1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBottom="@+id/imageButton1"
    android:layout_centerHorizontal="true"
    android:src="@android:drawable/btn_plus" />
    

    so that the user know what to do.
    When you make it with 2*tab you have to start afer first tab a Timer Task and when the user pres again second tab, in ***ms that you have to implement in the Timer Task you have to zoom.

    And to get a zoomed Image you can use

    int zoom = 2;
    Bitmap i = Bitmap.createScaledBitmap(image, image.getWidth() * zoom, image.getHeight() * zoom, false);
    

    I hope I understand you question right.

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

Sidebar

Related Questions

One of the activities in my app is a listview which needs to display
If I have two activities in my app, one with listview and the other
Okay, so I'm working on an android app. In one of my app's activities
I'm writing an app and I want one of my activities to have a
In an Android app, I am using one static instance of org.apache.http.impl.client.DefaultHttpClient and sharing
I am working on an android app that has two activities. One is the
My app crashes with stackoverflow error on one of my activities. This is what
This is my situation. I have two activities: ONE and TWO. In TWO activity
I have the following layout defined for one of my Activities: <?xml version=1.0 encoding=utf-8?>
I have a design of activities like this I have one main activity and

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.