resize image from file

I am uploading an image to a server and before that happens, I would like to resize the image dimensions. I get the image with a URI like this: Constants.currImageURI = data.getData(); this is the call to upload the image: String response = uploadUserPhoto(new File(getRealPathFromURI(Constants.currImageURI))); public String uploadUserPhoto(File image) { DefaultHttpClient mHttpClient; HttpParams params = […]

Android 4.0.4 MediaPlayer prepare issue using RTSP urls

I am experiencing an odd issue with a video streaming application I am working on. The actual streaming of video/audio is working fine on all of my test devices. However, on seemingly any device 4.0+, when using an RTSP URL, prepare() returns instantly (this causes an issue providing proper feedback to the users while a […]

Starting an Android Activity from a static method

I want to start an activity from a static java method on an android device. I do not have any context or anything passed as parameter to the static function. For starting the activity I must call “startActivity” with the current running method as “this” pointer. So is there a way to get the current […]

How to detect whether android app is running UI test with Espresso

I am writing some Espresso tests for Android. I am running in the the following problem: In order for a certain test case to run properly, I need to disable some features in the app. Therefore, in my app, I need to detect whether I am running Espresso test so that I can disable it. […]

Authenticate my “app” to Google Cloud Endpoints not a “user”

What I’m trying to do is to authenticate my Android app to the Google Cloud Endpoint. Basically the endpoints should only allow my Android app to access the methods and nothing else. I have done these things – Create a client id using my SHA1 value in Eclipse in the Google Cloud Console. Create a […]

Solving “Package manager has died” RuntimeException

I have an Android app that should list all installed apps on a device (no root). I have tried both getInstalledApplications(0) and getInstalledPackages(0) methods of PackageManager, but on some devices, which do apparently have too many apps installed, I’m getting “Package manager has died” RuntimeException (I receive them via error reporting service of Google Play). […]

how to get bitmap information and then decode bitmap from internet-inputStream?

background suppose i have an inputStream that was originated from the internet of a certain image file. i wish to get information about the image file and only then to decode it. it’s useful for multiple purposes, such as downsampling and also previewing of information before the image is shown. the problem i’ve tried to […]

How to implement onBackPressed() & intents in fragment?

I know that onBackPressed() is a method in activity but, I want to use the functionality in fragments such that when back button is pressed, it gets redirected to another activity via Intent. Is there any solution to this ? public class News_Events_fragment extends Fragment { ProgressDialog pd; ListView lv1; SharedPreferences sharedPreferences = null; int […]

Android drawable with parameters

Is it possible to have something like drawable/myshape.xml <shape xmlns:android=”http://schemas.android.com/apk/res/android” android:shape=”rectangle”> <solid android:color=”{0}” /> </shape> and then from java class take this drawable passing values for parameters. Something like Drawable myshape = ???.getDrawableWithParameters(R.drawable.myshape, 0x00ff00);

“Content has view with id attribute 'android.r.id.list' that is not a ListView Class.” when create a list view in a fragment

Here is the problem. I have a list view, and it looks fine in the building, but it broke the error. Content has view with id attribute ‘android.r.id.list’ that is not a ListView Class. I haven’t added the listview into the XML, something like :@android:list, the reason I didn’t do that is I could find […]

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