

Step 2 Add the following code to res/layout/activitymain.xml. Step 1 Create a new project in Android Studio, go to File New Project and fill all required details to create a new project. Any help please because I am new to Android Studio? I have tried creating the onClickListener for the button but I am having problems in order to get an object of the current relative layout which I have in the XML. This example demonstrates about How do I center text horizontally and vertically in a TextView of Android.

Now I want that when I press this button, it creates 2 TextViews. : Attempt to invoke virtual method 'void (int)' on a null object referenceĪt .getView(PerrowAdapter.java:57)Īt (AbsListView.java:2494)Īt (HwAbsListView.java:1139)Īt (ListView.java:1446)Īt (ListView.java:1352)Īt (View.java:24742)Īt (RelativeLayout.java:735)Īt (RelativeLayout.java:481)Īt $asure(ConstraintLayout.java:792)Īt .asure(ConstraintWidgetContainer.java:583)Īt .(Direct.java:355)Īt .(Direct.java:636)Īt .(Direct.java:407)Īt .(Direct.java:446)Īt .(Direct.java:178)Īt .ConstraintWidgetContainer.layout(ConstraintWidgetContainer.java:642)Īt .(BasicMeasure.java:159)Īt .(BasicMeasure.java:290)Īt .asure(ConstraintWidgetContainer.java:119)Īt .resolveSystem(ConstraintLayout.java:1578)Īt .onMeasure(ConstraintLayout.java:1690)Īt .onMeasure(DrawerLayout.java:1119)Īt (ViewGroup.java:6903)Īt (FrameLayout.java:194)Īt .onMeasure(ContentFrameLayout.java:146)Īt (LinearLayout.java:1562)Īt (LinearLayout.java:849)Īt (LinearLayout.java:728)Īt .DecorView.onMeasure(DecorView.java:896)Īt (ViewRootImpl.java:3211)Īt (ViewRootImpl.java:1974)Į/AndroidRuntime: at (ViewRootImpl.java:2295)Īt have a relative layout in my XML file and it contains a button.

I/QarthLog: createDisableExceptionQarthFile I/BlockMonitor: dispatchingThrewException In MainThread Here the custom adapter code public class PerrowAdapter extends ArrayAdapter token= ĭ/HiTouch_PressGestureDetector: onAttached, package=, windowType=1, mHiTouchRestricted=false I am using the sharedpreferences for other activity in the app in the future, so thats why im using it. can anyone know what is the problems in my code ? everything was fine on the code, however when i try to launch it, the automaticcaly close and go to previous activity. So i was try to use seekbar to get progress value in a custom adapter for the listview.
