How to detect which dynamically created button inside a Fragment was clicked, from Activity?

I have a Fragment class that dynamically creates a grid of Buttons. An instance of that fragment is then created within the main activity which displays the grid. Here is my code: Grid.java public class Grid extends Fragment { LinearLayout myLayout; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState); myLayout = new … Continue reading “How to detect which dynamically created button inside a Fragment was clicked, from Activity?”

Libgdx shader changes texture

In my libgdx project I use a custom shader to create different color variations of a single grayscale character. I have a class “Shader” which holds static String variables for the vertex and fragment shaders. For each person I basically create a new shader, by replacing strings in the fragment shader string. For some reason, … Continue reading “Libgdx shader changes texture”

Executor Service setting the flag to stop the thread

I am running simple thread which has run method as follows public run() while(!stopFlag){ // print something Line 1 // print something Line 2 // print something Line 3 // print something Line 4 } If I run this thread through ExecutorService viz ExecutorService exs = Executors.newFixedThreadPool(5); exs.execute(new MyThread)); I stop the ExecutorService exs.shutdown(); But … Continue reading “Executor Service setting the flag to stop the thread”

i am unable to pass text using intent to another activity. unfortunately you app has stop

I try to pass data using intent and i keep getting error. everything else is working except for the intent 05-16 12:58:15.624 15880-15880/com.example.user.talk E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.user.talk, PID: 15880 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.user.talk/com.example.user.talk.UpdateActivity}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2318) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2396) at android.app.ActivityThread.access$800(ActivityThread.java:139) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:149) at android.app.ActivityThread.main(ActivityThread.java:5257) at java.lang.reflect.Method.invokeNative(Native Method) … Continue reading “i am unable to pass text using intent to another activity. unfortunately you app has stop”

Foreign Key Hibernate Annotation

I can not manage to make this simple foreign key constraint work. @Entity @Table(name = “wheel”) @Data public class WheelEntity { @Id @Column(name = “id”) @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; … @Entity @Table(name = “bike”) @Data public class BikeEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @ManyToOne(targetEntity = WheelEntity.class, fetch=FetchType.EAGER, cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE}) … Continue reading “Foreign Key Hibernate Annotation”

Comparing data numbers, Iterator.remove() throwing NullPointerException

I am trying to make an Android app that can compare integers. However, when I am trying to compare integers and I need to delete some entries because they are redundant or they do not fit in, I cannot use Iterator.remove() without encountering a NullPointerException. Here is the specific output: E/AndroidRuntime: FATAL EXCEPTION: main Process: … Continue reading “Comparing data numbers, Iterator.remove() throwing NullPointerException”

Unity : CommandInvokationFailure: Failed to recompile android resource files

I’m new to Unity. When trying to build the android apk, I have an compiling error. I updated Unity (5.6), SDK(24), JDK(1.8.0) Seems to have a problem with Java, however I don’t understand it. Does anyone ever had the same issue ? Thanks a lot. CommandInvokationFailure: Failed to recompile android resource files. /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/javac -bootclasspath “/Users/kwij1/Desktop/Android … Continue reading “Unity : CommandInvokationFailure: Failed to recompile android resource files”

Why i cannot quit this while loop(java)?

I am new here and i got into trouble about my coding, i hope someone could help me break this loop, cause no matter what i type, it always in the loop.My code is as follow: boolean flag = true; while(flag) { System.out.println(“Please enter the movie’s title:”); title = s.nextLine().trim(); if(title.trim().equals(“”)) { System.out.println(“Please do not … Continue reading “Why i cannot quit this while loop(java)?”

Java Swing – Draw Station Names using GPS Coordinates on JPanel

I am working on an assignment and got stuck at a certain point. I am given a .txt file with a series of stations, and I am supposed to draw the station names using the GPS coordinates given to me, but I can’t translate those coordinates to XY coordinates that a JPanel uses. Also, GPS … Continue reading “Java Swing – Draw Station Names using GPS Coordinates on JPanel”