Tag: android

Playing short .wav files – Android

I would like to play sound after touching the button. MediaPlayer works fine, but I read somewhere that this library is for long .wav (like music). Is there any better way to play short .wav(2-3 sec.)?

GoogleAuthException when obtaining an access token with ClientID

For more context, this post follows this one. To solve my previous problem, I tried to follow the solution presented here by Tim Bray: Verifying Back-End Calls from Android Apps I declared two projects in Google APIs Console to get two Client IDs The first as “Web Application” with “localhost” as hostname (does it matter?) […]

How to achieve a full-screen dialog as described in material guidelines?

Material guidelines describe the behavior of a full-screen dialog (https://www.google.com/design/spec/components/dialogs.html#dialogs-full-screen-dialogs). How can I achieve this in practice? I can’t find a meaningful tutorial or sample! Thanks.

Get activity instance

Excuse me for simple question,I’m completely beginner java and android developer. How I can get the instance of Activity in setCameraDisplayOrientation when surfaceChanged is called? public class MyActivity extends Activity { private Camera mCamera; private CameraPreview mPreview; public final int cameraId = 0; public Activity activity = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); […]

Android MultiSelectListPreference, java.lang.String cannot be cast to java.util.Set

I try to implement MultiSelectListPreference for my settings view: <MultiSelectListPreference android:title=”@string/title” android:summary=”@string/message” android:key=”pref_foobar” android:defaultValue=”@array/empty_array” android:entries=”@array/fooArray” android:entryValues=”@array/fooValues” /> The array: <resources> <string-array name=”fooArray”> <item>Foo</item> <item>Bar</item> </string-array> <string-array name=”fooValues”> <item>foo_value</item> <item>bar_value</item> </string-array> <string-array name=”empty_array”/> </resources> However this gives me following exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myproject/.SettingsActivity}: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Set Full stacktrace: http://pastebin.com/kBDByXY5 […]

Can I force the Android Back button to go two steps back in the Activity stack?

I know that I can override the onKeyDown method, but I want Back to do it’s thing, just twice!

Android Virtual Device – Armeabi-v7a vs x86_64

I want to make my own Android application. I am using Ubuntu 64bit and IntelliJ. In Virtual Device Configuration, it asks me to choose a system image. All of the options have a Download beside, which means I haven’t downloaded any system image. There are 3 options available for Lollipop(API level 21), which are Armeabi-v7a, […]

Programatically starting the 'Add Account' activity in Android 2.2

I’ve been experimenting with the Android SDK over the past few days, in readiness to write an App for the store, however I’ve run across a bit of a problem. The App I’ll be writing requires that the user has a Google account associated with the phone. Retreiving and making use of the Auth token […]

How to transfer “data” between two device (android,iphone)?

How can i transfer data between two device? I would like to transfer data (mostly image file) between different platforms (android,iphone). Is it possible to use p2p or should i use client-server? Any help will be appreciated.

Android Studio Git Push Rejected

I’m trying to uploading my Android Project on github but I get this error when I try to push: Push rejected: Push to origin/master was rejected I made this steps: VCS->Import into version control->Create new repository… From the git bash in Project folder: git remote add origin https://github.com/[username]/[project_name].git Git->Add Git-> Commit directory Git-> Push

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