How to send synthesized MotionEvent through the system?

I know how to “synthesize” a MotionEvent: event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_DOWN, x, y, 0); What I am stuck at is how to “send/post/fire/distribute” it through the system, so that it is handled “as if” a real user actually touched the screen with his or her finger. Is this possible at all? If so, how […]

StaggeredGridLayoutManager and moving items

I have created a very simple project, displaying 28 images with StaggeredGridLayoutManager by recyclerview. but as I scroll the recyclerview it moves items for example from left to right or swap the column of left and right. codes: import java.util.ArrayList; import java.util.List; import android.app.Activity; import android.os.Bundle; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.StaggeredGridLayoutManager; public class MainActivity extends Activity […]

Android — How to allow horizontal and vertical scrolling

There is the ScrollView that allows only vertical scrolling, and the HorizontalScrollView that allows only horizontal scrolling, but no class for both. This seems like a pretty gaping deficit in the Android UI. Any tricks to allow this?

Android RatingBar showing more than 5 stars

I want to show a rating bar via an alert dialog in my android app. The problem I am facing is that depending upon the width of the screen, the ratingbar shows more than 5 stars(upto 10) in landscape mode and the function setNumStars() has no effect. There are posts already dealing with this issue […]

Unable to find header files – Android NDK

i’m wrapping a native API to Android by NDK. But when building it don’t find the header files. I have the following structure. project/jni Android.mk LOCAL_PATH := $(call my-dir) include $(call all-subdir-makefiles) LOCAL_PATH :=/home/marcos/dev/workspace/rmsdk.native.wraper/jni include $(CLEAR_VARS) LOCAL_LDLIBS := -llog LOCAL_MODULE := ndk1 LOCAL_SRC_FILES := native.c DelegateDRMProcessorClient.cpp LOCAL_STATIC_LIBRARY := adept cryptopenssl dp expat fonts hobbes jpeg […]

What is a Full Android Database Helper class for an existing SQLite database?

I’m trying to deploy an application with an existing SQLite database. I’ve read through and attempted to implement several samples online however I’ve found that they are always missing some code and either do not compile or work as advertised. Does anyone have a Full Android Database Helper class for deploying an existing SQLite database […]

Get all subscribed topics from firebase cloud messaging

Using the new FirebaseMessaging it’s easy to un/subscribe to topics via: FirebaseMessaging.getInstance().subscribeToTopic(); FirebaseMessaging.getInstance().unsubscribeFromTopic(); But is there any way to get all topics the current installation is subscribed to ?

set orientation of android camera started with intent ACTION_IMAGE_CAPTURE

I’m working at an application in android which uses camera to take photos.For starting the camera I’m using an intent ACTION_IMAGE_CAPTURE like this: Intent camera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); File image=new File(Environment.getExternalStorageDirectory(),”PhotoContest.jpg”); camera.putExtra(MediaStore.EXTRA_OUTPUT,Uri.fromFile(image)); imageUri=Uri.fromFile(image); startActivityForResult(camera,1); public void onActivityResult(int requestCode, int resultCode, Intent data){ super.onActivityResult(requestCode, resultCode, data); switch(requestCode){ case 1: if (resultCode == Activity.RESULT_OK) { selectedImage = […]

Remove space between buttons in LinearLayout (Android)

I need to make my own toolbar in Android application. Now it looks like this: So you see spaces between buttons. I tried to put negative margin/padding at buttons, but space didn’t disappear. Here is layout code: <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:orientation=”vertical” > <ListView android:id=”@+id/routes_list” android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:layout_weight=”0.5″> </ListView> <TableRow android:id=”@+id/toolbar” android:layout_width=”fill_parent” […]

Eclipse and Android XML layouts gives “'default' is not a best match for any device/locale combination”

This is my first time making an app with XML layouts. In the past I have always dynamically generated my layouts at runtime, so don’t worry, I am NOT an Android newbie. Still, this is my first time with static layouts. So what’s this message all about? [2010-09-22 20:43:23 – Rockport] ‘default’ is not a […]

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