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?”

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”

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”

android Read text file from url and use as string

I am seriously baffled. i am new to android development i am currently trying to use Android Studio and the scenario is this, i have a text file which contains an mp4 link that i want to play when a button is pressed in my MainActivity. The problem is i need to read the text … Continue reading “android Read text file from url and use as string”

Android app submit button not working on sending gps data to mysql server

I’m trying to create a simple app that submits GPS data to a website MySql server but when I added the code for getting the GPS location the submit button stopped working Any help would be greatly appreciated public class MainActivity extends AppCompatActivity { EditText inputName; String currentTimeDate; TextView timeView, latView, lonView; double longitude, latitude; … Continue reading “Android app submit button not working on sending gps data to mysql server”

Android – Checking Permissions in a Separate Class

I found some other topics that touched on this, but the solutions did not work for me. I have a class PermissionsManager.java which contains the methods for checking permission, and I make a call to it in the MainActivity.java. I read from some people that I have to pass a Context and Activity to checkPermissions(), … Continue reading “Android – Checking Permissions in a Separate Class”

How can I drag and drop a marker in a limited area?

How can I drag and drop a marker in a limited area? For instance, a circle has 20 meters radius. User can only drag and drop inside the circle. Here is the code I’ve tried. map.setOnMapClickListener(new GoogleMap.OnMapClickListener() { @Override public void onMapClick(LatLng latLng) { mymarker.setPosition(latLng); mGoogleMap.animateCamera(CameraUpdateFactory.newLatLng(latLng)); } }); map.setOnMarkerDragListener(new GoogleMap.OnMarkerDragListener() { @Override public void onMarkerDragStart(Marker … Continue reading “How can I drag and drop a marker in a limited area?”

Spinners – get item selected from array

I have a spinner that gets populated from a text file stored on a web server. The contents of this text file are then stored in an ArrayList. My app is going to have the user add an item to this text file that they name themselves and therefore update the spinner. What I need … Continue reading “Spinners – get item selected from array”