I have a Fragment which is retained one i.e setRetainInstance(true); called in the onCreate now all people says that the Bundle object in the onCreate or the onActivityCreated , onCreateView will be null , which is true .
this is the code used in tha java class.it doesnt show any errors in eclipse.the logcat shows null pointer exception and class caste exception
package com.myfirstapp;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.*;
public class MyfirstappActivity extends Activity {
/** Called when the activity is first created.
I am setting the location values using getter setter in one class and using it in another activity class where i am getting null pointer exception. I am using singleton pattern for the same.
in my project I have to set in a normal Activity multiple ListView (the number of these ListView depend of a size of an ArrayList).
So I have to programmatically add dynamically ListView and Custom ArrayAdapter.
I had th idea to make an AsyncTask to do these dirty stuffs : making an array of custom ArrayAdapter and to set dynamically a ListView for each Adapter in the array.
But the main proble
I'm trying to get GoogleMap object from a Fragment, which is on the second page of ViewPager, whose contents are given with FragmentPagerAdapter.
My ViewPager consist of two pages: an ordinary layout, and a Google map.
I can access to the first layout doing this:
View tempView = LayoutInflater.from(getApplication())
.inflate(R.layout.start_activity, null);
tempTextView = (TextVi
i want to work with action bar in android.
for this i use
getActionBar().setHomeButtonEnabled(true);
below the SetContentView . but is gives me null pointer exception.
when i try only getActionBar() it works fine.
please help me.
I have tried to copy:
[http://stackoverflow.com/questions/11490236/android-comprehensive-failproof-music-service-across-multiple-activites][1]
However, I am getting a null pointer exception on: StartupActivity.getService().musicStart(); Any ideas why this might be null?
How does one check if a MediaPlayer object has been initialized? Is there something like a:
MediaPlayer mp;
if(mp.isInitialized())
Log.v("Test", "mp has been initialized. :D ");
else
Log.v("Test", "mp is NOT yet initialized.
I have certain data in the data model class and want to share this data/object to the other activity. Single Instance could be a good choice but want to finish my previous activity and hence will got null pointer. Please Suggest the best possible way to do it?