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
0
votes
1 answer

Why do my buttons not return to invisible setting when i press back and reload search

I am making an app to search a database and i have a part where i type in a search detail and the name of the possible results are displayed on buttons in a new activity. It works fine first time round but if i press back from that activity then try…
0
votes
1 answer

Force splash to show from onCreate Activity

My app has the following Activities: DashboardActivity SplashActivity MainActivity This how the flow is required: The dash board has a button that starts up the MainActivity. The onCreate() method of the main activity checks if a user-profile was…
Tarek Eldeeb
  • 588
  • 2
  • 6
  • 24
0
votes
2 answers

onCreate() executes in forever loop

App's basic idea is: 1) BroadcastReceiver, receives an SMS 2) when SMS is received, another activity is called which sends another sms. The issue is that , when BroadcastReceiver calls the other activity (SMSMessaging) , it's onCreate method gets…
Faisal
  • 566
  • 5
  • 17
0
votes
4 answers

Android: Exit activity while it is created

Suppose I have code like this: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_msmap); setUpMapIfNeeded(); if (mMap == null) { return; } Before I…
Tom
  • 3,587
  • 9
  • 69
  • 124
0
votes
2 answers

same item value when accessed with getIntent() in other activity

My code flow is: Reports => ReportsType Reports is having 3 items and on click of each item, I am starting the activity ReportsType passing the tag with the name name in the intent to distinguish which item was clicked. The problem is OnCreate…
sjain
  • 23,126
  • 28
  • 107
  • 185
0
votes
1 answer

has stopped , window leaked , zygoteInit

I'm working on android to create a list to add tasks , there are many error when I run it and the emulator started. I tried hard to solve them but I couldn't and I think the problem in one class which is the main it supposed to display all tasks…
Najd
  • 78
  • 1
  • 7
0
votes
1 answer

resuming activity in Android using Service

I have a mainActivity. When starts, it starts a service and bonds it. There is a timer which will send the mainActivity (this) to back after X seconds, while the service keep running and listening, i use moveTaskToBack (true). When the service…
SagiLow
  • 5,721
  • 9
  • 60
  • 115
0
votes
1 answer

codeEt.setText(extras.getString("code")); causes NullPointerException

How is it possible to resolve a NullPointerException on line 48 of the following source: codeEt.setText(extras.getString("code")); I've looked this section of the code up and down and I cannot seem to resolve the issue. The variable appears to…
0
votes
1 answer

parse.initialize error for parse.com

This should be an easy fix. But I am a new programmer. I can't find answers anywhere. I just started building my app, (For the second time. My computer was stolen so lost all my previous work.) I am using Pasre.com. Haven't written any code yet,…
Chad Bingham
  • 32,650
  • 19
  • 86
  • 115
0
votes
1 answer

are android actions done in order as written in onCreate?

I want to know if these actions are done in order or not inside on create mWebView.loadUrl("file:///android_asset/game.swf"); AdView adView = (AdView)this.findViewById(R.id.adView); adView.loadAd(new AdRequest());
A.Jouni
  • 377
  • 2
  • 4
  • 14
0
votes
2 answers

Dynamically setting RadioButton checked

I'm developing Android app and I have one problem. I have Radiobutton group:
user1943977
0
votes
1 answer

How to store data in android for a long time?

I am trying to develop android application (first time), so I'm using SQLite to store data. But every time I run the application all data are null! I think the problem is when I run the application it recreates all the tables and they come as new…
jory
  • 41
  • 2
  • 4
0
votes
1 answer

Android reload textViews on button tap

in an activity I load some text values from a custom object. These text values go into textViews, the textViews are displayed on screen. I have previous and next buttons that, when tapped, should refresh the textViews with the new values. Here is…
M Jesse
  • 2,213
  • 6
  • 31
  • 37
0
votes
1 answer

How to create a file in the internal storage only during the installation process?

I would like to know how to create a file in the internal storage only during the .apk installing. My problem is that when I put the file with the onCreate method of MainActivity, everytime I relaunch the application, the content of my file is…
Bob Nalyd
  • 21
  • 1
  • 5
0
votes
1 answer

How to draw to canvas on onResume

I have an android app that draws to a canvas. Up to now I've been drawing each time I create the app usine onCreate as such: package com.example.drawdemo; import android.app.Activity; import android.graphics.Color; import android.os.Bundle; public…
WildBill
  • 9,143
  • 15
  • 63
  • 87