Immediate App Crash, whenever single line of code is added - android

Here is a class that works perfectly until I wanted to add one more feature, The code compiles then crashes immediately upon execution. The problem lies with the componentAnalyzer class that I wish to implement in this class. I donĀ“t know why it won't work because I implemented this componentAnalyzer in another class in the exact same way and it works beautifully.
I think its a small mistake but unsure. I commented out the part that was creating problems because the rest works and should not be touched.
The method that will use the componentAnalyzer is at the end of the code. I cut out everything that was working in order to see it easier.
public class PowerMonitorActivity extends Activity implements SeekBar.OnSeekBarChangeListener {
private static boolean instantiated = false;
//private static ComponentAnalyzer componentAnalyzer;
//private Context context;
private Button changeGPSButton;
private Button changeAudioButton;
private Button locationUpdateButton;
private SeekBar brightnessSeekBar;
private int screenBrightness = 123;
private Handler cpuHandler = new Handler();
private CPUMonitor cpuMonitor = new CPUMonitor();
private int updateTime = 1000;
private Handler totalPowerHandler = new Handler ();
private MediaManager mediaManager = new MediaManager();
private boolean requestingLocation = false;
private boolean wifiIsTransmitting = false;
private boolean wifiIsConnected = false;
private boolean cellIsTransmitting = false;
private boolean cellIsConnected = false;
private boolean isLogging = false;
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//Bundle extras = getIntent().getExtras();
if (!instantiated) {
instantiated = true;
//componentAnalyzer = new ComponentAnalyzer(context, extras);
}
// Create GPS button - note that location settings cannot be changed directly
// in a program. Rather, a settings screen is shown when this button is pressed.
changeGPSButton = (Button)findViewById(R.id.changeGPS);
changeGPSButton.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
showGPSOptions();
}
});
totalPowerHandler.removeCallbacks(updatePower);
totalPowerHandler.postDelayed(updatePower, 1000);
}
private Runnable updateCpu = new Runnable() {
public void run() {
float util = cpuMonitor.getUtil();
int rutil = Math.round(100*util);
TextView cpuTextView = (TextView)findViewById(R.id.cpuTextView);
cpuTextView.setText(rutil+"%");
cpuHandler.postDelayed(this, updateTime);
}
};
private Runnable updatePower = new Runnable()
{
public void run()
{
//float testPower = componentAnalyzer.getWifiPower();;
TextView totalPowerView = (TextView)findViewById(R.id.totalPowerTextView);
//totalPowerView.setText(testPower+"mW");
totalPowerHandler.postDelayed(this, 1000);
}
};

Did you initialize context? In the current code example context is null when the ComponentAnalyzer is instantiated.

For my point of view, your application context is null (you forgot to assign reference to context for current activity or application)
Remove comments for problematic lines,
Now look at these lines,
Bundle extras = getIntent().getExtras();
if (!instantiated) {
instantiated = true;
componentAnalyzer = new ComponentAnalyzer(context, extras); // Here context is null
}
change this according to given below,
Bundle extras = getIntent().getExtras();
if (!instantiated) {
instantiated = true;
if(extras != null)
componentAnalyzer = new ComponentAnalyzer(PowerMonitorActivity.this, extras);
else Log.e("PowerMonitorActivity","Bundle extras is null");
}

Related

Try to refresh my view from a Thread but it give me an error

