JAVA Learning Group

Here you can talk about everything you want.
User avatar
Bearbear76
Former Bearbear65
Reactions:
Posts: 5730
Joined: 10 Feb 2017, 14:53
Location: L2 cache
Plugins: Showcase Store

Plugin Creator

Platform

Re: JAVA Learning Group

#81

Post by Bearbear76 »

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jasoftware.justanyonecomp/com.jasoftware.justanyonecomp.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.media.MediaPlayer.start()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2321)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2381)
at android.app.ActivityThread.access$800(ActivityThread.java:147)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1286)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5260)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:678)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.media.MediaPlayer.start()' on a null object reference
at com.jasoftware.justanyonecomp.MainActivity.initializeLogic(MainActivity.java:82)
at com.jasoftware.justanyonecomp.MainActivity.onCreate(MainActivity.java:47)
at android.app.Activity.performCreate(Activity.java:5975)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2274)
... 10 more
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.media.MediaPlayer.start()' on a null object reference
at com.jasoftware.justanyonecomp.MainActivity.initializeLogic(MainActivity.java:82)
at com.jasoftware.justanyonecomp.MainActivity.onCreate(MainActivity.java:47)
at android.app.Activity.performCreate(Activity.java:5975)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2274)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2381)
at android.app.ActivityThread.access$800(ActivityThread.java:147)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1286)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5260)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:678)

User avatar
JustAnyone
Developer
Reactions:
Posts: 3474
Joined: 23 Jul 2017, 12:45
Location: Easter Island
Plugins: Showcase Store

Platform

Re: JAVA Learning Group

#82

Post by JustAnyone »

Where is my rope at?

User avatar
Bearbear76
Former Bearbear65
Reactions:
Posts: 5730
Joined: 10 Feb 2017, 14:53
Location: L2 cache
Plugins: Showcase Store

Plugin Creator

Platform

Re: JAVA Learning Group

#83

Post by Bearbear76 »

Maybe ask lobby

User avatar
JustAnyone
Developer
Reactions:
Posts: 3474
Joined: 23 Jul 2017, 12:45
Location: Easter Island
Plugins: Showcase Store

Platform

Re: JAVA Learning Group

#84

Post by JustAnyone »

https://drive.google.com/file/d/0B32tv5 ... p=drivesdk
Last try. If this Doesn't work. Wait for 1.2

User avatar
JustAnyone
Developer
Reactions:
Posts: 3474
Joined: 23 Jul 2017, 12:45
Location: Easter Island
Plugins: Showcase Store

Platform

Re: JAVA Learning Group

#85

Post by JustAnyone »

Does this work?

User avatar
Bearbear76
Former Bearbear65
Reactions:
Posts: 5730
Joined: 10 Feb 2017, 14:53
Location: L2 cache
Plugins: Showcase Store

Plugin Creator

Platform

Re: JAVA Learning Group

#86

Post by Bearbear76 »

Yeah

User avatar
Lobby
Developer
Reactions:
Posts: 3705
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: JAVA Learning Group

#87

Post by Lobby »

NullPointerExceptions are the main reason for crashes in Java programs :java :bb

User avatar
JustAnyone
Developer
Reactions:
Posts: 3474
Joined: 23 Jul 2017, 12:45
Location: Easter Island
Plugins: Showcase Store

Platform

Re: JAVA Learning Group

#88

Post by JustAnyone »

Version and device language checker.
Version and device language checker.

User avatar
Ahmad Nur Aizat
TheoTown Veteran
Reactions:
Posts: 8260
Joined: 25 Oct 2016, 15:20
Location: Johor Bahru
Plugins: Showcase Store
Version: Beta
Contact:

Plugin Creator

Platform

Re: JAVA Learning Group

#89

Post by Ahmad Nur Aizat »

The copyright info format is supposed to be like this:

©JustAnyone 2017

No need to put long words like Copyright, cause you already had the symbol

User avatar
JustAnyone
Developer
Reactions:
Posts: 3474
Joined: 23 Jul 2017, 12:45
Location: Easter Island
Plugins: Showcase Store

Platform

Re: JAVA Learning Group

#90

Post by JustAnyone »

Ahmad Nur Aizat wrote:
30 Sep 2017, 12:33
The copyright info format is supposed to be like this:

©JustAnyone 2017

No need to put long words like Copyright, cause you already had the symbol
Ok.
:bf

User avatar
JustAnyone
Developer
Reactions:
Posts: 3474
Joined: 23 Jul 2017, 12:45
Location: Easter Island
Plugins: Showcase Store

Platform

Re: JAVA Learning Group

#91

Post by JustAnyone »

I need a bug spray.

User avatar
Ahmad Nur Aizat
TheoTown Veteran
Reactions:
Posts: 8260
Joined: 25 Oct 2016, 15:20
Location: Johor Bahru
Plugins: Showcase Store
Version: Beta
Contact:

Plugin Creator

Platform

Re: JAVA Learning Group

#92

Post by Ahmad Nur Aizat »

Most of grocery stores have aerosols....

But I recommend you to buy the "child-friendly" ones

;P

User avatar
JustAnyone
Developer
Reactions:
Posts: 3474
Joined: 23 Jul 2017, 12:45
Location: Easter Island
Plugins: Showcase Store

Platform

Re: JAVA Learning Group

#93

