overlay two images in android to set an imageview

I am trying to overlay two images in my app, but they seem to crash at my canvas.setBitmap() line. What am I doing wrong? private void test() { Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.t); Bitmap mBitmap2 = BitmapFactory.decodeResource(getResources(), R.drawable.tt); Bitmap bmOverlay = Bitmap.createBitmap(mBitmap.getWidth(), mBitmap.getHeight(), mBitmap.getConfig()); Canvas canvas = new Canvas(); canvas.setBitmap(bmOverlay); canvas.drawBitmap(mBitmap, new Matrix(), null); canvas.drawBitmap(mBitmap2, […]

How to pass data from 2nd activity to 1st activity when pressed back? – android

I’ve 2 activities, Activity1 and Activity2. In Activity1 I’ve a Button and TextView. When the button is clicked Activity2 is started. In Activity2 I’ve an EditText. I want to display the data retrieved from EditText in Activity2 in the TextView in Activity1 when back is pressed from Activity2. can someone help me with the code […]

Lollipop : draw behind statusBar with its color set to transparent

I have set my statusBar color to transparent for Lollipop only with the following line in my theme : <item name=”android:statusBarColor”>@android:color/transparent</item> Now I need to draw behind it, but I can’t get any view draw behind it. I know how to do it with the windowTranslucentStatus property, but don’t want to use this property since […]

Change Author template in Android Studio

I want to change the automatic author that appears when I create a file in AndroidStudio. /** * Created by a556520 on 16/01/14. */ public class POI { The author takes ‘a556520’ but I want that appears my name, and not the number of employee. Is that possible? I didn’t find in the settings.

Measuring text width to be drawn on Canvas ( Android )

Is there a method which returns the width ( in pixels ) of a text to be drawn on an Android canvas using the drawText() method according to the Paint used to draw it?

Getting activity from context in android

This one has me stumped. I need to call an activity method from within a custom layout class. The problem with this is that I don’t know how to access the activity from within the layout. ProfileView public class ProfileView extends LinearLayout { TextView profileTitleTextView; ImageView profileScreenImageButton; boolean isEmpty; ProfileData data; String name; public ProfileView(Context […]

File Upload in WebView

I have been struggling to upload files from WebView since last few days and there is no progress. I googled and implemented all suggested solutions but none works, like: solutions suggested here – Android webview, file input field filechooser doesn't show up…, http://blog.tourizo.com/2009/02/how-to-display-local-file-in-android…. and so on. Problem: I have a HTML page with the following […]

How to obtain Signing certificate fingerprint (SHA1) for OAuth 2.0 on Android?

I’m trying to register my android app following the steps in https://developers.google.com/console/help/#installed_applications which leads me to follow http://developer.android.com/tools/publishing/app-signing.html. However, I’m not sure how to get the signing certificate fingerprint (SHA1). I first used the Eclipse ADT plugin to export and create the keystore/key. Then, I tried doing keytool -list keystore mykeystore.keystore and it gives me […]

Get Android Device Name

How to get android device name? I am using HTC desire. When I connected it via HTC Sync the software is displaying the Name ‘HTC Smith’ . I would like to fetch this name via code. How is this possible in android? Thanks

How to put space character into a string name in XML?

i have defined some strings in the strings.xml file. Now I need to put some extra space between some numbers in the string. When I type extra space characters this is not showing on the application though. Before: <string name=”spelatonertext3″>-4, 5, -5, 6, -6, And if I put extra space like this: <string name=”spelatonertext3″>-4, 5, […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.