This is my problem: I'm trying to add a element in my activity from a thread but it don't works.
This is my activity code :
public class AireDeJeu extends AppCompatActivity {
private final static int mObjectif = 100;
private int mProgression = 0;
private ImageView trou1, trou2, trou3, trou4, trou5, trou6, trou7, trou8, trou9, trou10, trou11, trou12;
#Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.aire_de_jeu);
trou1 = (ImageView)findViewById(R.id.trou1); trou2= (ImageView)findViewById(R.id.trou2); trou3 = (ImageView)findViewById(R.id.trou3);
trou4 = (ImageView)findViewById(R.id.trou4); trou5 = (ImageView)findViewById(R.id.trou5); trou6 = (ImageView)findViewById(R.id.trou6);
trou7 = (ImageView)findViewById(R.id.trou7); trou8 = (ImageView)findViewById(R.id.trou8); trou9 = (ImageView)findViewById(R.id.trou9);
trou10 = (ImageView)findViewById(R.id.trou10); trou11 = (ImageView)findViewById(R.id.trou11); trou12 = (ImageView)findViewById(R.id.trou12);
trou1.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
}
});
/*
*
* I clear my 11 other onClickListener to be more clear.
*
*/
GenerateurPartie generateurPartie = new GenerateurPartie(niveau);
}
public void setPersonnage(int pId, int pRes){
ImageView perso = (ImageView)findViewById(pId);
perso.setImageResource(pRes);
}
}
It call my next class : "GenerateurPartie" where I start my Thread:
public class GenerateurPartie extends GenerateurPerso{
private int mNiveau;
public static int mAvancement = 0;
private int mDelai;
private Thread mThread;
private Perso mPerso;
private final HandlerDelai handlerDelai = new HandlerDelai();
protected static PlacementPerso mPlacementPerso = new PlacementPerso();
public GenerateurPartie(int pNiveau) {
this.mNiveau = pNiveau;
this.mDelai = 2500;
mPlacementPerso.PlacementPerso();
mThread = new Thread(new Runnable() {
#Override
public void run() {
try {
int i = 0;
while (mAvancement < 100) {
i += 1;
if (mAvancement >= 80)
mDelai = mDelai / 2;
Thread.sleep(mDelai);
handlerDelai.postDelayed(new Runnable() {
#Override
public void run() {
mPerso = GenerateurPerso(mNiveau, mAvancement);
mPlacementPerso.aPlacer(mPerso);
}
}, mDelai);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}});
mThread.start();
}
}
I don't show you my class "GenerateurPerso" to clarify my message and because it works great. The next one is my class "PlacementPerso", the logcat error become from it. It extends to my activity "AireDeJeu" :
public class PlacementPerso extends AireDeJeu{
private boolean trou1, trou2, trou3, trou4, trou5, trou6, trou7, trou8, trou9, trou10, trou11, trou12;
private Random r = new Random();
private int random, baseMax, baseMin;
public void PlacementPerso(){
trou1 = true; trou2 = true; trou3 = true; trou4 = true; trou5 = true; trou6 = true; trou7 = true; trou8 = true; trou9 = true; trou10 = true; trou11 = true; trou12 = true;
random = 1; baseMax = 12; baseMin = 1;
}
public void aPlacer(Perso pPerso){
final int ressource = pPerso.getRessource();
// ressource will be like : "R.drawable.img"
random = r.nextInt((baseMax - baseMin) + 1) + baseMin;
int trouId = 0;
switch(random){
case 1:
if(trou1){
trouId = R.id.trou1;
trou1=false;
}
else {
aPlacer(pPerso);
}
break;
/**
*
* To clarify the code again I leave the 11 other case, they do the same thing, just the trouId value change.
*
*/
}
final int pId = trouId;
//This is my problem, it come from here
super.setPersonnage(pId,ressource);
}
I already try a lot of solutions, I replace the super.setPersonnage(pId,ressource); by :
runOnUiThread(new Runnable() {
#Override
public void run() {
Log.d("Perso","Entrer dans runOnUiThread");
ImageView perso = (ImageView)findViewById(pId);
if(perso == null)
Log.d("Perso","L'imageVew pour placer l'image est null !!!!!");
else
Log.d("Perso","L'imageVew pour placer l'image n'est pas null");
perso.setImageResource(ressource);
}
});
But nothing works great. I tryed to add setContentView(R.layout.aire_de_jeu) before the findViewById but it didn't change anything.
(Other thing: when I try this code, the first Log appear but the second or the third don't appear ...)
To finish, this is my logcat:
10-07 11:30:47.758 31782-31782/com.dunomade.ecraseurdetaupe E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.dunomade.ecraseurdetaupe, PID: 31782
java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.Window$Callback android.view.Window.getCallback()' on a null object reference
at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:72)
at android.support.v7.app.AppCompatDelegateImplV7.<init>(AppCompatDelegateImplV7.java:146)
at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:28)
at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:41)
at android.support.v7.app.AppCompatDelegateImplV23.<init>(AppCompatDelegateImplV23.java:29)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:191)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:173)
at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:511)
at android.support.v7.app.AppCompatActivity.findViewById(AppCompatActivity.java:183)
at com.dunomade.ecraseurdetaupe.AireDeJeu.setPersonnage(AireDeJeu.java:136)
at com.dunomade.ecraseurdetaupe.PlacementPerso.aPlacer(PlacementPerso.java:175)
at com.dunomade.ecraseurdetaupe.GenerateurPartie$1$1.run(GenerateurPartie.java:56)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5728)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
It tells the error come from line: 136, here he come:
public void setPersonnage(int pId, int pRes){
ImageView perso = (ImageView)findViewById(pId); //Line 136
perso.setImageResource(pRes);
}
I tryed to see if the problem came from my argument so I did:
public void setPersonnage(int pId, int pRes){
ImageView perso = (ImageView)findViewById(R.id.trou1);
perso.setImageResource(R.drawable.img);
}
But the problem stay the same.
Maybe it's because I try to change the view in the thread ?!
I really hope someone can help me for this problem.
Maye my problem is my class "PlacementPerso" don't works in my thread, but I think it works on it.
Thank's advance =)
In the way to be more clear, I'll try to show you what's happend:
I tryed a lot of possibilities but nothing works. But it help me to find where was really the problem. So I leave some code in the way to be more clear. I hope it'll help you to find a way with me to resolve it.
So this is my Activity:
public class AireDeJeu extends AppCompatActivity {
//I create all my ImageViews outside onCreate
public ImageView trou1, trou2, trou3, trou4, trou5, trou6, trou7, trou8, trou9, trou10, trou11, trou12;
//I make onCreate public to try to get the views later.
#Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.aire_de_jeu);
//I get the view for all ImageView
trou1 = (ImageView)findViewById(R.id.trou1); trou2= (ImageView)findViewById(R.id.trou2); trou3 = (ImageView)findViewById(R.id.trou3);
trou4 = (ImageView)findViewById(R.id.trou4); trou5 = (ImageView)findViewById(R.id.trou5); trou6 = (ImageView)findViewById(R.id.trou6);
trou7 = (ImageView)findViewById(R.id.trou7); trou8 = (ImageView)findViewById(R.id.trou8); trou9 = (ImageView)findViewById(R.id.trou9);
trou10 = (ImageView)findViewById(R.id.trou10); trou11 = (ImageView)findViewById(R.id.trou11); trou12 = (ImageView)findViewById(R.id.trou12);
}
}
Here everything works great, nothing happend wrong. I can set a ressource like trou6.setImageRessource(R.id.img);and it works fine.
After this, I call a new Thread. It contain a random to choose the ImageView and a other random to choose the ressource, it work's every Xs (This is why I use Thread, for use thread.sleep();, to make a laps of time) and it create a message for my handler :
final private PlacementHandler placementHandler = new PlacementHandler();
final int KEY_PLACEMENT_PERSO = 1;
//ressource is like "R.drawable.img1", msg.arg2 is 0 because I don't need it, and viewTrou is the ImageView selected by the random (like trou1, or trou2...)
Message msg = placementHandler.obtainMessage(KEY_PLACEMENT_PERSO,ressource,0,viewTrou);
placementHandler.sendMessage(msg);
And to finish, this is where the probleme is, in my handleMessage :
public class PlacementHandler extends Handler {
#Override
public void handleMessage(Message msg){
super.handleMessage(msg);
//here is the problem, I get a NullPointerException
ImageView perso = (ImageView)msg.obj;
perso.setImageResource(msg.arg1);
}
}
To be sure the problem don't come from my msg.objor my msg.arg1 I did:
public class PlacementHandler extends Handler {
#Override
public void handleMessage(Message msg){
super.handleMessage(msg);
//here is the problem again, my NullPointerException stop my app one more time
trou1.setImageResource(R.drawable.img1);
}
}
This is what I don't understand: I create the ImageViews public outside onCreate, so I can access them in my Handler, but they are empty of view (because the view is created in onCreate). How can I get my ImageView WITH the view inside ?
Maybe the solution is to inflate the layout before to get a new findViewById, I also tryed this way but I don't know how to do...
I hope I'm clear and you understand what's my problem.
Sorry for my english.
Thank's a lot for helping.
PS: I already try to clear the project but nothing happend.

