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); … Read more

How to show a dialog to confirm that the user wishes to exit an Android Activity?

I’ve been trying to show a “Do you want to exit?” type of dialog when the user attempts to exit an Activity. However I can’t find the appropriate API hooks. Activity.onUserLeaveHint() initially looked promising, but I can’t find a way to stop the Activity from finishing. 11 Answers 11

How do I disable orientation change on Android?

I have an application that I just would like to use in portrait mode, so I have defined android:screenOrientation=”portrait” in the manifest XML. This works OK for the HTC Magic phone (and prevents orientation changes on other phones as well). But I have a problem with the HTC G1 phone as I open the hardware … Read more

Activity, AppCompatActivity, FragmentActivity, and ActionBarActivity: When to Use Which?

I’m coming from iOS where it’s easy and you simply use a UIViewController. However, in Android things seem much more complicated, with certain UIComponents for specific API Levels. I’m reading BigNerdRanch for Android (the book is roughly 2 years old) and they suggest I use Activity to host my FragmentActivities. However, I thought Activity was … Read more

Android Shared preferences for creating one time activity (example) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for Stack Overflow. Closed 5 years ago. Improve this question I have three activities A,B and C where A and B are forms and after filling and saving the … Read more