android dialog activity position

I created an non-maximized activity using android:theme=”@android:style/Theme.Dialog” to make it looks like a dialog. I need to change the position of the activity on screen but I didn’t find how to do this…

Find missing onError in the project

I am trying to locate a missing onError() in a project. It means that the app crashes because a subscription does not handle the throwables so I want to locate that subcription and add the onError method. Unfortunatelly the stacktrace is not really helpful here and it only shows the line of the throw new […]

How to exclude transitive dependencies of other subproject in multiproject builds?

In Build.scala I have a dependency between projects: val coreLib = Projects.coreLib() val consoleApp = Projects.consoleApp().dependsOn(coreLib) val androidApp = Projects.androidProject().dependsOn(coreLib/*, exclusions = xpp */) Core library project defines a library in its libraryDependencies (XPP parser), which I want to exclude in androidApp, since Android framework have its own XPP implementation out of the box. How […]

IllegalArgumentException: Failed to find configuration root that contains xxx on FileProvider.getUriForFile

I have been trying to follow the Android tutorial on sharing files. I set up the FileProvider like this: On the main manifest xml: <provider android:name=”android.support.v4.content.FileProvider” android:authorities=”com.example.mysecondapp.fileprovider” android:exported=”false” android:grantUriPermissions=”true” > <meta-data android:name=”android.support.FILE_PROVIDER_PATHS” android:resource=”@xml/filepaths” /> </provider> the res/xml/filpaths.xml file: <paths xmlns:android=”http://schemas.android.com/apk/res/android”> <external-path name=”myexternalimages” path=”SpCars_album/” /> </paths> And in my code I am trying the following: File […]

findViewById retrurns wrong element?

I can’t understand why findViewById returns the wrong element, here is the class: public class EventDetailsFragment extends FragmentActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.event_details); Log.d(“First”, findViewById(R.id.tuxtView1).getClass().toString()); Log.d(“Second”, findViewById(R.id.tuxtView2).getClass().toString()); Log.d(“Third”, findViewById(R.id.imageView1).getClass().toString()); } } And here is the xml: <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”match_parent” android:background=”@color/green” android:orientation=”horizontal” android:paddingLeft=”10dp” android:paddingRight=”10dp” android:paddingTop=”10dp”> <RelativeLayout android:id=”@+id/relativeLayout1″ android:layout_width=”0dp” android:layout_height=”175dp” android:layout_gravity=”center_horizontal” android:layout_weight=”1″ […]

android: how can I verify, that device support multitouch?

How can I verify, that device support multitouch event? If device have resistent display, multitouch is not possible. Is that way to find out, what kind of display is in device, or if device support multitouch? Thanks.

Copy text from TextView on Android

I have a ListView where each item is a TextView. I want to enable the long press behaviour similar to an EditText that displays the default context menu with items like “Select all”, “Cut all”, “Copy all”, etc. Is there an easy way to enable this for a TextView?

With SAX Parser, get an attribute's value

I am parsing XML from the web using Android. The code below shows a sample of the XML. The problem I’m having is I can’t get the string value of the item tag. When I use name = attributes.getQName(i); it outputs the name, not the value of the attribute. <weatherdata> <timetags> <item name=”date”> <value>20/04/2012</value> <unit/> […]

RelativeLayout add rule “RelativeLayout.LEFT_OF” not working

I have a relativeLayout like below: <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:orientation=”horizontal” android:id=”@+id/parent” > <ListView android:layout_width=”360dp” android:layout_height=”600dp” android:id=”@+id/list” android:inputType=”text” android:maxLines=”1″ android:layout_margin=”50dp” android:layout_alignParentRight=”true” /> </RelativeLayout> In the java code, I want to add a view to the left of the listview, but it didn’t worked: m_relativeLayout = (RelativeLayout)findViewById(R.id.parent); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT); layoutParams.addRule(RelativeLayout.LEFT_OF, m_listView.getId()); Button button2 […]

How to preserve scroll position in an ExpandableListView

in my app I have a class derived from ExpandableListActivity. When I scroll the contents, and then change phone orientation or edit an item and then go back to the list, the original list position is not preserved. I have tried two solutions, similar to those I have recently successfully used with ListActivity-derived classes. Solution […]

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