oncreate

java.lang.NoSuchMethodError: No static method setOnApplyWindowInsetsListener

∥☆過路亽.° 提交于 2019-12-17 07:39:26
问题 I upgraded my android studio to 2.1.3. And now I am getting following error java.lang.NoSuchMethodError: No static method setOnApplyWindowInsetsListener(Landroid/view/View;Landroid/support/v4/view/OnApplyWindowInsetsListener;)V in class Landroid/support/v4/view/ViewCompatLollipop; or its super classes (declaration of 'android.support.v4.view.ViewCompatLollipop' appears in /data/data/com.restroshop.restroowner/files/instant-run/dex/slice-internal_impl-24.2.0

Start an Activity with a parameter

馋奶兔 提交于 2019-12-17 01:35:41
问题 I'm very new on Android development. I want to create and start an activity to show information about a game. I show that information I need a gameId. How can I pass this game ID to the activity? The game ID is absolutely necessary so I don't want to create or start the activity if it doesn't have the ID. It's like the activity has got only one constructor with one parameter. How can I do that? Thanks. 回答1: Put an int which is your id into the new Intent . Intent intent = new Intent

Non responsive app when downloading lots of data

梦想的初衷 提交于 2019-12-13 09:11:30
问题 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 the code: public class Main extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); DoIt(); } private void DoIt() { HttpClient httpClient = new

Looping in onCreate method

梦想与她 提交于 2019-12-13 06:41:12
问题 So I'm creating a program which will randomly spawn circles on the screen every 5 seconds. I had it working by just displaying 1 circle but when I tried to loop in the onCreate method to draw multiple circles, I got compiler errors and I have no idea what to do now, been stuck for 30 minutes. Here is my code and the main error. Any help will be appreciated. public class RandomCircles extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate

Android Java: Fragments returning null view in onCreateView()

我们两清 提交于 2019-12-13 02:40:08
问题 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 the onCreateView method. I'm on my junk laptop right now and it can't seem to handle android emulation so I can post the exact error code tomorrow. I have my source code though and I have been

Android life cycle activities [duplicate]

萝らか妹 提交于 2019-12-13 01:27:52
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: Android Activity Life Cycle - What are all these methods for? I have an activity which is main called menuActivity and another activity which called birthDate . When I run the application the menuActivity become the active one and when I click on a button the second one become the active one which is the birthDate . My question is: When the first activity become active another activity goes to background and

Helper Class - Error Unable to start activity ComponentInfo:

岁酱吖の 提交于 2019-12-13 01:26:46
问题 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 registred in the Manifest and I didn´t register this following class (Java file): import android.app.Activity; import android.location.LocationManager; import android.net.ConnectivityManager; ....

App crashes after receving phone call

帅比萌擦擦* 提交于 2019-12-12 12:34:11
问题 After I either receive a phone call or make one, (and other undocumented interruptions) my application gets a NullPointerException when resuming my activity. Can any explain to me where it is and/or how to fix it? When my activity resumes, it is calling onCreate it seems, and it is trying to execute something that is null after Resuming. How do I prevent onCreate() from being called? My activity seems to terminate when I press the call button, because when I try to debug this error, the

Why am I getting a Null Pointer Exception on my Android Program line 73?

人走茶凉 提交于 2019-12-12 06:23:51
问题 I am not entirely sure why I am getting a NullPointerException . If anybody could help me out that would be great. I labeled Line 73 below. package com.shantanu.report; import java.io.File; import java.util.Locale; import android.app.ActionBar; import android.app.FragmentTransaction; import android.content.ActivityNotFoundException; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app

IllegalStateException (Already attached) when opening NFC reader app

微笑、不失礼 提交于 2019-12-12 05:09:30
问题 I'm trying to develop an app that reads an NFC tag and displays the read data. I took most of the code from a blog but I'm getting an error when I run the application since I am trying to integrate it with the slider application. Here are my errors and my code below: E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.jeffk11.tag, PID: 20123 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.jeffk11.tag/com.example.jeffk11.tag.MainActivity}: java.lang