Top "Android-activity" questions

Questions about creating or managing Activities in Android.

onSaveInstanceState () and onRestoreInstanceState ()

I'm trying to save and restore the state of an Activity using the methods onSaveInstanceState() and onRestoreInstanceState(). The problem is …

android android-activity states
Best way to add Activity to an Android project in Eclipse?

When adding an activity to an existing Android project, I manually create a new class - is that the best / …

android eclipse ide android-activity
How to define dimens.xml for every different screen size in android?

When supporting different screen sizes (densities) in Android often the focus is on creating different layouts for every possible screen. …

android android-layout android-activity android-screen-support
How do I pass an object from one activity to another on Android?

I need to be able to use one object in multiple activities within my app, and it needs to be …

android object android-activity
getActivity() returns null in Fragment function

I have a fragment (F1) with a public method like this public void asd() { if (getActivity() == null) { Log.d("yes","…

android android-fragments android-activity null android-context
Use Toast inside Fragment

I'm trying to show a Toast Message when user click on a Button inside a Fragment. The problem is I …

android android-fragments android-activity toast
How can I return to a parent activity correctly?

I have 2 activities (A and B) in my android application and I use an intent to get from activity A …

android android-intent android-activity parent
How to have Android Service communicate with Activity

I'm writing my first Android application and trying to get my head around communication between services and activities. I have …

android android-activity android-service
Android Call an method from another class

I know that this Question is repeated but I can't find the answer in Internet. I want to call a …

java android class android-activity call
Android. Fragment getActivity() sometimes returns null

In developer console error reports sometimes I see reports with NPE issue. I do not understand what is wrong with …

android android-fragments android-activity android-asynctask nullpointerexception