Ive been trying from a very long time to send a string from android app to esp8266 through Telnet. I wish to see the output on serial monitor of arduino IDE.I have used the code from send string to esp8266 via android using telnet
Here are the logs that Im getting on running my android code on connecting connect and send button.
01/18 20:02:32: Launching app
Cold swapped changes.
$ adb shell am start -n "com.example.manveenkaur.optimized/com.example.manveenkaur.optimized.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Connected to process 9556 on device samsung-sm_e700h-268ada67
I/InstantRun: Instant Run Runtime started. Android package is com.example.manveenkaur.optimized, real application class is null.
D/SecWifiDisplayUtil: Metadata value : none
W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
D/PhoneWindow: *FMB* installDecor mIsFloating : false
D/PhoneWindow: *FMB* installDecor flags : -2139029248
D/ViewRootImpl: Buffer Count from app info with ::-1 && -1 for :: com.example.manveenkaur.optimized from View :: -1 DBQ Enabled ::false false
D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
D/PhoneWindow: *FMB* isFloatingMenuEnabled mFloatingMenuBtn : null
D/PhoneWindow: *FMB* isFloatingMenuEnabled return false
I/Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: EGL 1.4 QUALCOMM build: (I716aebe4f9)
OpenGL ES Shader Compiler Version: E031.25.03.04
Build Date: 07/01/15 수
Local Branch: AU_LINUX_ANDROID_LA.BR.1.1.3_RB1.05.01.00.032.031_02060873_02063264
Remote Branch:
Local Patches:
Reconstruct Branch:
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Get maximum texture size. GL_MAX_TEXTURE_SIZE is 4096
D/OpenGLRenderer: Enabling debug mode 0
I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy#1e34142f time:924988396
D/ViewRootImpl: ViewPostImeInputStage ACTION_DOWN
D/ViewRootImpl: Buffer Count from app info with ::-1 && -1 for :: com.example.manveenkaur.optimized from View :: -1 DBQ Enabled ::false false
D/ViewRootImpl: ViewPostImeInputStage ACTION_DOWN
D/ViewRootImpl: ViewPostImeInputStage ACTION_DOWN
D/ViewRootImpl: ViewPostImeInputStage ACTION_DOWN`
1. I am unable to resolve this ACTION_DOWN statement
2. Also Id like to know what `Buffer Count from app info with ::-1 && -1 for :: com.example.manveenkaur.optimized from View :: -1 DBQ Enabled ::false false means
3. Further on clicking disconnect it shows me the following :-
W/System.err: java.io.IOException: BufferedInputStream is closed
W/System.err: at java.io.BufferedInputStream.streamClosed(BufferedInputStream.java:125)
W/System.err: at java.io.BufferedInputStream.read(BufferedInputStream.java:257)
W/System.err: at java.io.BufferedInputStream.read(BufferedInputStream.java:290)
W/System.err: at org.apache.commons.io.input.ProxyInputStream.read(ProxyInputStream.java:98)
W/System.err: at org.apache.commons.io.input.TeeInputStream.read(TeeInputStream.java:127)
W/System.err: at java.io.InputStreamReader.read(InputStreamReader.java:231)
W/System.err: at java.io.BufferedReader.fillBuf(BufferedReader.java:145)
W/System.err: at java.io.BufferedReader.readLine(BufferedReader.java:397)
W/System.err: at com.example.manveenkaur.optimized.PioneerController$1.run(PioneerController.java:41)
W/System.err: at java.lang.Thread.run(Thread.java:818)
Also
heres activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context="com.example.manveenkaur.optimized.MainActivity">
<EditText
android:id="#+id/EditTextMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:hint="#string/message"
android:inputType="text"></EditText>
<Button
android:id="#+id/sendButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="#string/send_button_text"></Button>
<Button
android:id="#+id/connectButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="#string/connect_button_text"></Button>
<Button
android:id="#+id/disconnectButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="#string/disconnect_button_text"></Button>
</LinearLayout>
</FrameLayout>
One question upfront: Are you using SoftwareSerial or HardwareSerial to talk to the ESP8266? Using SoftwareSerial is not going to make you happy.
Related
i am making login page so i have connected this app with firebase database there is email and password in database so i am trying to
Signinwithemailandpassword but it doesn't work whenever i try to run the apps it crashes
loginpage.java
public class loginpage extends AppCompatActivity {
ActivityLoginpageBinding binding;
Button loginbtn;
TextView login;
FirebaseAuth auth;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityLoginpageBinding.inflate(getLayoutInflater());
setContentView(R.layout.activity_loginpage);
login=findViewById(R.id.login);
auth=FirebaseAuth.getInstance();
loginbtn=findViewById(R.id.loginbtn);
loginbtn.setOnClickListener(new View.OnClickListener() {
final String email=binding.email.getText().toString();
final String password=binding.pwd.getText().toString();
#Override
public void onClick(View view) {
auth.signInWithEmailAndPassword(binding.email.getText().toString(),binding.pwd.getText().toString()).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
#Override
public void onComplete(#NonNull Task<AuthResult> task) {
if(task.isSuccessful()){
Intent intent=new Intent(loginpage.this,MainActivity.class);
startActivity(intent);
Toast.makeText(loginpage.this, "successfull", Toast.LENGTH_SHORT).show();
}
else{
Toast.makeText(loginpage.this, "failed", Toast.LENGTH_SHORT).show();
Log.d("MyTag", task.getException().getMessage());
}
}
});
}
});
login.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Intent intent=new Intent(loginpage.this,signup.class);
startActivity(intent);
}
});
}
}
loginpage.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".loginpage">
<TextView
android:id="#+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:text="Instagram"
android:textSize="30dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="#+id/imageView3"
android:layout_width="242dp"
android:layout_height="235dp"
android:layout_marginTop="32dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView14"
app:srcCompat="#drawable/instagram" />
<TextView
android:id="#+id/textView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Welcome to social world"
android:textSize="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/imageView3" />
<EditText
android:id="#+id/email"
android:layout_width="297dp"
android:layout_height="49dp"
android:layout_marginTop="44dp"
android:background="#drawable/inputbg"
android:ems="10"
android:hint="Email"
android:inputType="textPersonName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.491"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView16" />
<EditText
android:id="#+id/pwd"
android:layout_width="297dp"
android:layout_height="49dp"
android:layout_marginTop="16dp"
android:background="#drawable/inputbg"
android:ems="10"
android:hint="Password"
android:inputType="textPersonName"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.491"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/email"
app:layout_constraintVertical_bias="0.017" />
<Button
android:id="#+id/loginbtn"
android:layout_width="298dp"
android:layout_height="51dp"
android:layout_marginTop="36dp"
android:text="login"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.495"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/pwd" />
<TextView
android:id="#+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Don't have a account? "
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#+id/login"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/loginbtn"
app:layout_constraintVertical_bias="0.859" />
<TextView
android:id="#+id/login"
android:layout_width="63dp"
android:layout_height="18dp"
android:text="Sign up!"
android:textColor="#F10606"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/textView15"
app:layout_constraintTop_toBottomOf="#+id/loginbtn"
app:layout_constraintVertical_bias="0.86" />
</androidx.constraintlayout.widget.ConstraintLayout>`
Error
12/24 12:13:07: Launching 'app' on Pixel 5 API 26.
App restart successful without requiring a re-install.
$ adb shell am start -n "com.example.instagram/com.example.instagram.signup" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Connected to process 28962 on device 'Pixel_5_API_26 [emulator-5554]'.
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
I/zygote: Late-enabling -Xcheck:jni
W/zygote: Unexpected CPU variant for X86 using defaults: x86
I/FirebaseApp: Device unlocked: initializing all Firebase APIs for app [DEFAULT]
W/zygote: Skipping duplicate class check due to unrecognized classloader
I/DynamiteModule: Considering local module com.google.android.gms.measurement.dynamite:86 and remote module com.google.android.gms.measurement.dynamite:15
I/DynamiteModule: Selected local version of com.google.android.gms.measurement.dynamite
D/FirebaseAuth: Notifying id token listeners about user ( xmoP2dPpYhUD9acalVCdTqBiJ7e2 ).
I/FirebaseInitProvider: FirebaseApp initialization successful
I/zygote: Background concurrent copying GC freed 5896(1215KB) AllocSpace objects, 2(40KB) LOS objects, 62% free, 910KB/2MB, paused 1.368ms total 117.164ms
V/FA: onActivityCreated
V/FA: App measurement collection enabled
V/FA: App measurement enabled for app package, google app id: com.example.instagram, 1:582042892352:android:f97df8209dee5aa33f87a5
I/FA: App measurement initialized, version: 74029
I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
I/FA: To enable faster debug mode event logging run:
adb shell setprop debug.firebase.analytics.app com.example.instagram
D/FA: Debug-level message logging enabled
D/FA: Resetting session stitching token to not null
I/zygote: NativeAllocBackground concurrent copying GC freed 4528(591KB) AllocSpace objects, 7(140KB) LOS objects, 59% free, 1046KB/2MB, paused 3.590ms total 105.851ms
V/FA: Connecting to remote service
V/FA: Detected application was in foreground
V/FA: Session started, time: 37468155
I/zygote: Do partial code cache collection, code=30KB, data=30KB
V/FA: Connection attempt already in progress
I/zygote: After code cache collection, code=24KB, data=28KB
I/zygote: Increasing code cache capacity to 128KB
I/FA: Tag Manager is not found and thus will not be used
I/zygote: Do partial code cache collection, code=24KB, data=46KB
I/zygote: After code cache collection, code=24KB, data=46KB
I/zygote: Increasing code cache capacity to 256KB
I/zygote: JIT allocated 71KB for compiled code of void android.widget.TextView.<init>(android.content.Context, android.util.AttributeSet, int, int)
I/zygote: Compiler allocated 4MB to compile void android.widget.TextView.<init>(android.content.Context, android.util.AttributeSet, int, int)
D/OpenGLRenderer: HWUI GL Pipeline
V/FA: Connection attempt already in progress
I/chatty: uid=10097(u0_a97) Measurement Wor identical 1 line
V/FA: Connection attempt already in progress
V/FA: Activity resumed, time: 37468263
V/FA: Connection attempt already in progress
V/FA: Connection attempt already in progress
D/: HostConnection::get() New Host Connection established 0x9f3f98c0, tid 29000
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 1
D/EGL_emulation: eglCreateContext: 0x9f4d4620: maj 2 min 0 rcv 2
D/EGL_emulation: eglMakeCurrent: 0x9f4d4620: ver 2 0 (tinfo 0x9f6ff450)
D/EGL_emulation: eglMakeCurrent: 0x9f4d4620: ver 2 0 (tinfo 0x9f6ff450)
I/Choreographer: Skipped 51 frames! The application may be doing too much work on its main thread.
D/FA: Connected to remote service
V/FA: Processing queued up service tasks: 7
W/View: dispatchProvideAutofillStructure(): not laid out, ignoring
I/AssistStructure: Flattened final assist data: 3448 bytes, containing 1 windows, 12 views
I/zygote: Do full code cache collection, code=124KB, data=61KB
I/zygote: After code cache collection, code=120KB, data=46KB
V/FA: Inactivity, disconnecting from the service
I/zygote: Do partial code cache collection, code=122KB, data=50KB
I/zygote: After code cache collection, code=122KB, data=50KB
I/zygote: Increasing code cache capacity to 512KB
V/FA: Recording user engagement, ms: 54118
V/FA: onActivityCreated
V/FA: Connecting to remote service
V/FA: Connection attempt already in progress
V/FA: Activity paused, time: 37522383
V/FA: Activity resumed, time: 37522548
V/FA: Connection attempt already in progress
V/FA: Connection attempt already in progress
D/EGL_emulation: eglMakeCurrent: 0x9f4d4620: ver 2 0 (tinfo 0x9f6ff450)
D/FA: Connected to remote service
V/FA: Processing queued up service tasks: 4
W/View: dispatchProvideAutofillStructure(): not laid out, ignoring
I/AssistStructure: Flattened final assist data: 2780 bytes, containing 1 windows, 10 views
I/zygote: Do full code cache collection, code=249KB, data=167KB
I/zygote: After code cache collection, code=249KB, data=134KB
V/FA: Inactivity, disconnecting from the service
I/zygote: Do partial code cache collection, code=249KB, data=139KB
I/zygote: After code cache collection, code=249KB, data=139KB
I/zygote: Increasing code cache capacity to 1024KB
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.instagram, PID: 28962
java.lang.IllegalArgumentException: Given String is empty or null
at com.google.android.gms.common.internal.Preconditions.checkNotEmpty(com.google.android.gms:play-services-basement##18.1.0:2)
at com.google.firebase.auth.FirebaseAuth.signInWithEmailAndPassword(com.google.firebase:firebase-auth##21.1.0:1)
at com.example.instagram.loginpage$1.onClick(loginpage.java:44)
at android.view.View.performClick(View.java:6256)
at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:1219)
at android.view.View$PerformClick.run(View.java:24701)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
need to find out the mistake and why app crashes
Where have you set the values for the email and password when you are authenticating with firebase?
In your code, you are doing binding.email.getText().toString() and binding.pwd.getText().toString(). These are potentially empty as I am not seeing you set the value of those views either in your xml or in your code and hence the exception is being thrown.
Just try setting those in your xml or via code and try authentication, it should work.
This question already has answers here:
android.content.res.Resources$NotFoundException: Resource ID #0x7f07006e
(3 answers)
Unfortunately MyApp has stopped. How can I solve this?
(23 answers)
Closed 2 years ago.
This is a weird and I'm not sure what I have done wrong. The app installs perfectly fine on my Samsung J7 but as soon as I move from the MainActivity to the ScheduleActivity it crashes. On the other hand my fiance who lives in the the Netherlands has a Huawei Mate 20 pro and she can use it fine. I've sent her many iterations and she just updates the app and uses it. I built this app with mvc architecture so there are no calls to the database or model. I'll include the layout, some images, and the java code. If I can add anything else please let me know. Thank you for your help solving this.
MainActvity:
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button scheduleButton = findViewById(R.id.schedule_button);
scheduleButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this, ScheduleActivity.class);
startActivity(intent);
}
});
}
activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/grade"
android:orientation="vertical"
tools:context=".MainActivity">
<ImageView
android:id="#+id/rest_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="#string/rest_meaning"
android:src="#drawable/rest_logo_update"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<Button
android:id="#+id/schedule_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:attr/borderlessButtonStyle"
android:layout_marginEnd="36dp"
android:layout_marginBottom="16dp"
android:background="#drawable/button_state"
android:padding="8dp"
android:text="#string/schedule_text"
android:textColor="#drawable/button_text_color"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="#+id/rest_img"
app:layout_constraintVertical_bias="1.0" />
</androidx.constraintlayout.widget.ConstraintLayout>
How the main layout looks:
Also here is a visual on the apps structure:
All I am doing is moving from the main package to the ui package and accessing the ScheduleActvity which has this code:
public class ScheduleActivity extends AppCompatActivity implements View.OnClickListener {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_schedule);
Button mondayButton = findViewById(R.id.monday_button);
Button tuesdayButton = findViewById(R.id.tuesday_button);
Button wednesdayButton = findViewById(R.id.wednesday_button);
Button thursdayButton = findViewById(R.id.thursday_button);
Button fridayButton = findViewById(R.id.friday_button);
Button saturdayButton = findViewById(R.id.saturday_button);
Button sundayButton = findViewById(R.id.sunday_button);
mondayButton.setOnClickListener(this);
tuesdayButton.setOnClickListener(this);
wednesdayButton.setOnClickListener(this);
thursdayButton.setOnClickListener(this);
fridayButton.setOnClickListener(this);
saturdayButton.setOnClickListener(this);
sundayButton.setOnClickListener(this);
}
#Override
public void onClick(View view) {
switch (view.getId()){
case R.id.monday_button:
Intent monday_intent = new Intent(ScheduleActivity.this, MondayActivity.class);
startActivity(monday_intent);
break;
case R.id.tuesday_button:
Intent tuesday_intent = new Intent(ScheduleActivity.this, TuesdayActivity.class);
startActivity(tuesday_intent);
break;
case R.id.wednesday_button:
Intent wednesday_intent = new Intent(ScheduleActivity.this, WednesdayActivity.class);
startActivity(wednesday_intent);
break;
case R.id.thursday_button:
Intent thursday_intent = new Intent(ScheduleActivity.this, ThursdayActivity.class);
startActivity(thursday_intent);
break;
case R.id.friday_button:
Intent friday_intent = new Intent(ScheduleActivity.this, FridayActivity.class);
startActivity(friday_intent);
break;
case R.id.saturday_button:
Intent saturday_intent = new Intent(ScheduleActivity.this, SaturdayActivity.class);
startActivity(saturday_intent);
case R.id.sunday_button:
Intent sunday_intent = new Intent(ScheduleActivity.this, SundayActivity.class);
startActivity(sunday_intent);
}
}
This is the respective layout file activity_schedule which has these buttons:
<Button
android:id="#+id/thursday_button"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="8dp"
android:background="#drawable/button_state"
android:text="#string/thursday"
android:textColor="#drawable/button_text_color"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/monday_button" />
And looks like this (I so badly wish I could easily add a drop shadow to the image):
The buttons lead to a given day you want to know more about such as ThursdayActivity or MondayActvity (I'm still not sure on the ui but I'm getting closer):
All of the daysoftheweek activities look the same as this and this ThursdayActivity:
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_thursday);
//groupsArrayList = new ArrayList<>(); --debug
DatabaseHandler db = new DatabaseHandler(ThursdayActivity.this);
/* Uncomment and insert the group data*/
db.thursdayAddGroup(new Groups("Thursday","Daily reflection|Just for Today","9:00 AM","10:00 AM"));
db.thursdayAddGroup(new Groups("Thursday","12 Step|Sponsorship","12:00 PM","1:00 PM"));
db.thursdayAddGroup(new Groups("Thursday","HVN (Hearing voices network)","1:15 PM","2:45 PM"));
db.thursdayAddGroup(new Groups("Thursday","WRAP","3:00 PM","4:00 PM"));
TextView thursdayGroupNameOne = findViewById(R.id.thursday_group_name_one);
TextView thursdayGroupStartTimeOne = findViewById(R.id.thursday_group_start_time_one);
TextView thursdayGroupEndTimeOne = findViewById(R.id.thursday_group_end_time_one);
/* Explicitly indexing the database objects */
List<Groups> groupsList = db.getAllThursdayGroups();
thursdayGroupNameOne.setText(groupsList.get(0).getGroupDay());
thursdayGroupStartTimeOne.setText(groupsList.get(0).getGroupStartTime()); thursdayGroupEndTimeOne.setText(groupsList.get(0).getGroupEndTime());
All daysoftheweek layouts have a cardview that contain the textviews to get and display the data from the database set in the given activity such as this actvity_thursday.xml:
<androidx.cardview.widget.CardView
android:id="#+id/cardView"
android:layout_width="300dp"
android:layout_height="330dp"
android:layout_marginTop="16dp"
android:foregroundGravity="center"
android:orientation="vertical"
app:cardPreventCornerOverlap="false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.495"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/grade_two">
<TextView
android:id="#+id/thursday_group_name_one"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:text="#string/group_name"
android:textColor="#android:color/black"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/thursday_group_start_time_one"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:text="#string/start_time"
android:textColor="#android:color/black"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="#+id/thursday_group_name_one" />
<TextView
android:id="#+id/thursday_group_end_time_one"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginEnd="108dp"
android:text="#string/end_time"
android:textColor="#android:color/black"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="#+id/thursday_group_name_one" />
<TextView
android:id="#+id/dash_one"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:text="#string/dash"
android:textColor="#android:color/black"
android:textSize="16sp"
app:layout_constraintEnd_toStartOf="#+id/thursday_group_end_time_one"
app:layout_constraintStart_toEndOf="#+id/thursday_group_start_time_one"
app:layout_constraintTop_toBottomOf="#+id/thursday_group_name_one" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
Got the crash log for my device:
06-24 07:50:27.826 22232-22232/? E/Zygote: v2
06-24 07:50:27.826 22232-22232/? I/libpersona: KNOX_SDCARD checking this for 10171
06-24 07:50:27.826 22232-22232/? I/libpersona: KNOX_SDCARD not a persona
06-24 07:50:27.826 22232-22232/? W/SELinux: Function: selinux_compare_spd_ram, index[1], priority [2], priority version is VE=SEPF_SECMOBILE_6.0.1_0035
06-24 07:50:27.826 22232-22232/? E/Zygote: accessInfo : 0
06-24 07:50:27.826 22232-22232/? W/SELinux: SELinux: seapp_context_lookup: seinfo=default, level=s0:c512,c768, pkgname=com.wesleyruede.rest
06-24 07:50:27.826 22232-22232/? I/art: Late-enabling -Xcheck:jni
06-24 07:50:27.866 22232-22232/? D/ActivityThread: Added TimaKeyStore provider
06-24 07:50:27.896 22232-22232/? W/ResourcesManager: Resource getTopLevelResources for package com.wesleyruede.restoverlayDirs =Null
06-24 07:50:27.916 22232-22232/com.wesleyruede.rest W/System: ClassLoader referenced unknown path: /data/app/com.wesleyruede.rest-1/lib/arm
06-24 07:50:27.916 22232-22232/com.wesleyruede.rest D/ContextRelationManager: ContextRelationManager() : FEATURE_ENABLED=true
06-24 07:50:27.936 22232-22232/com.wesleyruede.rest W/ResourcesManager: Resource getTopLevelResources for package com.wesleyruede.restoverlayDirs =Null
06-24 07:50:27.956 22232-22232/com.wesleyruede.rest W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
06-24 07:50:27.996 22232-22232/com.wesleyruede.rest I/art: Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$2>
06-24 07:50:27.996 22232-22232/com.wesleyruede.rest I/art: Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$2>
06-24 07:50:28.136 22232-22232/com.wesleyruede.rest D/TextView: setTypeface with style : 0
06-24 07:50:28.156 22232-22232/com.wesleyruede.rest D/ViewRootImpl: #1 mView = com.android.internal.policy.PhoneWindow$DecorView{a799c60 I.E...... R.....ID 0,0-0,0}
06-24 07:50:28.156 22232-22232/com.wesleyruede.rest D/SecWifiDisplayUtil: Metadata value : SecSettings2
06-24 07:50:28.156 22232-22253/com.wesleyruede.rest D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
06-24 07:50:28.216 22232-22253/com.wesleyruede.rest I/Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_LA.UM.5.3_RB1.06.00.01.211.047_msm8937_32_refs/tags/AU_LINUX_ANDROID_LA.UM.5.3_RB1.06.00.01.211.047__release_AU (I88e9891e40)
OpenGL ES Shader Compiler Version: XE031.08.00.00
Build Date: 08/09/16 Tue
Local Branch:
Remote Branch: refs/tags/AU_LINUX_ANDROID_LA.UM.5.3_RB1.06.00.01.211.047
Local Patches: NONE
Reconstruct Branch: NOTHING
06-24 07:50:28.226 22232-22253/com.wesleyruede.rest I/OpenGLRenderer: Initialized EGL, version 1.4
06-24 07:50:28.266 22232-22232/com.wesleyruede.rest D/ViewRootImpl: MSG_RESIZED_REPORT: ci=Rect(0, 48 - 0, 0) vi=Rect(0, 48 - 0, 0) or=1
06-24 07:50:28.286 22232-22253/com.wesleyruede.rest D/libGLESv1: DTS_GLAPI : DTS is not allowed for Package : com.wesleyruede.rest
06-24 07:50:28.316 22232-22253/com.wesleyruede.rest E/libGLESv2: HWUI Protection: wrong call from hwui context F: ES3-glCreateShaderSEC
06-24 07:50:28.316 22232-22253/com.wesleyruede.rest E/libGLESv2: HWUI Protection: wrong call from hwui context F: ES3-glCreateShaderSEC
06-24 07:50:28.326 22232-22253/com.wesleyruede.rest E/libGLESv2: HWUI Protection: wrong call from hwui context F: ES3-glCreateProgramSEC
06-24 07:50:28.376 22232-22253/com.wesleyruede.rest E/libGLESv2: HWUI Protection: wrong call from hwui context F: ES3-glCreateShaderSEC
06-24 07:50:28.376 22232-22253/com.wesleyruede.rest E/libGLESv2: HWUI Protection: wrong call from hwui context F: ES3-glCreateShaderSEC
06-24 07:50:28.386 22232-22253/com.wesleyruede.rest E/libGLESv2: HWUI Protection: wrong call from hwui context F: ES3-glCreateProgramSEC
06-24 07:50:28.406 22232-22253/com.wesleyruede.rest E/libGLESv2: HWUI Protection: wrong call from hwui context F: ES3-glCreateShaderSEC
06-24 07:50:28.406 22232-22253/com.wesleyruede.rest E/libGLESv2: HWUI Protection: wrong call from hwui context F: ES3-glCreateShaderSEC
06-24 07:50:28.416 22232-22253/com.wesleyruede.rest E/libGLESv2: HWUI Protection: wrong call from hwui context F: ES3-glCreateProgramSEC
06-24 07:50:28.426 22232-22253/com.wesleyruede.rest E/libGLESv2: HWUI Protection: wrong call from hwui context F: ES3-glCreateShaderSEC
06-24 07:50:28.426 22232-22253/com.wesleyruede.rest E/libGLESv2: HWUI Protection: wrong call from hwui context F: ES3-glCreateProgramSEC
06-24 07:50:28.446 22232-22232/com.wesleyruede.rest I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy#81b441d time:3489958
06-24 07:50:50.296 22232-22232/com.wesleyruede.rest D/ViewRootImpl: ViewPostImeInputStage processPointer 0
06-24 07:50:50.356 22232-22232/com.wesleyruede.rest D/ViewRootImpl: ViewPostImeInputStage processPointer 1
06-24 07:50:50.366 22232-22232/com.wesleyruede.rest I/Timeline: Timeline: Activity_launch_request id:com.wesleyruede.rest time:3511872
06-24 07:50:50.416 22232-22232/com.wesleyruede.rest D/TextView: setTypeface with style : 0
06-24 07:50:50.416 22232-22232/com.wesleyruede.rest D/TextView: setTypeface with style : 0
06-24 07:50:50.426 22232-22232/com.wesleyruede.rest D/TextView: setTypeface with style : 0
06-24 07:50:50.426 22232-22232/com.wesleyruede.rest D/TextView: setTypeface with style : 0
06-24 07:50:50.426 22232-22232/com.wesleyruede.rest D/TextView: setTypeface with style : 0
06-24 07:50:50.426 22232-22232/com.wesleyruede.rest D/TextView: setTypeface with style : 0
06-24 07:50:50.426 22232-22232/com.wesleyruede.rest D/TextView: setTypeface with style : 0
06-24 07:50:50.426 22232-22232/com.wesleyruede.rest D/TextView: setTypeface with style : 0
06-24 07:50:50.426 22232-22232/com.wesleyruede.rest W/ResourceType: Failure getting entry for 0x7f080068 (t=7 e=104) (error -75)
06-24 07:50:50.436 22232-22232/com.wesleyruede.rest W/ResourceType: Failure getting entry for 0x7f080068 (t=7 e=104) (error -75)
06-24 07:50:50.436 22232-22232/com.wesleyruede.rest D/AndroidRuntime: Shutting down VM
06-24 07:50:50.436 22232-22232/com.wesleyruede.rest E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.wesleyruede.rest, PID: 22232
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.wesleyruede.rest/com.wesleyruede.rest.ui.ScheduleActivity}: android.view.InflateException: Binary XML file line #118: Binary XML file line #118: Error inflating class ImageView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3322)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3418)
at android.app.ActivityThread.access$1100(ActivityThread.java:231)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1823)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7422)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: android.view.InflateException: Binary XML file line #118: Binary XML file line #118: Error inflating class ImageView
at android.view.LayoutInflater.inflate(LayoutInflater.java:551)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:555)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
at com.wesleyruede.rest.ui.ScheduleActivity.onCreate(ScheduleActivity.java:22)
at android.app.Activity.performCreate(Activity.java:6904)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3269)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3418)
at android.app.ActivityThread.access$1100(ActivityThread.java:231)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1823)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7422)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: android.view.InflateException: Binary XML file line #118: Error inflating class ImageView
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:794)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:847)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810)
at android.view.LayoutInflater.inflate(LayoutInflater.java:527)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:555)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
at com.wesleyruede.rest.ui.ScheduleActivity.onCreate(ScheduleActivity.java:22)
at android.app.Activity.performCreate(Activity.java:6904)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3269)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3418)
at android.app.ActivityThread.access$1100(ActivityThread.java:231)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1823)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7422)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f080068
at android.content.res.Resources.getValue(Resources.java:2598)
at androidx.appcompat.widget.ResourceManagerInternal.loadDrawableFromDelegates(ResourceManagerInternal.java:252)
at androidx.appcompat.widget.ResourceManagerInternal.getDrawable(ResourceManagerInternal.java:139)
at androidx.appcompat.widget.ResourceManagerInternal.getDrawable(ResourceManagerInternal.java:132)
at androidx.appcompat.content.res.AppCompatResources.getDrawable(AppCompatResources.java:104)
at androidx.appcompat.widget.AppCompatImageHelper.loadFromAttributes(AppCompatImageHelper.java:59)
at androidx.appcompat.widget.AppCompatImageView.<init>(AppCompatImageView.java:78)
at androidx.appcompat.widget.AppCompatImageView.<init>(AppCompatImageView.java:68)
at androidx.appcompat.app.AppCompatViewInflater.createImageView(AppCompatViewInflater.java:187)
at androidx.appcompat.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:107)
at androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1407)
at androidx.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1457)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:758)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:847)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810)
at android.view.LayoutInflater.inflate(LayoutInflater.java:527)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:555)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
at com.wesleyruede.rest.ui.ScheduleActivity.onCreate(ScheduleActivity.java:22)
at android.app.Activity.performCreate(Activity.java:6904)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3269)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3418)
at android.app.ActivityThread.access$1100(ActivityThread.java:231)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1823)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7422)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
I hope this isn't too much and I did remove all unnecessary code so as not to throw the whole thing at you. Thanks truly, Wes.
Building an app in Android Studio. In the logcat I get an infinite display of:
"I/art: Enter while loop."
The app works like a charm but it still looks weird. On Google I couldn't find anything and here on stack I found one reference with a very specific situation and a very specific solution.
Problem is that in my case it even shows up when I just run an 'empty activity' on my phone.
Currently using: API 19: Android 4.4 (KitKat) but have also tried on higher API's.
If any other files (gradle/manifest) are needed please let me know, hope someone can tell me whats going on (or maybe this is even normal?).
Thanks.
JAVA file
package com.example.xxxxxxx.myapplication;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
XML file
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.xxxxxxx.myapplication.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
Logcat
W/System: ClassLoader referenced unknown path: /data/app/com.example.xxxxxxx.myapplication-1/lib/arm
I/InstantRun: starting instant run server: is main process
W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
I/art: Enter while loop.
V/PhoneWindow: DecorView setVisiblity: visibility = 4, Parent = null, this = DecorView#a600dae[]
D/WindowClient: Add to mViews: DecorView#a600dae[MainActivity], this = android.view.WindowManagerGlobal#19554c2
D/OpenGLRenderer: Dumper init 2 threads <0xa132b480>
D/OpenGLRenderer: <com.example.xxxxxxx.myapplication> is running.
D/OpenGLRenderer: CanvasContext() 0x9fdc1800
D/GraphicBuffer: register, handle(0x9fd86870) (w:576 h:576 s:576 f:0x1 u:0x000100)
D/ViewRootImpl[MainActivity]: hardware acceleration is enabled, this = ViewRoot{c7462d3 com.example.xxxxxxx.myapplication/com.example.xxxxxxx.myapplication.MainActivity,ident = 0}
V/PhoneWindow: DecorView setVisiblity: visibility = 0, Parent = ViewRoot{c7462d3 com.example.xxxxxxx.myapplication/com.example.xxxxxxx.myapplication.MainActivity,ident = 0}, this = DecorView#a600dae[MainActivity]
D/Surface: Surface::allocateBuffers(this=0x94d6d700)
D/OpenGLRenderer: CanvasContext() 0x9fdc1800 initialize window=0x94d6d700, title=com.example.xxxxxxx.myapplication/com.example.xxxxxxx.myapplication.MainActivity
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 1
D/OpenGLRenderer: Created EGL context (0xaa2bdb80)
D/OpenGLRenderer: ProgramCache.init: enable enhancement 1
I/OpenGLRenderer: Get disable program binary service property (0)
I/OpenGLRenderer: Initializing program atlas...
I/ProgramBinary/Service: ProgramBinaryService client side disable debugging.
I/ProgramBinary/Service: ProgramBinaryService client side disable binary content debugging.
D/ProgramBinary/Service: BpProgramBinaryService.getReady
D/ProgramBinary/Service: BpProgramBinaryService.getProgramBinaryData
I/OpenGLRenderer: Program binary detail: Binary length is 91876, program map length is 124.
I/OpenGLRenderer: Succeeded to mmap program binaries. File descriptor is 65, and path is /dev/ashmem.
I/OpenGLRenderer: No need to use file discriptor anymore, close fd(65).
D/OpenGLRenderer: Initializing program cache from 0x0, size = -1
I/[MALI][Gralloc]: dlopen libsec_mem.so fail
D/Surface: Surface::connect(this=0x94d6d700,api=1)
W/libEGL: [ANDROID_RECORDABLE] format: 1
D/Surface: Surface::setBufferCount(this=0x94d6d700,bufferCount=4)
W/art: Before Android 4.1, method int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
V/InputMethodManager: onWindowFocus: null softInputMode=288 first=true flags=#81810100
D/GraphicBuffer: register, handle(0x9fd86bf0) (w:480 h:800 s:480 f:0x1 u:0x000f02)
D/OpenGLRenderer: CacheTexture 3 upload: x, y, width height = 0, 0, 1024, 155
D/OpenGLRenderer: ProgramCache.generateProgram: 0
D/OpenGLRenderer: ProgramCache.generateProgram: 34359738371
D/OpenGLRenderer: ProgramCache.generateProgram: 240518168576
I/art: Enter while loop.
I/art: Enter while loop.
I/art: Enter while loop.
I/art: Enter while loop.
I/art: Enter while loop.
I/art: Enter while loop.
I/art: Enter while loop.
I/art: Enter while loop.
I/art: Enter while loop.
I/art: Enter while loop.
I/art: Enter while loop.
I/art: Enter while loop.
.... etc.
MANIFEST
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.xxxxxxx.myapplication">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
GRADLE
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.example.xxxxxxx.myapplication"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
Though I don't see evident reasons for the problem in your empty Activity, in my case it was some logics excessively repeated many times and overloading Android Runtime what made screen be held for some time and a I/art: Enter while loop. message in console logs.
The problem was solved by reducing logics to only one pass. You can also try doing it on a separate thread.
It looks like it's some kind of debugging message what was left in Android Studio or some of the dependencies your software has.
You should try to update every library, the Android Studio and it's components to latest version and that will solve the issue.
Note 0:
At least try this code and let us know if it works for you or not. Because in theory this should work, but it doesn't
Note 1:
There is no error in this code it simply doesn't work if you are on any Constraint layout above alpha-7. However, I'm putting the logcat.
MainActivity.java:
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FragmentManager mFragmentManager = getSupportFragmentManager();
FragmentTransaction mFragmentTransaction = mFragmentManager.beginTransaction();
Fragment fragment = new stupid();
mFragmentTransaction
.add(R.id.main_activity, fragment, "stupid")
.addToBackStack("stupid")
.commit();
}
}
activity_main.xml:
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/main_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorPrimary"
android:clickable="true"
android:fitsSystemWindows="true"
tools:context=".MainActivity">
<TextView
android:text="Hi 1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:layout_editor_absoluteY="13dp"
tools:layout_editor_absoluteX="18dp"
android:id="#+id/textView" />
</android.support.constraint.ConstraintLayout>
Stupid.java:
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* A simple {#link Fragment} subclass.
*/
public class stupid extends Fragment {
public stupid() {
// Required empty public constructor
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_stupid, container, false);
}
}
fragment_stupid.xml:
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx.stupid">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/hello_blank_fragment"
android:id="#+id/textView2"
tools:layout_constraintTop_creator="1"
tools:layout_constraintLeft_creator="1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="136dp" />
</android.support.constraint.ConstraintLayout>
Log:
12-04 10:28:30.965 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx I/art: Late-enabling -Xcheck:jni
12-04 10:28:31.015 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx I/InstantRun: Instant Run Runtime started. Android package is xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx, real application class is null.
12-04 10:28:31.299 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx W/art: Failed to find OatDexFile for DexFile /data/data/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx/files/instant-run/dex/slice-slice_1-classes.dex ( canonical path /data/data/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx/files/instant-run/dex/slice-slice_1-classes.dex) with checksum 0xe09cbad0 in OatFile /data/data/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx/cache/slice-slice_1-classes.dex
12-04 10:28:31.512 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx I/LoadedApk: No resource references to update in package common
12-04 10:28:31.512 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx I/LoadedApk: No resource references to update in package com.brit.swiftdark
12-04 10:28:31.809 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx W/ResourceType: For resource 0x01030224, entry index(548) is beyond type entryCount(29)
12-04 10:28:31.809 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx W/ResourceType: For resource 0x01030224, entry index(548) is beyond type entryCount(29)
12-04 10:28:31.843 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
12-04 10:28:31.947 12609-12726/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
12-04 10:28:31.956 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx D/Atlas: Validating map...
12-04 10:28:31.996 12609-12726/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx I/Adreno: QUALCOMM build : 065751b,
Build Date : 04/15/15
OpenGL ES Shader Compiler Version: E031.25.03.07
Local Branch :
Remote Branch : quic/LA.BF64.1.2.1_rb2.9
Remote Branch : NONE
Reconstruct Branch : AU_LINUX_ANDROID_LA.BF64.1.2.1_RB2.05.01.00.081.016 + 065751b + NOTHING
12-04 10:28:32.003 12609-12726/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx I/OpenGLRenderer: Initialized EGL, version 1.4
12-04 10:28:32.011 12609-12726/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx D/OpenGLRenderer: Enabling debug mode 0
12-04 10:28:32.069 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy#22f2f04f time:200835125
Edit 1:
Alpha-7
Beta-4
Please refer to this post for an answer .... ConstraintLayout 1.0.2 shows nothing
I know this is both "This post and the linked post" are mine, also the answer. But I been looking for an answer for almost a year. I finally found that older versions of ConstraintLayout will, for some reason, be added on top of the activity. Newer versions of ConstraintLayout fragment will be put in back of the activity. or at least that's what it looks to me. That's why I'm saying make your activity transparent.
I am totally new with android, i created an app with basic activity and then added a button to direct to another activity, it worked but whenever i click the button to go to the new activity page the app get crashed
am getting the following error:
10/02 15:22:04: Launching app
$ adb push C:\Users\Ahmed\AndroidStudioProjects\Shiftind\app\build\outputs\apk\app-debug.apk /data/local/tmp/com.shiftind.www.shiftind
$ adb shell pm install -r "/data/local/tmp/com.shiftind.www.shiftind"
Success
$ adb shell am start -n "com.shiftind.www.shiftind/com.shiftind.www.shiftind.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..Waiting for process to come online
Connected to process 2284 on device emulator-5554
W/System: ClassLoader referenced unknown path: /data/app/com.shiftind.www.shiftind-2/lib/x86
I/InstantRun: Instant Run Runtime started. Android package is com.shiftind.www.shiftind, real application class is null.
W/System: ClassLoader referenced unknown path: /data/app/com.shiftind.www.shiftind-2/lib/x86
W/art: Verification of android.support.v4.media.session.MediaControllerCompat android.support.v4.app.FragmentActivity.getSupportMediaController() took 420.734ms
W/art: Verification of void android.support.v4.app.FragmentActivity.requestPermissionsFromFragment(android.support.v4.app.Fragment, java.lang.String[], int) took 107.527ms
W/art: Verification of void android.support.v4.app.FragmentActivity.setEnterSharedElementCallback(android.support.v4.app.SharedElementCallback) took 102.953ms
W/art: Verification of void android.support.v7.app.AppCompatActivity.onSupportActionModeFinished(android.support.v7.view.ActionMode) took 192.620ms
W/art: Verification of void android.support.v4.app.FragmentManagerImpl.setHWLayerAnimListenerIfAlpha(android.view.View, android.view.animation.Animation) took 130.794ms
W/art: Verification of android.support.v7.app.AppCompatDelegate android.support.v7.app.AppCompatDelegate.create(android.content.Context, android.view.Window, android.support.v7.app.AppCompatCallback) took 147.296ms
W/art: Verification of void android.support.v7.app.AppCompatDelegateImplBase.<init>(android.content.Context, android.view.Window, android.support.v7.app.AppCompatCallback) took 138.730ms
W/art: Verification of void android.support.v7.app.AppCompatDelegateImplV9.ensureSubDecor() took 166.867ms
W/art: Verification of void android.support.v7.app.AppCompatDelegateImplV9.onConfigurationChanged(android.content.res.Configuration) took 215.247ms
W/art: Verification of android.support.v7.view.ActionMode android.support.v7.app.AppCompatDelegateImplV9.startSupportActionModeFromWindow(android.support.v7.view.ActionMode$Callback) took 113.775ms
W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
W/gralloc_ranchu: Gralloc pipe failed
[ 10-02 15:22:33.523 2284: 2284 D/ ]
HostConnection::get() New Host Connection established 0xa72c2540, tid 2284
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 1
I/Choreographer: Skipped 40 frames! The application may be doing too much work on its main thread.
D/AndroidRuntime: Shutting down VM
--------- beginning of crash
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.shiftind.www.shiftind, PID: 2284
java.lang.IllegalStateException: Could not execute method for android:onClick
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:293)
at android.view.View.performClick(View.java:5610)
at android.view.View$PerformClick.run(View.java:22260)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:288)
at android.view.View.performClick(View.java:5610)
at android.view.View$PerformClick.run(View.java:22260)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.shiftind.www.shiftind/com.shiftind.www.shiftind.registration}; have you declared this activity in your AndroidManifest.xml?
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1805)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1523)
at android.app.Activity.startActivityForResult(Activity.java:4224)
at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:48)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:75)
at android.app.Activity.startActivityForResult(Activity.java:4183)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:856)
at android.app.Activity.startActivity(Activity.java:4507)
at android.app.Activity.startActivity(Activity.java:4475)
at com.shiftind.www.shiftind.MainActivity.onButtonClick(MainActivity.java:19)
at java.lang.reflect.Method.invoke(Native Method)
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:288)
at android.view.View.performClick(View.java:5610)
at android.view.View$PerformClick.run(View.java:22260)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Application terminated.
my mainActivity.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
tools:context="com.shiftind.www.shiftind.MainActivity">
<Button
android:text="Let's Get Started"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/startbutton"
style="#style/Widget.AppCompat.Button.Colored"
android:onClick="onButtonClick"
android:layout_alignParentStart="true"
android:layout_marginStart="85dp" />
</RelativeLayout>
my registartion.xml (second activity)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="registration activity"
android:layout_width="wrap_content"
android:layout_height="111dp"
android:id="#+id/textView3"
android:layout_weight="1"
android:textStyle="normal|bold" />
</LinearLayout>
my registration.java
package com.shiftind.www.shiftind;
import android.app.Activity;
import android.os.Bundle;
/**
* Created by Ahmed on 10/2/2016.
*/
public class registration extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.registration);
}
}
my main activity.java
package com.shiftind.www.shiftind;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.content.Intent;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void onButtonClick(View view) {
if (view.getId() == R.id.startbutton) {
Intent i = new Intent(MainActivity.this, registration.class);
startActivity(i);
}
}
}
Declare the second Activity in your manifest file and you should be sorted out
Also your button is not declared
Add this line inside <application> tag
<activity android:name=".registration" ></activity>
hope it helps