Tag: android

RecyclerView : get position and switch to activity

How is it possible to get the position of the item which was clicked in the RecyclerView row and than make a intent to an activity in the onClick method ? Here is my adapter: public class SergejAdapter extends RecyclerView.Adapter<SergejAdapter.MyViewHolder>{ private LayoutInflater inflater; List<Information> data= Collections.emptyList(); public SergejAdapter(Context context, List<Information> data){ inflater = LayoutInflater.from(context); this.data=data; […]

Speed up 'Navigation Drawer' animation speed on closing?

Implemented and working as expect, as such there really is no code that is worth posting here, simply looking to find out if anyone has experience with speeding up the time it takes the drawer to open and close? The YouTube app for instance is much faster!

Android avd is off-screen

When I run my Android app in Eclipse I can see the emulator on the toolbar but the window appears to be off the screen. Clicking on the icon in the toolbar makes it flash in or out from the right but I cannot see it. I have had this problem before but I cannot […]

need help changing my package name in eclipse

so my package name is com.soundboard right now. obviously this name is taken…I am having trouble changing it throughout the package name. I checked a few posts here and did the refactor > rename and changed it to a more original name. When I tried to upload the new .apk I got the same message […]

ExpandableListView – keep selected child in a “pressed” state

I’m using an ExpandableListView in a left nav for a tablet screen. When a user presses a child of a group in my expandable list, I’d like to keep the child in the pressed state so that the user knows for which child the right hand content is being shown for. For a ListView, I […]

SharedPreferences.getInt() results in ClassCastException – Why?

I have a simple (not user-editable) numerical setting defined in a preferences XML as follows: <EditTextPreference android:key=”@string/numeric_val” android:defaultValue=”0″ /> And I read it using this simple statement: sharedPrefs.getInt(getString(R.string.numeric_val), 3) It works, but when I try to read it, for the first time after application install, it generates a ClassCastException. The documentation says that getInt() “Throws […]

Set menus for multiple toolbars on android

In my activity I use the following code for my two toolbars. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Creating The Toolbar and setting it as the Toolbar for the activity toolbar = (Toolbar) findViewById(R.id.tool_bar); setSupportActionBar(toolbar); getSupportActionBar().setTitle(“My title”); toolbar2 = (Toolbar) findViewById(R.id.tool_bar_bottom); setSupportActionBar(toolbar2); … } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate […]

Android SearchView.OnQueryTextListener OnQueryTextSubmit not fired on empty query string

I am using Android 4.1.2. I have a SearchView widget on an ActionBar. Documentation on SearchView.OnQueryTextListener from the android developer site states that onQueryTextSubmit is fired when “Called when the user submits the query. This could be due to a key press on the keyboard or due to pressing a submit button.” This does not […]

getActionBar().setDisplayHomeAsUpEnabled(true); throws NullPointerException on new activity creation (Google – Basic Tutorial)

I am following this tutorial and getting a NullPointerException at the onCreate method of the DisplayMessageActivity at this block of code: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // Show the Up button in the action bar. getActionBar().setDisplayHomeAsUpEnabled(true); //Exception here } I am running the app at an emulator following the NexusOne AVD template. When I click […]

Android Studio SDK version error after update

I just finished installing Android Studio and the JDK. Everything worked fine while I looked around the new interface. No errors or anything. After I checked for updates I went from version 0.5.2 to 0.6. When I restarted I got the error Error:The SDK Build Tools revision (19.0.3) is too low for project ‘:app’. Minimum […]

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