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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:32:35+00:00 2026-05-16T08:32:35+00:00

I would like to write an android app that basically layers an overlay on

  • 0

I would like to write an android app that basically layers an overlay on image on another image and then I would like to save the picture with the overlay as a jpg or png. Basically this will be the whole view that I would like to save.

Sample code would be very helpful.

EDIT:

I tried out your suggestions and am getting a null pointer at the Starred Line.

 import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.os.Bundle;
import android.os.Environment;
import android.widget.LinearLayout;
import android.widget.TextView;

    public class EditPhoto extends Activity {
        /** Called when the activity is first created. */
     LinearLayout ll = null;
     TextView tv = null;
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            tv = (TextView) findViewById(R.id.text);
            ll = (LinearLayout) findViewById(R.id.layout);
            ll.setDrawingCacheEnabled(true);
            Bitmap b = ll.getDrawingCache();
            File sdCard = Environment.getExternalStorageDirectory();
            File file = new File(sdCard, "image.jpg");
            FileOutputStream fos;
      try {
       fos = new FileOutputStream(file);
       *** b.compress(CompressFormat.JPEG, 95,fos);
      } catch (FileNotFoundException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
      }

        }
    }
  • 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-16T08:32:36+00:00Added an answer on May 16, 2026 at 8:32 am

    You can take advantage of a View’s drawing cache.

    view.setDrawingCacheEnabled(true);
    Bitmap b = view.getDrawingCache();
    b.compress(CompressFormat.JPEG, 95, new FileOutputStream("/some/location/image.jpg"));
    

    Where view is your View. The 95 is the quality of the JPG compression. And the file output stream is just that.

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

Sidebar

Ask A Question

Stats

  • Questions 537k
  • Answers 537k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It might work, but I wouldn't recommend it... to much… May 17, 2026 at 1:37 am
  • Editorial Team
    Editorial Team added an answer You can use FileNameExtensionFilter to filter certain file extension in… May 17, 2026 at 1:37 am
  • Editorial Team
    Editorial Team added an answer Array.indexOf is not supported by Internet Explorer before version 9.… May 17, 2026 at 1:37 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I would like to write an Android application that can be activated by sending
I would like to write a client application for Android that uses the Google
I would like to write an app on Android to upload my GPS location
I am creating lists in my android app and would like to capture the
I'd like to be able to compile an Android app on my desktop, upload
I need to write an application that sends data to the Google App Engine
I'm trying to write a basic augmented reality app in Android, but I'm running
I would like to retrieve the incoming call's phonenumber and do something with it
Is there anyone using git in such a fashion? I would like to distribute
I'm building a Webapp that uses OpenId to authenticate users, like Stackoverlfow does. There

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.