How do update decoview chart with live data?

I have looked at the github resource and also here but I'm unable to get my graph to display live data. Here's my code.
public class Blink_HR extends Fragment {
TextView textView;
LinearLayout linearLayout;
DecoView mDecoView;
private int mBackIndex;
private int mSeries1Index;
private int mSeries2Index;
private int mSeries3Index;
private final float
mSeriesMax = 50f;
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.blink_hr, container, false);
}
#Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
textView = (TextView) getActivity().findViewById(R.id.meditation);
linearLayout = (LinearLayout) getView().findViewById(R.id.blinkHR);
mDecoView = (DecoView)getActivity().findViewById(R.id.dynamicArcView);
mDecoView.addEvent(new DecoEvent.Builder(mSeriesMax)
.setIndex(mBackIndex)
.setDuration(10)
.build());
SeriesItem seriesItem = new SeriesItem.Builder(Color.parseColor("#FFE2E2E2"))
.setRange(0, mSeriesMax, 0)
.setInitialVisibility(true)
.build();
mBackIndex = mDecoView.addSeries(seriesItem);
}
void update(int id, int value) {
String heart = String.valueOf(value);
Log.d("Blink Hai", heart);
if (value > 0 && mDecoView!=null && mSeries1Index!=0) {
SeriesItem seriesItem = new SeriesItem.Builder(Color.parseColor("#FFFF8800"))
.setRange(0, (float)value, 0)
.setInitialVisibility(false)
.build();
mSeries1Index = mDecoView.addSeries(seriesItem);
}
if (mDecoView != null) {
mDecoView.addEvent(new DecoEvent.Builder(42.4f)
.setIndex(mSeries1Index)
.setDelay(3250)
.build());
mDecoView.executeReset();
}
}
}
My update function is called every 1 second and I would expect the graph to update this data in real-time. However all I get is a blimp on the screen.
There is a couple of issues with the code
An event is added to the series mBackIndex before mBackIndex has been initialized
Update is triggered every 1 second but a 3.25 second delay is added to the event before it will be processed
The event on update always sets the DecoView position to 42.4
executeReset() is called every time the update is triggered, this
resets all series in the charts and cancels all pending animations
Here is some sample code that will update a DecoView every 1 second to a random position with animation
public class FauxFitActivity extends AppCompatActivity {
private DecoView mDecoView;
private int mSeries1Index;
private final float mSeriesMax = 50f;
private Handler mHandler = new Handler();
Runnable runnable = new Runnable() {
#Override
public void run() {
update();
mHandler.postDelayed(this, 1000);
}
};
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_faux_fit);
mDecoView = (DecoView) findViewById(R.id.dynamicArcView);
createDataSeries1();
// Start the timer
mHandler.post(runnable);
}
private void createDataSeries1() {
final SeriesItem seriesItem = new SeriesItem.Builder(Color.parseColor("#FFFF8800"))
.setRange(0, mSeriesMax, 0)
.setInitialVisibility(false)
.build();
mSeries1Index = mDecoView.addSeries(seriesItem);
}
private void update() {
final Random rand = new Random();
int newPosition = rand.nextInt((int)mSeriesMax);
mDecoView.addEvent(new DecoEvent.Builder(newPosition).setIndex(mSeries1Index).setDuration(1000).build());
}
}

