Questions tagged [oncreate]

1

votes
1

answer
32

Views

Webview app, back smartphone button

I recently started to program with Android studio, I came across a problem. I created a Webview application, and I would like to press the back button on the smartphone once you go back to the previously viewed page, while pressing it twice in a row will exit the application. For now I only managed...
Simone.P
1

votes
0

answer
207

Views

setcontentview(r.layout.activity_main) crash

My application is closed(crash) and shows on Android monitor error it : activities.MainActivity.onCreate(MainActivity.java:77) what can i do?! this is my logcat: 03-14 10:21:04.255 5003-5003/com.panaceasoft.citiesdirectorySHZ E/AndroidRuntime: FATAL EXCEPTION: main Process: com.panaceasoft.citiesdir...
reza
1

votes
1

answer
42

Views

Android - Why is onAttach() and onCreate() being called after popping backstack?

Transition: Fragment A > Fragment B Fragment A goes through onDestroyView() and does NOT go through any other tear down methods. Transition: Fragment B is popped and Fragment A is restored Fragment A goes through onAttach() and onCreate(). Why is this the case? Shouldn't Fragment A only have to re...
user2892437
1

votes
0

answer
41

Views

FancyShowCaseView not showing in onCreate()

I want to show start case view in on create method: new FancyShowCaseView.Builder(this) .title(getString(ShowCaseViewEnum.ADD_COURSE_START.messageId)) .build() .show(); When I do this I can see case view screen but only for very short time and then it disappears. I have tried to use some delay but...
Marcin46
1

votes
1

answer
43

Views

Is it unwise to create and fill large arrays in my onCreate() method?

I'm planning to create an app that basically asks a lot of questions (for the purpose of study). I haven't started it yet, I'm still planning how I will carry it out. I'm thinking of creating a class called Question and then storing multiple objects of that class in different arrays. I could end up...
TheCovenant
1

votes
2

answer
910

Views

React Native Splash Screen: Unfortunately <APP> has stopped after SplashScreen.show()

I'm building a React Native App and I'm using React Native Splash Screen for my splash screen. Let me give you my code first, then I'll explain the issue. res/drawable/background_splash.xml: SplashActivity.java: package com.painbutton; import android.content.Intent; import android.os.Bundle; import...
J. Hesters
1

votes
1

answer
3.8k

Views

ProgressDialog onCreate

In 'onCreate' I'm downloading data from web.The duration of downloading data is 10 sec. I wan't to have ProgressDialog while the data is downloading. Here is my code , but the ProgressDialog doesn't appear: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setCont...
user345602
1

votes
1

answer
188

Views

How can i take data from the onCreate method and put it on the onClick

so basically i created a URL in the onCreate method, and i want to pass it with an intent just when i click on a button. The URL is created but i can't send it to The NeXT activity because it's just in The oncreate method. What should i do ?
Tsunaze
1

votes
2

answer
1.4k

Views

Helper Class - Error Unable to start activity ComponentInfo:

Error Unable to start activity ComponentInfo: java.lang.IllegalStateException: System services not available to Activities before onCreate() I´m experimenting with seperating the code and the use of a helper class. (Created different Java files) What I did is created an Activity Java file that is r...
Diego
1

votes
3

answer
1.8k

Views

How to resolve NullPointerException in an Activity when calling super class onCreate() method in Android

