Tag: android-activity

One Activity and all other Fragments

I am thinking of implementing one screen with Activity and all other sreens with Fragments and managing all the fragments thru the activity. Is it a good idea? and my answer is NO but still I want to know more clearly about this thought. What are the pros and cons of the idea? Note: Please […]

Same Navigation Drawer in different Activities

I made a working navigation drawer like it’s shown in the tutorial on the developer.android.com website. But now, I want to use one Navigation Drawer, i created in the NavigationDrawer.class for multiple Activities in my Application. My question is, if anyone here can make a little Tutorial, which explains, how to use one Navigation drawer […]

How to change title of Activity in Android?

I am using Window w = getWindow(); w.setTitle(“My title”); to change title of my current Activity but it does not seem to work. Can anyone guide me on how to change this?

How to return a result (startActivityForResult) from a TabHost Activity?

I have 3 classes in my example: Class A, the main activity. Class A calls a startActivityForResult: Intent intent = new Intent(this, ClassB.class); startActivityForResult(intent, “STRING”); Class B, this class is a TabActivity: Intent intent = new Intent(this, ClassC.class); tabHost.addTab… Class C, this class is a regular Activity: Intent intent = this.getIntent(); intent.putExtra(“SOMETHING”, “EXTRAS”); this.setResult(RESULT_OK, intent); […]

How do I pass data between Activities in Android application?

I have a scenario where, after logging in through a login page, there will be a sign-out button on each activity. On clicking sign-out, I will be passing the session id of the signed in user to sign-out. Can anyone guide me on how to keep session id available to all activities? Any alternative to […]

Android: Clear the back stack

In Android I have some activities, let’s say A, B, C. In A I use this code to open B: Intent intent = new Intent(this, B.class); startActivity(intent); In B I use this code to open C: Intent intent = new Intent(this, C.class); startActivity(intent); When the user taps a button in C I want to go […]

How do I restart an Android Activity

How do I restart an Android Activity? I tried the following, but the Activity simply quits. public static void restartActivity(Activity act){ Intent intent=new Intent(); intent.setClass(act, act.getClass()); act.startActivity(intent); act.finish(); }

How to send an object from one Android Activity to another using Intents?

How can I pass an object of a custom type from one Activity to another using the putExtra() method of the class Intent?

How to start new activity on button click

In an Android application, how do you start a new activity (GUI) when a button in another activity is clicked, and how do you pass data between these two activities?

Clear the entire history stack and start a new activity on Android

Is it possible to start an activity on the stack, clearing the entire history before it? The situation I have an activity stack that either goes A->B->C or B->C (screen A selects the users token, but many users only have a single token). In screen C the user may take an action which makes screen […]

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