starting activity from itself skips the OnCreate

I have this activity which is called MainPutShipActivity and I want to start it again so it will do the same thing but it doesn't even enter the OnCreate method.
here is the MainPutShipActivity:
public class MainPutShipActivity extends Activity implements OnClickListener{
private static final int MAX = 10;
private String name1,name2;
private Player plr = new Player();
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_put_ship);
Intent intent = getIntent();
plr = (Player) intent.getSerializableExtra("player");
name1 = plr.getName1();
name2 = plr.getName2();
}
public void finished() {
Intent in;
}
if (plr.isTreated() == false) {
plr.setArr1(arr);
plr.setShip1(ships);
this.finish();
in = new Intent(this,MainPutShipActivity.class);
in.putExtra("player", this.plr);
}
else {
plr.setArr2(arr);
plr.setShip2(ships);
in = new Intent(this, MainGameActivity.class);
in.putExtra("player", this.plr);
}
plr.setTreated(true);
this.finish();
startActivity(in);
}
When i enter the finished() procedure for the first time it suppose to start the MainPutShipActivity again but when it starts the activity, it skips the onCreate and goes straight to the finished() method for some reason.
I would be very glad for any kind of help.
Pay attention to the key passed in the intent
Instead of :
plr = (Player) i.getSerializableExtra("plr");
set
plr = (Player) i.getSerializableExtra("player");
because you are setting
in.putExtra("player", this.plr);

When Orientation change,onSaveInstanceState call caused values Swap

