Tag: android-activity

Start another activity by clicking a button

So heres my problem. I set up a button that when clicked should open a new activity but when it is clicked I receive an error: Unfortunately “app_name” has stopped working my logcat says :Fatal Exception Main So heres my xml: <?xml version=”1.0″ encoding=”utf-8″?> <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”match_parent”> <TextView android:id=”@+id/textView1″ android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_alignParentLeft=”true” android:layout_alignParentTop=”true” android:layout_marginLeft=”30dp” […]

how to send value through intent after finishing an activity

I have an activity that shows a gridview of items. when I click in any of them, I move to another activity showing the information of the item. I also have the option to go back (gridview activity) or delete it. If I delete it, I need to refresh the gridview, so I need to […]

How to auto scroll up Recycler view in Android?

I have developed some chat application where i can send and received messages. But the problem is whenever i send or receive messages the recycler view is not scrolling to top so that messages gets diplayed above the keypad. I have used the above mentioned recycler view android.support.v7.widget.RecyclerView.

Go to home screen instead of previous Activity

I know this question has been asked many times before, but any of the solution is not working and my situation is a little bit different. I’ve an Activity which can be called from many different Activities. But I want when the user presses back button, instead of previous activity, app should go to Home […]

Android Show Activity Title/status bar at the top after it is hidden

Currently in my FragmentActivity, I hide the status bar by, in the onCreate method, doing the following: requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); this works no problem. But in full screen, say user clicks a button, I will want to swap in another fragment (remember we are in FragmentActivity), I mean replacing the currently fragment that is displayed in […]

android – how to find the name of the main activity of an application?

For example, I want to start gmail in code/command line, but I don’t know its main activity name. am start -n com.google.android.gm/.XXXXX It’s available through decompiling the apk, but it’s difficult. Thanks.

Extending class for activity

I’m totally new to Android (Java) Development and I’m so excited about it! The developers guide of Google is fantastic and I learned a lot in a small time. It even keeps me awake during the night 😉 Today I went through making menu’s and there’s something that I can’t understand. It’s about extending classes. […]

Activity screen not rotating when I rotate mobile

I have used this code as @gnobal posted on https://stackoverflow.com/a/2700683/1556329 and it works great. But my issue is that I have found that when I apply Theme.Transparent the activity does not goes to landscape mode when I rotate the mobile phone. Theme: <style name=”Theme.Transparent” parent=”android:Theme.Dialog”> <item name=”android:windowIsTranslucent”>true</item> <item name=”android:windowBackground”>@android:color/transparent</item> <item name=”android:windowContentOverlay”>@null</item> <item name=”android:windowNoTitle”>true</item> <item name=”android:windowIsFloating”>true</item> […]

Android: How to have a shared menu in each (List) Activity without re-writing the overridden methods?

I know that Android provides some useful methods to be overridden in order to define a menu: @Override public boolean onCreateOptionsMenu(Menu menu) { menu.add(0, AIS, 0, “Activity Inventory Sheet”).setIcon(android.R.drawable.ic_menu_upload); // … return true; } public boolean onOptionsItemSelected(MenuItem item) { Intent i; switch (item.getItemId()) { case AIS: i = new Intent(this, ActivityInventorySheet.class); startActivity(i); return true; // […]

How to get back the result from Child activity to Parent in android?

I’am starting a child activity on click of a button from Parent. And i’am calculating some result (of type string) in child activity and finishing the child to come back to Parent. Is there any better way to get that result in Parent using intents or extras? (I can get that result in Parent by […]

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