Questions tagged [oncreate]

onCreate refers to one of the lifecycle methods for several components on the Android platform.

The onCreate method is a lifecycle method of several Android components like Activities, Fragments, Services etc.

For activities and fragments, this is the first lifecycle method to be called when that component is first created. It can also provide a Bundle containing the component's previously frozen state, if there was one. This method is generally used to setup the component (for example in an Activity this would translate to creating the UI views, binding data to widgets etc).

More information can be found in:

995 questions
-1
votes
1 answer

Odoo 10 : Removing Create button from tree view

I want to remove Create and Import button in my module and replace it with Sync button.I tried below code :
Anudocs
  • 686
  • 1
  • 13
  • 54
-1
votes
1 answer

Get image ByteArray from onActivityResult to oncreate

I have global variable byte[] byteArr; which i want to save value of bytearray when image is clicked and set the value after TakeImage(img_view); method in ed[finalI].setText(bytearray); This below code is above onCreate private Bitmap…
-1
votes
1 answer

BaseActivity repeating the child's action in Android

I was trying to create a base activity and setup some things that would be applicable for all activities. However, when I was trying to test it, I see that what I was String "Example" that I was displaying is showing twice instead of once. If I…
Al Nafis
  • 127
  • 9
-1
votes
1 answer

Starting a function in the onCreate (without a button click)?

I know this might be a basic question, but I am a beginner and I haven't been able to find an answer. I would like to know, if it is possible to trigger some function/action while creating an activity. eg. trigger a void without user intervention,…
Sophie M
  • 351
  • 5
  • 14
-1
votes
1 answer

Non responsive app when downloading lots of data

I have an app that has to download a few MB (1MB - 10MB) of data from a server on app startup. The problem is that the app: doesn't show the main TextView before starting the download (the screen stays black) is more or less unresponsive Here is…
Basj
  • 41,386
  • 99
  • 383
  • 673
-1
votes
1 answer

StartActivity not working

Hi so i am doing a login / signup system using firebase, for some reason startActivity just doesnt want to work. here is the Main Activity (LoginScreen) package com.example.noam.photoupload; import android.app.ProgressDialog; import…
jeff style
  • 61
  • 1
  • 7
-1
votes
3 answers

Attribute initialized in onCreate()

I created my class (exending Activity) with an attribute int a. The attribute is automatically initialized to 0 in the method onCreate(). Is it normal?
Bazouk55555
  • 557
  • 6
  • 24
-1
votes
2 answers

Android App crashes on startup with nothing changed..?

[SOLVED] -> NullPointerException was not caused in Java, but by an outside source (WCF webservice) with faulty implementation. I have an Android App project in Android Studio that I had working perfectly fine a few days ago. I came into work today,…
Pandasai
  • 35
  • 9
-1
votes
2 answers

Android : How to load an activity faster when calling it from another activity, even while loading several contents in the second activity

I'm new to java and android so I am asking these kind of questions here to understand how it should work. I have 2 Activities in my app viz Welcome_Activity.java and Content_Activity.java The First Activity work smoothly but the problem comes when…
Fadi A.
  • 93
  • 1
  • 10
-1
votes
2 answers

Why is my class creation being skipped

Okay this error for the life of me I can't figure out, to the point where I don't even know what to google anymore. This is a fragment of my initial class. (You can view the whole thing here) @Override protected void onCreate(Bundle…
Gideon Sassoon
  • 544
  • 1
  • 9
  • 29
-1
votes
2 answers

Getting an error: onCreate(Bundle) in class clashes with onCreate(Bundle) in android.support.v4.app.Fragment

I have made a class Navigation which extends Fragment. When I'm using onCreate() method it is giving me error saying onCreate() method of the class clashes with the onCreate() method of android.support.v4.app.Fragment. package…
-1
votes
1 answer

showDialog(DIALOG_EXIT); error

what am I doing wrong? I want to display an AlertDialog - "or close an application" beats me an error Error:(141, 9) error: cannot find symbol method showDialog(int) what should I do? public class ZavdanFragment extends Fragment { //аргумент…
Vgaday
  • 3
  • 2
-1
votes
1 answer

Animation of View in onCreate() method

I want to animate TextView when activity has been launched, in onCreate() method. However, when I try to get view's height or width it's always 0. In my case it's important to know view's height or width because I want to set the translation for Y…
nullbyte
  • 1,178
  • 8
  • 16
-1
votes
2 answers

startActivity in onclick

have a simple Activity with a onClick method - it works but Android Studio marks startActivity red says cannot resolve method - so why? @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); …
Chad White
  • 309
  • 1
  • 4
  • 15
-1
votes
2 answers

How to add multiple activities under one onCreateOptionsMenu(Menu menu)

I want to add multiple activities under one `onCreateOptionsMenu(Menu menu) in my android app, I have already added two activities and they are working fine but third activity isn't working, following is my code onCreateOptionsMenu(Menu…