FAQ Database Discussion Community


OnCreate not called on Activity

android,android-activity,oncreate
I've created AbstractActivity and an AbstractFormActivity to rid of some boilerplate code, their content may be irrelevant to the question, but I will post it anyway, maybe I misunterstood something so, there they are: public abstract class AbstractActivity extends ActionBarActivity { protected ObjectGraph graph; @Inject public Bus bus; @Inject public...

onCreate2(android.os.Bundle) is never used?

android,oncreate
I am trying to make multiple buttons which open different URLs and I keep getting the same error stating onCreate2(android.os.Bundle) is never used. Does anyone know how to solve the error and what I can do to stop it occurring in the future, Thanks package saintbedeslytham.saintbedes; import android.content.Intent; import android.net.Uri;...

onCreate is called twice

android,countdowntimer,oncreate,screen-rotation
I have 2 activities - MainActivity and page1. I have intent from the first like this: button_forward.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { Intent intent = new Intent(MainActivity.this, Page1.class); startActivity(intent); return true ; } However, my Page1 class's onCreate is called twice! i can detect it...

Android Dev: Do things when App get started

android,oncreate,activity-lifecycle
im trying to implement a Sync process for my application. The internal sqlite database has to sync with the remote mysql database. That works great, but now i want to implement, that always on app start the sync method gets called. I simply put it in the onCreate() method but...

Parcelable data unavailable when an Activity is created again after back button

java,android,android-activity,parcelable,oncreate
I have one ListActivity. It receives a parcelable object and saves it as a property. The thing is that when you press one of ListView item another Activity shows up: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.activity_main); setHjClient((Client) getIntent().getParcelableExtra("hjClient")); setListAdapter(new ComplejoListAdapter(this, getHjClient().getComplejos())); } @Override protected void onListItemClick(ListView l, View...

Preference has wrong value when rebuilding PreferenceFragment

java,android,oncreate,rebuild,preferencefragment
I am creating several Color Picker preferences (extended from Preference) in the onCreate method of my Preference Fragment. The colorpickers describe the current design that is active. So when the user picks a new design (in the same PreferenceFragment) all color pickers have to change according to the new design....

Android - Get variable from oncreate() of another class

java,android,android-activity,oncreate
I have a class GetMyLocation that gets the current location of the user. Now I'm trying to call an object of this class from another class, ShowMap2. But I am unable to send the updated location to the new class. I haven't included the other overrides for GetMyLocation here. What...

onCreate(savedInstanceState) savedInstanceState is NULL

android,oncreate,bundles
My issue is this: I'm new to android programming and I have created a new app, when i press the button to launch this activity below, it crashes. When I debugged it it said onCreate() got a null bundle. How do I fix this? I don't understand the other classes...

Changing activity from other app android

android,android-intent,intentservice,oncreate
I want to block the opening of certain programs. Example: I have a program (A) with all the configurations (a key, list of programs to lock). When active (A), and you open a program (B) (shortscreen from android menu), if it is on the list of locked programs, instead of...

Android activity unresponsive until back button is pressed

java,android,android-activity,input,oncreate
Below is the oncreate to my activity. My issue is that when the activity is started it is completely unresponsive until I press the back button. Once I press the back button it works perfectly. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_packs); count = 0; Bundle extras = getIntent().getExtras();...

calling a method from the onCreate

java,android,oncreate
I am wanting to call a method from onCreate, but I keep getting an error in my logCat. I was looking through some of the other answers and none of them answer my question specifically. I am very new to android so i dont know much HERE IS THE XML:...

Difference and uses of onCreate(), onCreateView() and onActivityCreated() in fragments

android,android-fragments,android-lifecycle,oncreate,fragment-lifecycle
What are the differences between onCreate(), onCreateView(), and onActivityCreated() in fragments and what would they each be used for?

How to access controls(views)in tabs from another one in android?

android,eclipse,android-fragments,android-tabs,oncreate
i'm working on application in eclipse that have 5 tab and i have spent much time for that but now i have a big problem : when one of tabs is activated the next tab and prev tab is loading too and onCreated() method is called but i don't need...

onCreate() method of SQLiteHelper is never called

java,android,android-sqlite,oncreate,sqliteopenhelper
I'm creating a database in android using SQLite. I wrote my code to create a table called products in onCreate() method. Then when I call add() method to add some values into the table, I'm getting an error that there is no such table called products. Here is my SQLiteHelper...