• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Caused by: java.lang.NullPointerException . Can someone help

Hey guys whatsup . I´m new here and i want to ask if you could help me with this error message ...


Code:
at android.app.ActivityThread.main(ActivityThread.java:7073)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
        at com.example.myapplication2.MainActivity.onCreate(MainActivity.java:47)

Yeah you know i´m already sit over 2 days on this error message cause i can`t find any problem in my Code you know ...
Here are my Files , what I´m doing wrong ? :

Java:
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

       Button button = findViewById(R.id.button1);
       button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                openanmeldung();
            }
        });







        BottomNavigationView navigation = findViewById(R.id.bottomnav);
        navigation.setOnNavigationItemSelectedListener(this);


        getSupportFragmentManager().beginTransaction().replace(fragment_container, new Home_Screen()).commit();


    }

    private void openanmeldung(){
        Intent intent = new Intent(MainActivity.this,AnmeldungButton.class);
        startActivity(intent);
    }


Thats not my whole code but here is a picture too from the debug tool :
I uploaded it .

and here is the file where I have my Button ... :

Code:
 <android.support.v7.widget.CardView

            android:layout_width="match_parent"
            android:layout_height="173dp"
            app:cardCornerRadius="8dp"
            android:layout_marginTop="80dp"
            android:layout_marginLeft="30dp"
            android:layout_marginRight="30dp"
            >

        <Button
                android:text="Mehr infos"
                android:layout_width="120dp"
                android:layout_height="35dp"
                android:id="@+id/button1"
                android:layout_weight="1"
                android:layout_marginTop="130dp"
                android:layout_marginRight="170dp"

                />


        <LinearLayout android:layout_height="match_parent"
                      android:layout_width="match_parent"
                      android:background="@color/maincolor"

                >

        </LinearLayout>

        <TextView android:layout_height="wrap_content"
                  android:layout_width="wrap_content"
                  android:textColor="@color/white"
                  android:text="HPI - 29.06.19"
                  android:textSize="24dp"
                />

        <TextView android:layout_height="wrap_content"
                  android:layout_width="wrap_content"
                  android:textColor="@color/white"
                  android:text="Sitzung: H-E.51"
                  android:textSize="16dp"
                  android:layout_marginTop="40dp"

                />
        <TextView android:layout_height="wrap_content"
                  android:layout_width="wrap_content"
                  android:textColor="@color/white"
                  android:text="Juni22, 2019"
                  android:textSize="16dp"
                  android:layout_marginTop="40dp"
                  android:layout_marginRight="20dp"
                  android:layout_marginLeft="270dp"






                />
            </android.support.v7.widget.CardView>


Here is the file that should open when I click the Button :


Code:
package com.example.myapplication2;


import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;


public class AnmeldungButton extends Fragment {

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.moreinffos, container, false);
    }
}

Thank you for everyone who help me ....

Attachments

  • Button = null ;.JPG
    Button = null ;.JPG
    103.3 KB · Views: 289

Unsolicited pic download?

My son was using my S9, looking at a website about a game called slimerancher. After he was done, I saw a picture had downloaded to my phone. I looked at it and it was an inappropriate picture of a young girl, not illegal I don't think, no nudity, but from some European child modeling website that caters to pedophiles (there was a studio name on the photo, I looked up info on them). I checked the history, and it shows right in the middle of browsing slimerancher this pic downloaded to my phone. He never went to another site, and was completely baffled by the picture. Anyone know how this could happen? The thought of possibly illegal material being put on my phone without my knowledge is very scary.

Speech-to-text notes

Hi guys, I'm pretty new to speech assistants and speech-to-text apps, hopefully I get some help here
smile.png


I'm looking for a app/assistant to do one simple task for me:

  • speech-to-text todo list note
  • autosave it after/during recording
  • read it for me using machine voice after save (or any time after)

It would also be cool if this app would have some nice typical todo/notes interface and also some function to choose similar words when misheard. But this is not as important as the three points above.

I've tried ListNote app already, but the interface is a little bit confusing for me. I've also tried Voice notes from gawk, but there is no option to choose from similar words when misheard. Anyway, both apps can not read what I dictated, which is pretty important to me. I've also tried some others, all worked more like text file editors and the only one that could play me my note back was just plaing the recording (i my ugly voice
biggrin.png
sad.png
).

Does anybody know about some app or assistant, which works the way I want it to? Some assistant may be better than note apps, but I don't have any experience with these. Please help!

Accessories Android Box to access W10 shared folder

Hi all,

am looking for an Android box that will be able to read JPGs and MP4 on a Windows PC using Wi-Fi. The box will then display them on a TV. There are a lot of android box on the market but am looking for one with an Android OS which will be able to support a File Manager like ES file explorer or another paid App. The App should be able to use it's built-in media player to play the files one after the other.

I know ES file explorer just stops after playing a file and will not automatically read the next files.

Help S10 Plus: Keyboard lags after unlocking screen

Hi there,
After my Galaxy S10 Plus was updated to newest June firmware, I have annoying problem with the keyboard (all kind of keyboard: samsung, google, swipe,…). When I unlock the phone, and immediately (within 1 – 2 seconds after unlocking) type words, the keyboard lags and takes 2 – 3 seconds to appear.
For specific situation, when I am on chat screen, the keyboard is showing up, and then I turn off screen. After the phone is unlocked, the screen is still on chat screen, but keyboard doesn’t show up (like it is forced to disappear when the phone is locked). After that, when I immediately click to input words to continue chatting, the keyboard takes times to appear and shows some lagging.
It doesn’t happen when I wait a little bit after unlocking phone, or when I use phone for a while. I didn’t met this problem before.
I tried several methods like hard reset, clear cache data, etc, but it is ineffective.
Please help me to solve this problem.
Thank you so much.

Charging Fix for CoolUI 8.1

So I've a Coolpad Note 3 Lite and I've installed CoolUI 8.1 Reborn Marshmallow. Everything's fine except the charging. When i start charging there's no indication and the power button stops working. I have to force restart every time by pressing the power button. The site I downloaded from, they said that the battery isn't calibrated and all I have to do is to drain to 0% and switch off and charge to 100%. The problem will be solved but that doesn't work whenever I install it. I need that patch or fix or the original OS without any bugs.

Link : http://t0la.blogspot.com/2017/11/coolui-81-reborn-for-cp8676i02-note-3.html?m=1

Fingerprint Unlock & Google Pay

Hi All

When I wish to make payment using Google Pay, I unlock my Galaxy S5 by fingerprint and hold it over PayWave terminal. Once transaction is completed I close (lock) my phone.

My issue is that, while this works fine, every few transactions, as I hold phone over PayWave terminal, the phone asks me to enter my backup password. Once I enter my fingerprint backup password the phone displays "Try Again" and the PayWave transaction then works fine.

This unnecessary step (since no one else can unlock with my fingerprint) is frustrating. This doesn't seem to happen to others I know.

Since I reverted to unlocking my phone with a PIN, PayWave transactions work every time without requesting my backup password.

However, I would prefer to use fingerprint security.

Has anyone experienced or heard of this issue?

Would appreciate any advice.

Thanks!

Using Home Key to Answer Call on S5

Hi all, I have an Galaxy S5 which is running Resurection Remix 6.0 (8.0 Oreo) and is using the default Google Dialer app. I can't find an option to answer a call using my home key as all the guides online only cover Samsung's One UI stock phone dialer, not Google's. I've checked all the Accessiblity and Phone app settings but can't find an answer. Can anyone help please?

Leelbox error No Video Input on Live TV

we recently bought 3 Leelbox devices for our 3 TVs at home. We are paying for Soplayer content, however when trying to watch Live TV, it will work for a little while and then we get a screen that says "No Video Input". Sometimes we just get the error and it won't play live tv at all. We even upgraded our wifi thinking it would help, however the only one that works perfectly is physically plugged into the wifi box. Any ideas? I am leaning towards returning them all.

Help Strange data connection problem

I as you saw have a Samsung j7 issue. I am on the boost mobile network. It will show that I have 4 out of 5 bars signal. A google speed test will show that I'm getting between 20 mb/s to sometimes 40. I can load websites just fine. In most cases I can load videos fine. The problem is any of the games apps that are on the phone. All of them say network error .I have cleared cache for entire phone from a boot screen. I have cleared cache for the games I try loaded . I just dont understand why it wont load when I have a great connection

Clerk said my s8 is HOT

I financed and paid off an s8 through Verizon and went to get it activated through one of these secondary carriers
The clerk swapped sims and told me it's a t-mobil and has a code on it blocking activation like its stolen!
I've heard some places can have this cleared but I bought an s9 anyway so now I'm just trying to sell the damn thing.
Just don't need any hassle if i send it to an outfit that buys online.
Btw looking for who pays the most.
Thanks

Filter

Back
Top Bottom