I have two variables to save on device orientation. One is current question number as an integer, another is a boolean value if the user cheated. It working fine when I'm storing and retrieving sinle value while storing both value it swaps.
public class QuizActivity extends ActionBarActivity {
// Logging members
private static final String LOG_TAG = QuizActivity.class.getSimpleName();
// The member of Saving the state for rotation of the device
private static final String KEY_BOOLEAN = "index";
private static final String KEY_INT = "index";
// Adding members
private Button mTrueButton;
private Button mFalseButton;
private Button mNextButton;
private Button mBackButton;
private TextView mQuestionTextView;
private ImageButton mImgRightButton;
private ImageButton mImgLeftButton;
private Button mCheatButton;
private TrueFalse[] mQuestionBank = new TrueFalse[] {
new TrueFalse(R.string.question_oceans, true),
new TrueFalse(R.string.question_mideast, false),
new TrueFalse(R.string.question_africa, false),
new TrueFalse(R.string.question_americas, true),
new TrueFalse(R.string.question_asia, true)
};
private int mCurrentIndex = 0;
// To save the CheatActivity returning result
private boolean mIsCheater;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d(LOG_TAG, "QuizActivity onCreate(Bundle) called");
setContentView(R.layout.activity_quiz);
if(savedInstanceState != null) {
mCurrentIndex = savedInstanceState.getInt(KEY_INT);
mIsCheater = savedInstanceState.getBoolean(KEY_BOOLEAN);
}
}
// Not to loose activity state when rotating the device
#Override
public void onSaveInstanceState(Bundle saveInstanceState) {
Log.i(LOG_TAG, "onSaveIntanceState");
saveInstanceState.putInt(KEY_INT, mCurrentIndex);
saveInstanceState.putBoolean(KEY_BOOLEAN, mIsCheater);
super.onSaveInstanceState(saveInstanceState);
};
// to get the result from child activity(Cheat activity)
#Override
protected void onActivityResult(int arg0, int arg1, Intent data) {
if(data == null){
return;
}
mIsCheater = data.getBooleanExtra(CheatActivity.EXTRA_ANSWER_SHOWN, false);
};
}
You have the same keys!! Change code like this:
private static final String KEY_BOOLEAN = "index_BOOLEAN";
private static final String KEY_INT = "index_INT";
KEY_INT and KEY_BOOLEAN have the same name, the same value. So when setting those in the bundle one might overwrite the other. Use different names:
private static final String KEY_INT="intindex";
private static final String KEY_BOOLEAN="boolindex";

Android Handler changing WeakReference

My static handler has a WeakReference to my Activity (this is to prevent the well documented memory leak issue).
I post a long delayed message and I want this message delivered to my activity (which should be in the foreground).
My concern is that on orientation change, my activity is destroyed and the handler has a reference to the old activity which should have been destroyed.
In order to get around this in my onCreate for the activity I do this.
if(mHandler == null)
mHandler = new LoginHandler(this);
else {
mHandler.setTarget(this);
}
And my handler is declared as a static global variable:
private static LoginHandler mHandler = null;
and the implementing class is also static as below:
private static class LoginHandler extends Handler {
private WeakReference<LoginActivity> mTarget;
LoginHandler(LoginActivity target) {
mTarget = new WeakReference<LoginActivity>(target);
}
public void setTarget(LoginActivity target) {
mTarget = new WeakReference<LoginActivity>(target);
}
#Override
public void handleMessage(Message msg) {
// process incoming messages here
LoginActivity activity = mTarget.get();
switch (msg.what) {
case Constants.SUCCESS:
activity.doSomething();
break;
default:
activity.setStatusMessage("failed " + msg.obj, STATUS_TYPE_DONE);
}
}
}
What I want to know is if there is something wrong with changing the WeakReference on onCreate or is there anything else wrong with this approach?
Thanks,
So I wrote the following test to figure out whether I had the right idea or not and it seems that m approach is correct. In onCreate we change the WeakReference and the posted message will always get delivered to the activity that is in the foreground. If you change this code to always create a new Handler in onCreate you'll notice the update messages do not get delivered.
public class MainActivity extends Activity {
private static int COUNT = 0;
static LoginHandler mHandler;
private static class LoginHandler extends Handler {
private WeakReference<MainActivity> mTarget;
LoginHandler(MainActivity target) {
mTarget = new WeakReference<MainActivity>(target);
}
public void setTarget(MainActivity target) {
mTarget.clear();
mTarget = new WeakReference<MainActivity>(target);
}
#Override
public void handleMessage(Message msg) {
// int duration = Toast.LENGTH_LONG;
// process incoming messages here
MainActivity activity = mTarget.get();
activity.update(msg.arg1);
}
}
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if(mHandler == null)
mHandler = new LoginHandler(this);
else
mHandler.setTarget(this);
((Button)findViewById(R.id.button)).setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Message msg = new Message();
msg.arg1 = COUNT++;
mHandler.sendMessageDelayed(msg, 3000);
}
});
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
private void update(int count) {
((TextView) findViewById(R.id.hello_world)).setText("Hello World # "+ count);
}
}
A solution in getting away with activity's destroy-and-create life cycle, if you want to retain the active objects is to make use of the "Retent Fragments".
The idea is simple, you are telling the Android system to " retain" your fragment, when it's associated activity is being destroyed and re created. And make sure you grab the current activity's context in the fragment's onAttach() callable, so you are always updating the correct activity.
Below link has more details:
http://www.androiddesignpatterns.com/2013/04/retaining-objects-across-config-changes.html

Categories

Resources