Hi Friends i have written an Activity like below. SplashScreen.java public class SplashScreen extends Activity { protected final int _splashTime = 4000; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView...
user1195614
1

votes
1

answer
1.2k

Views

How to trigger fragment's onCreate method?

I have a ViewPager with 4 views. View #3 needs to respond to some broadcasted events. Hence, I register a custom BroadcastReceiver in onCreate as described here. This works if I make sure to show view #3, triggering the onCreate event. Otherwise, it doesn't work, obviously. How can I make sure that...
l33t
1

votes
2

answer
262

Views

Android Activity onInitialize

I would like to do some action only once, when the app starts. Therefore, I tried to place the code within the main acitivity's onCreate, but this is triggered again and again when the user comes back to the main activity and/or when the device orientation changes. Which event fits better for my use...
ledy
1

votes
1

answer
404

Views

How to call a function after the activity animation got over in android

Hi,I am using animation for moving one activity to another. I need to call a function after the animation of the activity got over but I cant find any solution.Can any one help me?
Rakki s
1

votes
1

answer
321

Views

Two date pickers connected to each other invoke two listeners at the same time

I have two date pickers which are connected to each other as when I change the date of the first picker the second ones date is also changed automatically , the two pickers have a listener called on date change listener, as follows public class birthDate extends Activity{ Calendar c = Calendar.getI...
Android Developer
1

votes
1

answer
160

Views

Does the listener inside onCreate works more than once?

I have a listener for my date picker which I defined inside onCreate which I want to work as soon as the user changed the date picker date as follows Edited public class birthDate extends Activity{ DatePicker birthDayDatePicker,periodDatePicker; @Override public void onCreate(Bundle savedInstanceSta...
Android Developer
1

votes
2

answer
38

Views

Create new instance on launch

I'm fairly new to android, but I've noticed that pretty much every tutorial begins with this: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); But I don't want the state to persist throughout relaunching the app. I want the user to start at the beginning if they...
Fibericon
1

votes
2

answer
1.5k

Views

How can get x and y position of an image in android on onCreate?

I want current X & Y co ordinates of an ImageView on onCreate of Activity, is there any solution for the same ? Please share your idea on same.
Hiren Patel
1

votes
1

answer
1k

Views

Edit TextView outside of OnCreate or Buttons Java Based

I am a beginner and have floundered on what should be an easy task. Through OnCreate or through buttons, I can edit any of the textviews through t.append(bla bla bla) but when I try to externalize the editing to another class, it all goes south and the program doesn't launch. This is on Android. Mai...
user2411574
1

votes
1

answer
165

Views

Get property of external filter in controller onCreate() method of the Yii framework

I have controller which uses external filter coded in separate class. This filter perform verification before execute onCreate() method of the controller. But I need get property of this filter object after filter executed for create operation. How can I get property of external filter in onCreate()...
1

votes
2

answer
935

Views

Launching a new Activity from a Context Menu and automating another Activity in the onCreate relaunches the same Activity

I have two Activities in which I want to call the second one from the first one's Context Menu. This is what it should do. Activity A Context Menu click should start Activity B. In the onCreate of Activity B, depending on the extras passed in, automatically display a AlertBuilder dialog and then eit...
John
1

votes
1

answer
922

Views

Is it possible to get Android accelerometer values inside onCreate method?

Is it possible to get Android accelerometer values inside onCreate method? I want it, so as to make some initializations after reading them. So far, I have registered a sensor listener to get those values when they change through the onSensorChanged callback. I have 3 float attributes (lastx, lasty...
Thanasis Petsas
1

votes
3

answer
993

Views

Android Application Crashes when Creating custom class object

I'm working on my first android app and I'm having trouble creating an object of a class I have programmed in java using the onCreate function of an activity. The activity starts great when I do not instantiate the object, but when I attempt to create the object the app crashes when switching to the...
Freestyle076
1

votes
2

answer
5.4k

Views

Android Java: Fragments returning null view in onCreateView()

I am currently working on a program that uses an MVC design pattern and fragments in android java. I have figured out one of my fragments and gotten it working but when I copied the other fragments to follow the same code structure (with specialized functionality), I get a null pointer exception in...
user3005504
1

votes
2

answer
333

Views

intent bundle variables not being passed between activities

in mActivity.this I set up an intent and a bundle Intent intent = new Intent(mActivity.this, nextActivity.class); Bundle mBundleNow = new Bundle(); mBundleNow.putString('formattedAddress', formattedAddress); mBundleNow.putDouble('latitude', latitude); mBundleNow.putDouble('longitude', longitude); mB...
CQM
1

votes
1

answer
768

Views

onActivityResult() function when Activity is recreated?

I have a problem : When I take a photo in my apps,my app open Camera app and take a photo but when return Activity seem my device is low memory and onCreate() function is recalled. In this case onActivityResult() is called before onCreate() or onCreate() is called before onActivityResult() ? Is the...
nguoitotkhomaisao
1

votes
1

answer
474

Views

Sqlite Database onCreate Parameter

I'm a beginner at SQLite Database making and I had just ran into a problem. I want to be able to completely reCreate my table, so i copied onCreate and renamed it reCreate with the exact same parameteres. What I want to ask is does the SQLiteDatabase that is passed into onCreate has to be a certain...
Snipe_and_Swipe
1

votes
1

answer
538

Views

Android - Call a function when authenticate process end

I'm trying to integrate dropbox upload in my app. I've read the official examples and I was able to write a client to upload the files. Now there is just one thing that I'd like to fix.. the example first run this line of code: mDBApi.getSession().startOAuth2Authentication(MainActivity.this); and th...
Luca D'Amico
1

votes
1

answer
401

Views

Android SDK, action bar color

So in my app I have the action bar color code as this in the create event of the 'activity_main': android.app.ActionBar redd = getActionBar(); redd.setBackgroundDrawable(new ColorDrawable(Color.parseColor('#BA0202'))); And it changes,But I'd like to use a string. I have tried 'R.string.ColorRed' In...
AntonioSanchez
1

votes
2

answer
547

Views

Replace android constructor with onCreate()

I read, that you not should use the constructor. How can I replace the constructor with onCreate()? I need onCreate() because I like to implement vibration with the system services In the MainActivity gameEngine = new GameEngine((SensorManager)getSystemService(Context.SENSOR_SERVICE),gameView,this,t...
Capaxi
1

votes
1

answer
1.1k

Views

onCreate() method of SQLiteHelper is never called

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 class : public class MyS...
Nikhil
1

votes
1

answer
76

Views

Button linked to sounds onStart

I'm working on an app there are no errors with this app however whenever i test it on my phone there are supposed to be sounds when I touch the button however no sounds. MainActivity package com.example.user.myapplication; import android.app.Activity; import android.support.v7.app.ActionBarActivity;...
Ryan
1

votes
1

answer
98

Views

Adding Activity, layout showing but dosen't work it's java code ( on Activity)

I have 4 Activities and one MainActivity.I can show all Activities to MainActivity Layout,but when i run my program, my fourth Activity behind code dosent work. for example each of 4activity does'nt run oncreate() method. MainActivity.java ..... @Override public void onCreate(Bundle savedInstanceSt...
user1794863
1

votes
3

answer
335

Views

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

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...
agurodriguez
1

votes
1

answer
703

Views

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

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 that i need just calling onCreated() method when switchin...
Milaaaad
1

votes
1

answer
702

Views

Why onCreate Bundle and onSaveInstanceState Bundle are different in a Fragment?

I have look around but can't find the answer to this exact question. In an Activity this simple program : @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if(savedInstanceState!=null)Log.e('SaveInstanceState',...
Elorri Etchemendy
1

votes
1

answer
23

Views

On accessing External applications such as Device Gallery and getting back to my application OnCreate() is called again

I'm trying to create an application where there is a need of uploading images from my mobile. In this case, when I open my Gallery and choose a image and come back to my application, onCreate() is called again due to which the TextView, EditText and the booleans which I've used earlier are cleared....
Parthiban M
1

votes
1

answer
422

Views

Android why does text display at onCreate

I'm just beginning to learn Android Studio. According to Android developer all activity visible to the user happens between onStart and onStop. How come the text 'onCreate' written in my simple program, displays on first run? public class MainActivity extends AppCompatActivity { private TextView te...
Robin
1

votes
1

answer
487

Views

OnCreate of Application class is not called in Android 6

I have an Application class, but the OnCreate method is not called on my HTC One m8 (Android 6). On the emulator (Android 5.1) it works fine. public class App extends Application { private static Context context; @Override public void onCreate() { super.onCreate(); context = getApplicationContext(...
tomhogenkamp
1

votes
3

answer
422

Views

How to call a method in same class from inside oncreate method android?

Hi i am new to android & java, I was trying to make a three buttons menu each time a button is clicked other two changes its color or clicked one is highlighted to show it's selected But i am unable to call a method from inside onCreate to perform a particular task when clicked. Help Thanks ` pub...
Misterrai
1

votes
1

answer
293

Views

Application onCreate not called when Notification Access Enabled

My Application onCreate is not calling when the notification access enabled.It calls only when I update the app or When I disable the notification access of my app.Here are the scenarios I found by debugging the app. Condition 1 - onCreate Not Calling when Notification Access Enabled i) I tried to...
Debugger

View additional questions