Post by JustAnyone »

Permission to call is only used by Virtual JustAnyone if you type "kill kamile" or "kill auguste" it will dial their friend's number. (Gonna change to 911(maybe(idk))).

User avatar
CommanderABab
AB
Reactions:
Posts: 11086
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: JAVA Learning Group

#94

Post by CommanderABab »

DO NOT change them to 911. That is a lawbreaking offense!

User avatar
JustAnyone
Developer
Reactions:
Posts: 3474
Joined: 23 Jul 2017, 12:45
Location: Easter Island
Plugins: Showcase Store

Platform

Re: JAVA Learning Group

#95

Post by JustAnyone »

Actually I think I have a better idea. Make them listen to music for 10 minutes on loop!

User avatar
Lobby
Developer
Reactions:
Posts: 3705
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: JAVA Learning Group

#96

Post by Lobby »

In case you've ever wondered how a name generator might work:

Code: Select all

import java.util.Random;

/**
 * Created by Lobby on 10.04.2015.
 */
public class NameGenerator {

    private final static char[] CHARS = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

    private final static boolean[] IS_VOCAL = {true, false, false, false, true, false, false, false, true, false, false, false, false, false, true, false, false, false, false, false, true, false, false, false, false, false};

    private final static float[] P = {0.08f, 0.015f, 0.027f, 0.043f, 0.127f, 0.022f, 0.02f, 0.06f, 0.07f, 0.015f, 0.077f, 0.04f,
            0.024f, 0.067f, 0.075f, 0.019f, 0.0009f, 0.06f, 0.063f, 0.09f, 0.027f, 0.098f, 0.024f, 0.015f, 0.02f, 0.00074f};

    private final static float[] FIRST_P = {0.11f, 0.047f, 0.035f, 0.027f, 0.02f, 0.038f, 0.02f, 0.07f, 0.06f, 0.006f, 0.006f, 0.027f, 0.044f,
            0.024f, 0.063f, 0.025f, 0.0017f, 0.017f, 0.078f, 0.17f, 0.015f, 0.006f, 0.068f, 0.0001f, 0.016f, 0.003f};

    private Random rnd;

    public NameGenerator() {
        rnd = new Random();
    }

    public String generate() {
        int length = rnd.nextInt(5) + 3;

        int index = getProbIndex(i -> FIRST_P[i], CHARS.length);

        StringBuilder builder = new StringBuilder(length);
        builder.append(Character.toUpperCase(CHARS[index]));

        final int[] lastIndex = new int[] {index};
        final int[] lastLastIndex = new int[] {index};

        for (int i = 1; i < length; i++) {
            lastLastIndex[0] = lastIndex[0];
            lastIndex[0] = index;
            index = getProbIndex(idx -> {
                    if ((IS_VOCAL[idx] != IS_VOCAL[lastIndex[0]] || IS_VOCAL[idx]) &&
                            lastLastIndex[0] != idx) {
                        return P[idx];
                    }
                    return 0;
            }, CHARS.length);
            builder.append(CHARS[index]);
        }

        return builder.toString();
    }

    private int getProbIndex(ProbFilter filter, int length) {
        float sum = 0.f;

        for (int i = 0; i < length; i++) {
            sum += filter.prob(i);
        }

        float v = rnd.nextFloat() * sum;

        sum = 0.f;
        for (int i = 0; i < length; i++) {
            sum += filter.prob(i);
            if (sum > v) return i;
        }

        return length - 1;
    }

    interface ProbFilter {
        float prob(int i);
    }

    public static void main(String[] args) {
        NameGenerator nameGenerator = new NameGenerator();
        System.out.println(nameGenerator.generate());
    }
}
It heavily relays on probabilities for specific word sequences in English language.

User avatar
JustAnyone
Developer
Reactions:
Posts: 3474
Joined: 23 Jul 2017, 12:45
Location: Easter Island
Plugins: Showcase Store

Platform

Re: JAVA Learning Group

#97

Post by JustAnyone »

How do I make app save files to external storage from assets folder?

User avatar
Lobby
Developer
Reactions:
Posts: 3705
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: JAVA Learning Group

#98

Post by Lobby »

Create an InputStream from the file you want to write out and write bytes out manually. See here. The Android API doesn't help you much here.

User avatar
JustAnyone
Developer
Reactions:
Posts: 3474
Joined: 23 Jul 2017, 12:45
Location: Easter Island
Plugins: Showcase Store

Platform

Re: JAVA Learning Group

#99

Post by JustAnyone »

Finally found this topic.
I present you "Plugin Creator"!
*Poof*
I will help you create simple plugins without any knowledge.
NOTE: This is still testing version!
1.0
pluginmaker.apk
Plugin Maker 1.0
(2.36 MiB) Downloaded 85 times

User avatar
Josh
Graphic designer
Reactions:
Posts: 2214
Joined: 11 Mar 2017, 19:20
Location: The Netherlands
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: JAVA Learning Group

#100

Post by Josh »

JustAnyone wrote:
27 Nov 2017, 01:11
Finally found this topic.
I present you "Plugin Creator"!
*Poof*
I will help you create simple plugins without any knowledge.
NOTE: This is still testing version!
1.0
pluginmaker.apk
That's really cool, I hope you can keep improving the app!

Locked Previous topicNext topic

Return to “Smalltalk”