Java Question Trying/failing to make a library to access game controllers

NeoTechni

Well-Known Member
Licensed User
Longtime User
InputDevice | Android Developers

I'm copying the code straight from here, and it fails:
GrepCode: com.example.android.apis.view.GameControllerInput (.java) - Class - Source Code View

B4X:
private SparseArray<InputDeviceState> mInputDeviceStates;
It red-lines InputDeviceState and says it can't be resolved to a type

B4X:
private GameView mGame;
Same for GameView

B4X:
private SummaryAdapter mSummaryAdapter;
And SummaryAdapter

I can't get the first 3 lines of code to work!

B4X:
/**
 * 
 */

import android.content.Context;
import android.os.Bundle;
import android.util.AttributeSet;
import android.util.SparseArray;
import android.util.SparseIntArray;
import android.view.InputDevice;
import android.view.InputEvent;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.InputDevice.MotionRange;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;

/**
 * @author Techni
 *
 */
public class Joystick {
    private static final String TAG = "GameControllerInput";

    private SparseArray<InputDeviceState> mInputDeviceStates;
    private GameView mGame;
    private SummaryAdapter mSummaryAdapter;
    
    
}
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
I wish these f****ing things would import all their dependencies instead of expecting me to guess at them.
 

thedesolatesoul

Expert
Licensed User
Longtime User
I wish these f****ing things would import all their dependencies instead of expecting me to guess at them.
If it is an import then it would. you just click on the red indicator to the left side of the code and it gives you the option.
But if its a class that you add yourself as a java source file then probably not.
Anyway, java is fun
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…