Android Studio JSon HTTP Application crash - android

I am using the latest version of android studio. 6.0 does not have the apache libraries but i have added them in the gradle. My application works but it doesnt get the data. I've added the log cat below including my mainactivity:
public class MainActivity extends AppCompatActivity {
private TextView responseTextView;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
this.responseTextView = (TextView) this.findViewById(R.id.responseTextView);
new GetAllLecturesTask().execute(new ApiConnector());
}
public void setTextToTextView(JSONArray jsonArray)
{
String s = "";
for (int i=0; i<jsonArray.length();i++){
JSONObject json = null;
try{
json = jsonArray.getJSONObject(i);
s = s +
"Name : "+json.getString("Name")+
"EmailAddress : "+json.getString("EmailAddress")+"\n"+
"PhoneNo : "+json.getString("PhoneNo")+"\n\n";
}catch (JSONException e){
e.printStackTrace();
}
}
}
private class GetAllLecturesTask extends AsyncTask<ApiConnector,Long,JSONArray>
{
#Override
protected JSONArray doInBackground(ApiConnector... params){
return params[0].GetAllLectures();
}
#Override
protected void onPostExecute(JSONArray jsonArray){
setTextToTextView(jsonArray);
}
}
}
Logcat:
02-16 20:55:57.690 2304-2304/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
02-16 20:55:57.690 2304-2304/? D/AndroidRuntime: CheckJNI is ON
02-16 20:55:57.710 2304-2304/? D/ICU: No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
02-16 20:55:57.740 2304-2304/? E/memtrack: Couldn't load memtrack module (No such file or directory)
02-16 20:55:57.740 2304-2304/? E/android.os.Debug: failed to load memtrack module: -2
02-16 20:55:57.740 2304-2304/? I/Radio-JNI: register_android_hardware_Radio DONE
02-16 20:55:57.750 2304-2304/? D/AndroidRuntime: Calling main entry com.android.commands.am.Am
02-16 20:55:57.760 1357-1368/? I/ActivityManager: Force stopping com.example.jahanara.externaldatabase appid=10066 user=0: from pid 2304
02-16 20:55:57.760 1357-1368/? I/ActivityManager: Killing 2275:com.example.jahanara.externaldatabase/u0a66 (adj 0): stop com.example.jahanara.externaldatabase
02-16 20:55:57.770 1357-1393/? W/InputDispatcher: channel '3605d7 com.example.jahanara.externaldatabase/com.example.jahanara.externaldatabase.MainActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9
02-16 20:55:57.770 1357-1393/? E/InputDispatcher: channel '3605d7 com.example.jahanara.externaldatabase/com.example.jahanara.externaldatabase.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
02-16 20:55:57.770 1357-1369/? D/GraphicsStats: Buffer count: 2
02-16 20:55:57.770 1357-1369/? I/WindowState: WIN DEATH: Window{3605d7 u0 com.example.jahanara.externaldatabase/com.example.jahanara.externaldatabase.MainActivity}
02-16 20:55:57.770 1357-1369/? W/InputDispatcher: Attempted to unregister already unregistered input channel '3605d7 com.example.jahanara.externaldatabase/com.example.jahanara.externaldatabase.MainActivity (server)'
02-16 20:55:57.800 1357-1368/? W/ActivityManager: Force removing ActivityRecord{999f3d u0 com.example.jahanara.externaldatabase/.MainActivity t135}: app died, no saved state
02-16 20:55:57.810 1357-1803/? W/ActivityManager: Spurious death for ProcessRecord{966925c 0:com.example.jahanara.externaldatabase/u0a66}, curProc for 2275: null
02-16 20:55:57.810 2304-2304/? D/AndroidRuntime: Shutting down VM
02-16 20:55:58.050 1697-1828/? W/EGL_emulation: eglSurfaceAttrib not implemented
02-16 20:55:58.050 1697-1828/? W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f690c260840, error=EGL_SUCCESS
02-16 20:55:58.100 1005-1005/? W/SurfaceFlinger: couldn't log to binary event log: overflow.
02-16 20:55:58.600 2313-2313/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
02-16 20:55:58.600 2313-2313/? D/AndroidRuntime: CheckJNI is ON
02-16 20:55:58.620 2313-2313/? D/ICU: No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
02-16 20:55:58.690 2313-2313/? E/memtrack: Couldn't load memtrack module (No such file or directory)
02-16 20:55:58.690 2313-2313/? E/android.os.Debug: failed to load memtrack module: -2
02-16 20:55:58.690 2313-2313/? I/Radio-JNI: register_android_hardware_Radio DONE
02-16 20:55:58.700 2317-2317/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
02-16 20:55:58.700 2317-2317/? D/AndroidRuntime: CheckJNI is ON
02-16 20:55:58.710 2313-2313/? D/AndroidRuntime: Calling main entry com.android.commands.wm.Wm
02-16 20:55:58.720 2317-2317/? D/ICU: No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
02-16 20:55:58.740 2317-2317/? E/memtrack: Couldn't load memtrack module (No such file or directory)
02-16 20:55:58.740 2317-2317/? E/android.os.Debug: failed to load memtrack module: -2
02-16 20:55:58.740 2317-2317/? I/Radio-JNI: register_android_hardware_Radio DONE
02-16 20:55:58.750 2317-2317/? D/AndroidRuntime: Calling main entry com.android.commands.am.Am
02-16 20:55:58.760 1357-1803/? I/ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.jahanara.externaldatabase/.MainActivity} from uid 0 on display 0
02-16 20:55:59.120 1357-1803/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 360ms
02-16 20:55:59.270 1357-1849/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 440ms
02-16 20:55:59.570 1357-1803/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 450ms
02-16 20:55:59.730 1357-1849/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 460ms
02-16 20:55:59.900 1357-1726/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 480ms
02-16 20:56:00.050 1357-1803/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 480ms
02-16 20:56:00.220 1357-1849/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 490ms
02-16 20:56:00.240 1357-1726/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 340ms
02-16 20:56:00.380 1357-1803/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 330ms
02-16 20:56:00.530 1357-1849/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 310ms
02-16 20:56:00.680 1357-1726/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 440ms
02-16 20:56:00.830 1357-1803/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 450ms
02-16 20:56:00.990 1357-1849/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 460ms
02-16 20:56:01.150 1357-1726/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 470ms
02-16 20:56:01.300 1357-1803/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 470ms
02-16 20:56:01.600 1357-1726/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 450ms
02-16 20:56:01.750 1357-1803/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 450ms
02-16 20:56:01.910 1357-1849/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 460ms
02-16 20:56:02.070 1357-1726/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 470ms
02-16 20:56:02.210 1357-1803/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 460ms
02-16 20:56:02.360 1357-1849/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 450ms
02-16 20:56:02.510 1357-1726/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 440ms
02-16 20:56:02.660 1357-1803/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 450ms
02-16 20:56:02.810 1357-1849/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 450ms
02-16 20:56:02.960 1357-1726/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 450ms
02-16 20:56:02.980 1357-1803/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 320ms
02-16 20:56:03.120 1357-1849/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 310ms
02-16 20:56:03.120 1357-1726/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowManagerService$H.handleMessage(android.os.Message) from WindowManagerService.java:8000 waiters=2 for 160ms
02-16 20:56:03.120 1357-1803/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.java:121 waiters=2 for 140ms
02-16 20:56:03.120 2313-2313/? D/AndroidRuntime: Shutting down VM
02-16 20:56:03.290 1357-1849/? W/art: Long monitor contention event with owner method=void com.android.server.wm.WindowManagerService$H.handleMessage(android.os.Message) from WindowManagerService.java:7820 waiters=2 for 160ms
02-16 20:56:03.290 1357-1371/? W/art: Long monitor contention event with owner method=int com.android.server.am.ActivityStackSupervisor.startActivityMayWait(android.app.IApplicationThread, int, java.lang.String, android.content.Intent, java.lang.String, android.service.voice.IVoiceInteractionSession, com.android.internal.app.IVoiceInteractor, android.os.IBinder, java.lang.String, int, int, android.app.ProfilerInfo, android.app.IActivityManager$WaitResult, android.content.res.Configuration, android.os.Bundle, boolean, int, android.app.IActivityContainer, com.android.server.am.TaskRecord) from ActivityStackSupervisor.java:946 waiters=0 for 4.470s
02-16 20:56:03.290 2317-2317/? D/AndroidRuntime: Shutting down VM
02-16 20:56:03.290 1357-1388/? W/art: Long monitor contention event with owner method=int com.android.server.am.ActivityStackSupervisor.startActivityMayWait(android.app.IApplicationThread, int, java.lang.String, android.content.Intent, java.lang.String, android.service.voice.IVoiceInteractionSession, com.android.internal.app.IVoiceInteractor, android.os.IBinder, java.lang.String, int, int, android.app.ProfilerInfo, android.app.IActivityManager$WaitResult, android.content.res.Configuration, android.os.Bundle, boolean, int, android.app.IActivityContainer, com.android.server.am.TaskRecord) from ActivityStackSupervisor.java:946 waiters=1 for 3.280s
02-16 20:56:03.290 1357-1429/? W/art: Long monitor contention event with owner method=int com.android.server.am.ActivityStackSupervisor.startActivityMayWait(android.app.IApplicationThread, int, java.lang.String, android.content.Intent, java.lang.String, android.service.voice.IVoiceInteractionSession, com.android.internal.app.IVoiceInteractor, android.os.IBinder, java.lang.String, int, int, android.app.ProfilerInfo, android.app.IActivityManager$WaitResult, android.content.res.Configuration, android.os.Bundle, boolean, int, android.app.IActivityContainer, com.android.server.am.TaskRecord) from ActivityStackSupervisor.java:946 waiters=2 for 2.440s
02-16 20:56:03.320 1357-1849/? W/InputMethodManagerService: Got RemoteException sending setActive(false) notification to pid 2275 uid 10066
02-16 20:56:03.330 1697-1697/? I/Choreographer: Skipped 310 frames! The application may be doing too much work on its main thread.
02-16 20:56:03.790 1357-1371/? W/ActivityManager: Activity pause timeout for ActivityRecord{d0412ba u0 com.android.launcher3/.Launcher t132}
02-16 20:56:03.800 2332-2332/? I/art: Not late-enabling -Xcheck:jni (already on)
02-16 20:56:03.810 1357-1371/? I/ActivityManager: Start proc 2332:com.example.jahanara.externaldatabase/u0a66 for activity com.example.jahanara.externaldatabase/.MainActivity
02-16 20:56:03.810 2332-2332/? W/System: ClassLoader referenced unknown path: /data/app/com.example.jahanara.externaldatabase-2/lib/x86_64
02-16 20:56:03.910 1005-1122/? E/SurfaceFlinger: ro.sf.lcd_density must be defined as a build property
02-16 20:56:03.910 2332-2347/? D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
02-16 20:56:04.190 1697-1697/? I/Choreographer: Skipped 51 frames! The application may be doing too much work on its main thread.
02-16 20:56:04.310 2332-2347/? I/OpenGLRenderer: Initialized EGL, version 1.4
02-16 20:56:05.450 1697-1697/? I/Choreographer: Skipped 73 frames! The application may be doing too much work on its main thread.
02-16 20:56:05.740 2332-2347/? W/EGL_emulation: eglSurfaceAttrib not implemented
02-16 20:56:05.740 2332-2347/? W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f691ce988c0, error=EGL_SUCCESS
02-16 20:56:07.210 2332-2345/? E/Entity Response  :: [{"ID":"1","Name":"James Shuttleworth","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07591231231","Department":"Computing","AvailabilityID":"1000"},{"ID":"2","Name":"Mike Morgan","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07594422281","Department":"Computing","AvailabilityID":"1001"},{"ID":"3","Name":"Parveen Samra","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07594423333","Department":"Environment","AvailabilityID":"1002"},{"ID":"4","Name":"Vasile Constantin","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07598811337","Department":"Engineering","AvailabilityID":"1003"},{"ID":"5","Name":"George William","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07897211290","Department":"Engineering","AvailabilityID":"1004"},{"ID":"6","Name":"Amanda Brooks","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07335115226","Department":"Environment","AvailabilityID":"1005"},{"ID":"7","Name":"Sandy Taramonli","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07777222311","Department":"Computing","AvailabilityID":"1006"},{"ID":"8","Name":"Mark Bennett","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07747222441","Department":"Environment","AvailabilityID":"1007"},{"ID":"9","Name":"Amritpal Slaich","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07747722141","Department":"Engineering","AvailabilityID":"1008"},{"ID":"10","Name":"Harminder Kaur","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07669931771","Department":"Engineering","AvailabilityID":"1009"},{"ID":"11","Name":"Leon Smalov","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07734541236","Department":"Computing","AvailabilityID":"1010"},{"ID":"12","Name":"Mark Tyers","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07734529936","Department":"Computing","AvailabilityID":"1011"},{"ID":"13","Name":"Farzana Aslam","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07414622990","Department":"Engineering","AvailabilityID":"1012"},{"ID":"14","Name":"Yih-Ling Hedley","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07552410090","Department":"Engineering","AvailabilityID":"1013"},{"ID":"15","Name":"Abdullahi Ahmed","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07552410091","Department":"Engineering","AvailabilityID":"1014"},{"ID":"16","Name":"Carl Mills","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07552410092","Department":"Design","AvailabilityID":"1015"},{"ID":"17","Name":"Una Malone","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07552410093","Department":"Engineering","AvailabilityID":"1016"},{"ID":"18","Name":"Reda Al Bodour","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07552410094","Department":"Computing","AvailabilityID":"1017"},{"ID":"19","Name":"Phillip Smith","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07552410095","Department":"Computing","AvailabilityID":"1018"},{"ID":"20","Name":"Erik Barrow","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07552410096","Department":"Computing","AvailabilityID":"1019"},{"ID":"21","Name":"Luke Hicks","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07552410097","Department":"Computing","AvailabilityID":"1020"},{"ID":"22","Name":"Ateya Asgar","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07552410098","Department":"Engineering","AvailabilityID":"1021"},{"ID":"23","Name":"Xiang Fei","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07552410099","Department":"Computing","AvailabilityID":"1022"},{"ID":"24","Name":"Zahir Ahmad","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07552410100","Department":"Engineering","AvailabilityID":"1023"},{"ID":"25","Name":"Carey Pridgeon","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07552410101","Department":"Computing","AvailabilityID":"1024"},{"ID":"26","Name":"Hong Guo","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07552410102","Department":"Computing","AvailabilityID":"1025"},{"ID":"27","Name":"Richard Lane","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07552410103","Department":"Environment","AvailabilityID":"1026"},{"ID":"28","Name":"Bill Dunn","EmailAddress":"eduardhanu#yahoo.com","PhoneNo":"07552410104","Department":"E
02-16 20:56:07.930 1357-1376/? I/ActivityManager: Displayed com.example.jahanara.externaldatabase/.MainActivity: +4s140ms
02-16 20:56:08.130 1697-1828/? E/Surface: getSlotFromBufferLocked: unknown buffer: 0x7f690cc1d750

Your setTextToTextView method is called by the onPostExecute method.
But this method simply set a variable s concatenating the value of the json objects.
It doesn't set the value in the responseTextView (the TextView) defined in the onCreate method.
You have to call somenthing like:
responseTextView.setText(s);

Related

Flexible Modular UI in android as per Orientation Change

I am making app which on portrait mode shows fragmentA (containing Listview) and when in Landscape mode, it shows fragmentA and fragmentB(Listview and its corresponding description).It keeps on crashing,my hunch says either there is a fault in if-else condition in MainActivity or problem is in communication pattern.I request Everyone to please Help. Here is my MainActivity.xml
package com.example.prince.fragment_modularui2;
import android.content.Intent;
import android.content.res.Resources;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity implements FragmentA.Communicator{
String s;
Resources r=getResources();
String[] a=r.getStringArray(R.array.descr);
FragmentA fa;
FragmentB fb;
FragmentManager manager;
#Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
manager=getSupportFragmentManager();
//fa always present
fa= (FragmentA) manager.findFragmentById(R.id.fragment);
fb= (FragmentB) manager.findFragmentById(R.id.fragment2);
fa.setCommunicator(this);
}
#Override
public void respond(int data) {
Intent i=new Intent(this,AnotherActivity.class);
i.putExtra("index",data);
startActivity(i);
}
}
here is activity_main.xml in Portrait
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.example.prince.fragment_modularui2.FragmentA"
android:id="#+id/fragment"
></fragment>
</LinearLayout>
activity_main in landscape
<?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">
<fragment
android:id="#+id/fragment"
android:name="com.example.prince.fragment_modularui2.FragmentA"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true" />
<fragment
android:id="#+id/fragment2"
android:name="com.example.prince.fragment_modularui2.FragmentB"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true" />
</LinearLayout>
Rest of the code is https://github.com/AlmightyHeathcliff/Fragment_ModularUi2
The stackTrace is
07-18 09:45:09.252 1974-1974/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
07-18 09:45:09.254 1974-1974/? D/AndroidRuntime: CheckJNI is OFF
07-18 09:45:09.289 1974-1974/? W/art: Unexpected CPU variant for X86 using defaults: x86
07-18 09:45:09.301 1974-1974/? D/ICU: No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
07-18 09:45:09.316 1974-1974/? E/memtrack: Couldn't load memtrack module (No such file or directory)
07-18 09:45:09.316 1974-1974/? E/android.os.Debug: failed to load memtrack module: -2
07-18 09:45:09.317 1974-1974/? I/Radio-JNI: register_android_hardware_Radio DONE
07-18 09:45:09.325 1974-1974/? D/AndroidRuntime: Calling main entry com.android.commands.pm.Pm
07-18 09:45:09.330 1974-1974/? I/art: System.exit called, status: 0
07-18 09:45:09.330 1974-1974/? I/AndroidRuntime: VM exiting with result code 0.
07-18 09:45:09.333 1974-1982/? W/MessageQueue: Handler (android.os.Handler) {f6bbfb3} sending message to a Handler on a dead thread
java.lang.IllegalStateException: Handler (android.os.Handler) {f6bbfb3} sending message to a Handler on a dead thread
at android.os.MessageQueue.enqueueMessage(MessageQueue.java:543)
at android.os.Handler.enqueueMessage(Handler.java:643)
at android.os.Handler.sendMessageAtTime(Handler.java:612)
at android.os.Handler.sendMessageDelayed(Handler.java:582)
at android.os.Handler.post(Handler.java:338)
at android.os.ResultReceiver$MyResultReceiver.send(ResultReceiver.java:57)
at com.android.internal.os.IResultReceiver$Stub.onTransact(IResultReceiver.java:58)
at android.os.Binder.execTransact(Binder.java:565)
07-18 09:45:09.972 1993-1993/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
07-18 09:45:09.976 1993-1993/? D/AndroidRuntime: CheckJNI is OFF
07-18 09:45:10.012 1993-1993/? W/art: Unexpected CPU variant for X86 using defaults: x86
07-18 09:45:10.015 1993-1993/? D/ICU: No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
07-18 09:45:10.049 1993-1993/? E/memtrack: Couldn't load memtrack module (No such file or directory)
07-18 09:45:10.049 1993-1993/? E/android.os.Debug: failed to load memtrack module: -2
07-18 09:45:10.050 1993-1993/? I/Radio-JNI: register_android_hardware_Radio DONE
07-18 09:45:10.059 1993-1993/? D/AndroidRuntime: Calling main entry com.android.commands.pm.Pm
07-18 09:45:10.064 1993-2001/? W/MessageQueue: Handler (android.os.Handler) {f6bbfb3} sending message to a Handler on a dead thread
java.lang.IllegalStateException: Handler (android.os.Handler) {f6bbfb3} sending message to a Handler on a dead thread
at android.os.MessageQueue.enqueueMessage(MessageQueue.java:543)
at android.os.Handler.enqueueMessage(Handler.java:643)
at android.os.Handler.sendMessageAtTime(Handler.java:612)
at android.os.Handler.sendMessageDelayed(Handler.java:582)
at android.os.Handler.post(Handler.java:338)
at android.os.ResultReceiver$MyResultReceiver.send(ResultReceiver.java:57)
at com.android.internal.os.IResultReceiver$Stub.onTransact(IResultReceiver.java:58)
at android.os.Binder.execTransact(Binder.java:565)
07-18 09:45:10.064 1993-1993/? I/art: System.exit called, status: 0
07-18 09:45:10.064 1993-1993/? I/AndroidRuntime: VM exiting with result code 0.
07-18 09:45:13.487 2005-2005/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
07-18 09:45:13.491 2005-2005/? D/AndroidRuntime: CheckJNI is OFF
07-18 09:45:13.569 2005-2005/? W/art: Unexpected CPU variant for X86 using defaults: x86
07-18 09:45:13.575 2005-2005/? D/ICU: No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
07-18 09:45:13.708 2009-2009/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
07-18 09:45:13.715 2009-2009/? D/AndroidRuntime: CheckJNI is OFF
07-18 09:45:13.760 2005-2005/? E/memtrack: Couldn't load memtrack module (No such file or directory)
07-18 09:45:13.760 2005-2005/? E/android.os.Debug: failed to load memtrack module: -2
07-18 09:45:13.761 2005-2005/? I/Radio-JNI: register_android_hardware_Radio DONE
07-18 09:45:13.776 2005-2005/? D/AndroidRuntime: Calling main entry com.android.commands.wm.Wm
07-18 09:45:13.814 2009-2009/? W/art: Unexpected CPU variant for X86 using defaults: x86
07-18 09:45:13.825 2009-2009/? D/ICU: No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
07-18 09:45:13.833 2005-2005/? D/AndroidRuntime: Shutting down VM
07-18 09:45:13.839 2005-2019/? W/art: Thread attaching while runtime is shutting down: Binder:2005_2
07-18 09:45:13.839 2005-2019/? I/AndroidRuntime: NOTE: attach of thread 'Binder:2005_2' failed
07-18 09:45:13.891 2009-2009/? E/memtrack: Couldn't load memtrack module (No such file or directory)
07-18 09:45:13.891 2009-2009/? E/android.os.Debug: failed to load memtrack module: -2
07-18 09:45:13.892 2009-2009/? I/Radio-JNI: register_android_hardware_Radio DONE
07-18 09:45:13.903 2009-2009/? D/AndroidRuntime: Calling main entry com.android.commands.am.Am
07-18 09:45:13.909 765-1149/system_process I/ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.prince.fragment_modularui2/.MainActivity} from uid 0 on display 0
07-18 09:45:13.919 2009-2009/? D/AndroidRuntime: Shutting down VM
07-18 09:45:13.993 765-1021/system_process W/ActivityManager: Slow operation: 75ms so far, now at startProcess: returned from zygote!
07-18 09:45:13.993 765-1021/system_process W/ActivityManager: Slow operation: 75ms so far, now at startProcess: done updating battery stats
07-18 09:45:13.993 765-1021/system_process W/ActivityManager: Slow operation: 75ms so far, now at startProcess: building log message
07-18 09:45:13.993 765-1021/system_process I/ActivityManager: Start proc 2027:com.example.prince.fragment_modularui2/u0a115 for activity com.example.prince.fragment_modularui2/.MainActivity
07-18 09:45:13.993 765-1021/system_process W/ActivityManager: Slow operation: 75ms so far, now at startProcess: starting to update pids map
07-18 09:45:13.993 765-1021/system_process W/ActivityManager: Slow operation: 75ms so far, now at startProcess: done updating pids map
07-18 09:45:13.993 765-1021/system_process W/ActivityManager: Slow operation: 75ms so far, now at startProcess: done starting proc!
07-18 09:45:14.003 2027-2027/? I/art: Late-enabling -Xcheck:jni
07-18 09:45:14.004 2027-2027/? W/art: Unexpected CPU variant for X86 using defaults: x86
07-18 09:45:14.258 500-757/? D/gralloc_vbox86: gralloc_alloc: format 1 and usage 0x933 imply creation of host color buffer
07-18 09:45:14.784 2027-2027/com.example.prince.fragment_modularui2 W/System: ClassLoader referenced unknown path: /data/app/com.example.prince.fragment_modularui2-1/lib/x86
07-18 09:45:14.813 2027-2027/com.example.prince.fragment_modularui2 I/InstantRun: starting instant run server: is main process
07-18 09:45:14.814 2027-2027/com.example.prince.fragment_modularui2 V/InstantRun: Starting server socket listening for package com.example.prince.fragment_modularui2 on android.net.LocalSocketAddress#8989009
07-18 09:45:14.814 2027-2027/com.example.prince.fragment_modularui2 V/InstantRun: Started server for package com.example.prince.fragment_modularui2
07-18 09:45:14.903 2027-2027/com.example.prince.fragment_modularui2 D/AndroidRuntime: Shutting down VM
07-18 09:45:14.904 2027-2027/com.example.prince.fragment_modularui2 E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.prince.fragment_modularui2, PID: 2027
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.prince.fragment_modularui2/com.example.prince.fragment_modularui2.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2567)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
at android.content.ContextWrapper.getResources(ContextWrapper.java:86)
at android.view.ContextThemeWrapper.getResourcesInternal(ContextThemeWrapper.java:127)
at android.view.ContextThemeWrapper.getResources(ContextThemeWrapper.java:121)
at android.support.v7.app.AppCompatActivity.getResources(AppCompatActivity.java:549)
at com.example.prince.fragment_modularui2.MainActivity.<init>(MainActivity.java:12)
at java.lang.Class.newInstance(Native Method)
at android.app.Instrumentation.newActivity(Instrumentation.java:1078)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2557)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726) 
at android.app.ActivityThread.-wrap12(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6119) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 
07-18 09:45:14.907 765-1021/system_process W/ActivityManager: Force finishing activity com.example.prince.fragment_modularui2/.MainActivity
07-18 09:45:15.031 500-505/? D/gralloc_vbox86: gralloc_alloc: format 1 and usage 0x900 imply creation of host color buffer
07-18 09:45:15.058 500-505/? D/gralloc_vbox86: gralloc_alloc: format 1 and usage 0x900 imply creation of host color buffer
07-18 09:45:15.115 500-505/? D/gralloc_vbox86: gralloc_alloc: format 1 and usage 0x900 imply creation of host color buffer
07-18 09:45:15.232 765-1842/system_process I/OpenGLRenderer: Initialized EGL, version 1.4
07-18 09:45:15.232 765-1842/system_process D/OpenGLRenderer: Swap behavior 1
07-18 09:45:15.429 765-779/system_process W/ActivityManager: Activity pause timeout for ActivityRecord{b0310c2 u0 com.example.prince.fragment_modularui2/.MainActivity t693 f}
07-18 09:45:15.431 765-779/system_process I/ActivityManager: Killing 1353:android.process.media/u0a10 (adj 906): empty #17
07-18 09:45:15.432 765-779/system_process I/WindowManager: Failed to capture screenshot of Token{7756ed3 ActivityRecord{b0310c2 u0 com.example.prince.fragment_modularui2/.MainActivity t693 f}} appWin=Window{7f1e54b u0 Starting com.example.prince.fragment_modularui2} drawState=1
07-18 09:45:15.448 765-786/system_process I/Choreographer: Skipped 70 frames! The application may be doing too much work on its main thread.
07-18 09:45:15.452 765-1150/system_process D/ActivityManager: cleanUpApplicationRecord -- 1353
07-18 09:45:15.456 765-1842/system_process E/EGL_emulation: tid 1842: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
07-18 09:45:15.456 765-1842/system_process W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xc4afa800, error=EGL_BAD_MATCH
07-18 09:45:16.337 765-780/system_process I/Choreographer: Skipped 52 frames! The application may be doing too much work on its main thread.
07-18 09:45:25.438 765-779/system_process W/ActivityManager: Activity destroy timeout for ActivityRecord{b0310c2 u0 com.example.prince.fragment_modularui2/.MainActivity t693 f}
From the stacktrace I gather that you are calling getResources() on a Context that is null. This makes sense because you are declaring your resources as a field like:
Resources res = getResources();
This gets executed before the activity is created but you can only call getResources() once the activity is created. So the solution is to declare your resources like:
private Resources res;
And in your activity onCreate method you do:
res = getResources();
This also means that you can't use the res variable until the onCreate method is executed. Generally it is better to not declare resources as a variable like that but rather declare your string array as:
String[] a;
and then in onCreate just call: a = getResources().getStringArray(R.array.desc);
One other tip I can give you is to name your variable clearer. A string array named 'a' is not very descriptive. You can call it something like descriptionArray to make it more clear.

Hybrid app crashing in Android studio with error: Session 'android': Error Launching activity

I am a little new to Android Studio and hybrid application building suing cordova.
I am trying to build a Salesforce hybrid app in Android Studio.
The project gets cleaned and builds successfully without any errors.
But, while installing the APK to emulator it gives an error that
Session 'android': Error Launching activity
In the Emulator it says:
Unfortunately, app has stopped
My stack trace is as below:
09-20 01:44:34.430 7462-9492/? W/AudioFlinger: RecordThread: buffer overflow
09-20 01:44:43.439 8337-9329/com.google.android.googlequicksearchbox:search W/TRThreadPoolExecutor: Queue length for executor GrecoExecutor with 1 threads is now 8. Perhaps some tasks are too long, or the pool is too small.
09-20 01:45:17.627 7462-9492/? W/AudioFlinger: RecordThread: buffer overflow
09-20 01:46:01.058 7462-9492/? W/AudioFlinger: RecordThread: buffer overflow
09-20 01:46:29.330 7462-9492/? W/AudioFlinger: RecordThread: buffer overflow
09-20 01:46:47.516 7462-9492/? W/AudioFlinger: RecordThread: buffer overflow
09-20 01:46:47.846 8337-9329/com.google.android.googlequicksearchbox:search W/TRThreadPoolExecutor: Queue length for executor GrecoExecutor with 1 threads is now 8. Perhaps some tasks are too long, or the pool is too small.
09-20 01:46:48.319 8337-9489/com.google.android.googlequicksearchbox:search I/MicrophoneInputStream: mic_close com.google.android.apps.gsa.speech.audio.u#336e7b1
09-20 01:46:48.323 8337-8500/com.google.android.googlequicksearchbox:search W/ErrorReporter: reportError [type: 211, code: 786434]: Error reading from input stream.
09-20 01:46:48.324 8337-8500/com.google.android.googlequicksearchbox:search W/ErrorProcessor: onFatalError, ignoring error from engine(3): com.google.android.apps.gsa.shared.speech.a.h: Error reading from input stream.
09-20 01:46:48.325 8337-9329/com.google.android.googlequicksearchbox:search W/TRThreadPoolExecutor: Task c[startRecognition] took 318737ms, which is over the 300000ms threshold
09-20 01:46:48.406 8337-9490/com.google.android.googlequicksearchbox:search I/HotwordRecognitionRnr: Hotword detection finished
09-20 01:46:48.408 8337-8500/com.google.android.googlequicksearchbox:search W/ErrorReporter: reportError [type: 211, code: 524300]: Error at processing input stream
09-20 01:46:48.422 8337-8504/com.google.android.googlequicksearchbox:search I/HotwordRecognitionRnr: Stopping hotword detection.
09-20 01:46:48.422 8337-8500/com.google.android.googlequicksearchbox:search W/ErrorProcessor: onFatalError, processing error from engine(4)
com.google.android.apps.gsa.shared.speech.a.g: Error at processing input stream
at com.google.android.search.core.hotword.l.bsw(HotwordRecognitionRunner.java:166)
at com.google.android.search.core.hotword.l$1.run(HotwordRecognitionRunner.java:138)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
at com.google.android.apps.gsa.shared.util.c.a.l$1.run(GsaThreadFactory.java:99)
Caused by: com.google.android.apps.gsa.shared.api.io.GsaIOException: Error code: 393238 | Buffer overflow, no available space.
at com.google.android.apps.gsa.speech.audio.Tee.aHz(Tee.java:474)
at com.google.android.apps.gsa.speech.audio.Tee.k(Tee.java:301)
at com.google.android.apps.gsa.speech.audio.ad.read(Tee.java:503)
at java.io.InputStream.read(InputStream.java:162)
at com.google.android.apps.gsa.speech.audio.z.run(MultipleReaderAudioSource.java:206)
09-20 01:46:48.545 8337-8337/com.google.android.googlequicksearchbox:search I/HotwordWorker: #onError(false)
09-20 01:46:53.715 8337-9505/com.google.android.googlequicksearchbox:search I/MicrophoneInputStream: mic_starting com.google.android.apps.gsa.speech.audio.u#eae2893
09-20 01:46:53.718 7462-7783/? E/audio_hw_generic: Error opening input stream format 1, channel_mask 0010, sample_rate 16000
09-20 01:46:53.726 7462-9507/? I/AudioFlinger: AudioFlinger's thread 0xf39c0000 ready to run
09-20 01:46:53.783 8337-9505/com.google.android.googlequicksearchbox:search I/MicrophoneInputStream: mic_started com.google.android.apps.gsa.speech.audio.u#eae2893
09-20 01:46:53.788 8337-9508/com.google.android.googlequicksearchbox:search I/HotwordRecognitionRnr: Starting hotword detection.
09-20 01:46:53.791 8337-8337/com.google.android.googlequicksearchbox:search I/HotwordWorker: onReady
09-20 01:47:11.373 7724-7740/system_process E/BluetoothAdapter: Bluetooth binder is null
--------- beginning of system
09-20 01:47:11.377 7724-7740/system_process E/KernelCpuSpeedReader: Failed to read cpu-freq
java.io.FileNotFoundException: /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:452)
at java.io.FileInputStream.<init>(FileInputStream.java:76)
at java.io.FileInputStream.<init>(FileInputStream.java:103)
at java.io.FileReader.<init>(FileReader.java:66)
at com.android.internal.os.KernelCpuSpeedReader.readDelta(KernelCpuSpeedReader.java:49)
at com.android.internal.os.BatteryStatsImpl.updateCpuTimeLocked(BatteryStatsImpl.java:8002)
at com.android.server.am.BatteryStatsService.updateExternalStats(BatteryStatsService.java:1366)
at com.android.server.am.BatteryStatsService$BatteryStatsHandler.handleMessage(BatteryStatsService.java:125)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.android.server.ServiceThread.run(ServiceThread.java:46)
Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
at libcore.io.Posix.open(Native Method)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
at libcore.io.IoBridge.open(IoBridge.java:438)
at java.io.FileInputStream.<init>(FileInputStream.java:76) 
at java.io.FileInputStream.<init>(FileInputStream.java:103) 
at java.io.FileReader.<init>(FileReader.java:66) 
at com.android.internal.os.KernelCpuSpeedReader.readDelta(KernelCpuSpeedReader.java:49) 
at com.android.internal.os.BatteryStatsImpl.updateCpuTimeLocked(BatteryStatsImpl.java:8002) 
at com.android.server.am.BatteryStatsService.updateExternalStats(BatteryStatsService.java:1366) 
at com.android.server.am.BatteryStatsService$BatteryStatsHandler.handleMessage(BatteryStatsService.java:125) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.os.HandlerThread.run(HandlerThread.java:61) 
at com.android.server.ServiceThread.run(ServiceThread.java:46) 
09-20 01:47:11.378 7724-7740/system_process E/KernelUidCpuTimeReader: Failed to read uid_cputime
java.io.FileNotFoundException: /proc/uid_cputime/show_uid_stat: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:452)
at java.io.FileInputStream.<init>(FileInputStream.java:76)
at java.io.FileInputStream.<init>(FileInputStream.java:103)
at java.io.FileReader.<init>(FileReader.java:66)
at com.android.internal.os.KernelUidCpuTimeReader.readDelta(KernelUidCpuTimeReader.java:71)
at com.android.internal.os.BatteryStatsImpl.updateCpuTimeLocked(BatteryStatsImpl.java:8031)
at com.android.server.am.BatteryStatsService.updateExternalStats(BatteryStatsService.java:1366)
at com.android.server.am.BatteryStatsService$BatteryStatsHandler.handleMessage(BatteryStatsService.java:125)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.android.server.ServiceThread.run(ServiceThread.java:46)
Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
at libcore.io.Posix.open(Native Method)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
at libcore.io.IoBridge.open(IoBridge.java:438)
at java.io.FileInputStream.<init>(FileInputStream.java:76) 
at java.io.FileInputStream.<init>(FileInputStream.java:103) 
at java.io.FileReader.<init>(FileReader.java:66) 
at com.android.internal.os.KernelUidCpuTimeReader.readDelta(KernelUidCpuTimeReader.java:71) 
at com.android.internal.os.BatteryStatsImpl.updateCpuTimeLocked(BatteryStatsImpl.java:8031) 
at com.android.server.am.BatteryStatsService.updateExternalStats(BatteryStatsService.java:1366) 
at com.android.server.am.BatteryStatsService$BatteryStatsHandler.handleMessage(BatteryStatsService.java:125) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.os.HandlerThread.run(HandlerThread.java:61) 
at com.android.server.ServiceThread.run(ServiceThread.java:46) 
09-20 01:47:11.378 7724-7740/system_process E/KernelWakelockReader: neither /proc/wakelocks nor /d/wakeup_sources exists
09-20 01:47:11.380 7724-7740/system_process W/BatteryStatsImpl: Couldn't get kernel wake lock stats
09-20 01:47:11.786 8511-9509/com.google.android.gms D/DropBoxEntryAddedChimeraService: User is not opted-in to Usage & Diagnostics or Lockbox.
09-20 01:47:16.711 8138-8148/com.google.process.gapps W/art: Suspending all threads took: 63.308ms
09-20 01:47:25.361 7462-9507/? W/AudioFlinger: RecordThread: buffer overflow
09-20 01:47:43.857 7462-9507/? W/AudioFlinger: RecordThread: buffer overflow
09-20 01:47:57.846 7462-9507/? W/AudioFlinger: RecordThread: buffer overflow
09-20 01:47:58.515 7724-7738/system_process I/ProcessStatsService: Prepared write state in 1ms
09-20 01:47:58.516 7724-7738/system_process I/ProcessStatsService: Prepared write state in 1ms
09-20 01:49:22.116 7462-9507/? W/AudioFlinger: RecordThread: buffer overflow
09-20 01:49:22.434 8337-9329/com.google.android.googlequicksearchbox:search W/TRThreadPoolExecutor: Queue length for executor GrecoExecutor with 1 threads is now 8. Perhaps some tasks are too long, or the pool is too small.
09-20 01:49:40.171 8337-9329/com.google.android.googlequicksearchbox:search W/TRThreadPoolExecutor: Queue length for executor GrecoExecutor with 1 threads is now 8. Perhaps some tasks are too long, or the pool is too small.
09-20 01:49:41.652 7462-9507/? W/AudioFlinger: RecordThread: buffer overflow
09-20 01:50:32.159 7462-9507/? W/AudioFlinger: RecordThread: buffer overflow
09-20 01:50:39.881 8337-9508/com.google.android.googlequicksearchbox:search W/art: Long monitor contention event with owner method=int com.google.android.apps.gsa.speech.audio.Tee.k(byte[], int, int) from Tee.java:240 waiters=3 for 153ms
09-20 01:50:41.561 7462-9507/? W/AudioFlinger: RecordThread: buffer overflow
09-20 01:51:02.907 7724-7737/system_process I/UsageStatsService: User[0] Flushing usage stats to disk
09-20 01:51:07.672 7462-9507/? W/AudioFlinger: RecordThread: buffer overflow
09-20 01:51:07.775 8337-9329/com.google.android.googlequicksearchbox:search W/TRThreadPoolExecutor: Queue length for executor GrecoExecutor with 1 threads is now 8. Perhaps some tasks are too long, or the pool is too small.
09-20 01:52:19.800 7462-9507/? W/AudioFlinger: RecordThread: buffer overflow
09-20 01:52:59.098 8511-9511/com.google.android.gms I/EventLogChimeraService: Aggregate from 1474314776671 (log), 1474314776671 (data)
09-20 01:52:59.662 7724-7760/system_process I/ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.google.android.googlequicksearchbox/com.google.android.launcher.GEL (has extras)} from uid 1000 on display 0
[ 09-20 01:52:59.723 7724: 7760 D/ ]
HostConnection::get() New Host Connection established 0x7fe99733e500, tid 7760
09-20 01:52:59.802 1187-1187/? E/EGL_emulation: tid 1187: eglCreateSyncKHR(1370): error 0x3004 (EGL_BAD_ATTRIBUTE)
09-20 01:52:59.880 7462-7780/? D/AudioFlinger: mixer(0xf44c0000) throttle end: throttle time(11)
09-20 01:53:00.121 7724-7743/system_process W/art: Long monitor contention event with owner method=android.graphics.Bitmap com.android.server.wm.WindowManagerService.screenshotApplicationsInner(android.os.IBinder, int, int, int, boolean) from WindowManagerService.java:6223 waiters=0 for 440ms
09-20 01:53:00.181 7724-7760/system_process D/gralloc_ranchu: gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread)
09-20 01:53:00.197 8337-8500/com.google.android.googlequicksearchbox:search I/MicrophoneInputStream: mic_close com.google.android.apps.gsa.speech.audio.u#eae2893
09-20 01:53:00.218 7724-7991/system_process W/art: Long monitor contention event with owner method=int com.android.server.am.ActivityStackSupervisor.startActivityMayWait(android.app.IApplicationThread, int, java.lang.String, android.content.Intent, java.lang.String, android.service.voice.IVoiceInteractionSession, com.android.internal.app.IVoiceInteractor, android.os.IBinder, java.lang.String, int, int, android.app.ProfilerInfo, android.app.IActivityManager$WaitResult, android.content.res.Configuration, android.os.Bundle, boolean, int, android.app.IActivityContainer, com.android.server.am.TaskRecord) from ActivityStackSupervisor.java:946 waiters=0 for 537ms
09-20 01:53:00.218 7724-7851/system_process W/art: Long monitor contention event with owner method=int com.android.server.am.ActivityStackSupervisor.startActivityMayWait(android.app.IApplicationThread, int, java.lang.String, android.content.Intent, java.lang.String, android.service.voice.IVoiceInteractionSession, com.android.internal.app.IVoiceInteractor, android.os.IBinder, java.lang.String, int, int, android.app.ProfilerInfo, android.app.IActivityManager$WaitResult, android.content.res.Configuration, android.os.Bundle, boolean, int, android.app.IActivityContainer, com.android.server.am.TaskRecord) from ActivityStackSupervisor.java:946 waiters=1 for 446ms
09-20 01:53:00.252 8337-8337/com.google.android.googlequicksearchbox:search W/VelvetPresenter: Still observing while not the active client
09-20 01:53:00.265 8337-8337/com.google.android.googlequicksearchbox:search W/VelvetPresenter: Still observing while not the active client
09-20 01:53:00.274 8337-9508/com.google.android.googlequicksearchbox:search I/HotwordRecognitionRnr: Hotword detection finished
09-20 01:53:00.276 8337-8504/com.google.android.googlequicksearchbox:search I/HotwordRecognitionRnr: Stopping hotword detection.
09-20 01:53:00.306 8337-9329/com.google.android.googlequicksearchbox:search W/TRThreadPoolExecutor: Task c[startRecognition] took 366597ms, which is over the 300000ms threshold
09-20 01:53:00.494 7724-7734/system_process I/art: Background partial concurrent mark sweep GC freed 20628(1791KB) AllocSpace objects, 13(320KB) LOS objects, 31% free, 8MB/12MB, paused 915us total 350.246ms
09-20 01:53:00.542 8337-8347/com.google.android.googlequicksearchbox:search I/art: Background sticky concurrent mark sweep GC freed 27734(1016KB) AllocSpace objects, 1(16KB) LOS objects, 9% free, 10MB/11MB, paused 1.383ms total 225.598ms
09-20 01:53:00.577 8094-8094/com.google.android.googlequicksearchbox I/GEL: handleIntent(Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10600000 cmp=com.google.android.googlequicksearchbox/com.google.android.launcher.GEL (has extras) })
09-20 01:53:00.701 8337-9517/com.google.android.googlequicksearchbox:search W/art: Verification of void com.google.android.apps.gsa.extradex.bloblobber.k.save() took 107.172ms
09-20 01:53:00.899 8511-9514/com.google.android.gms D/DropBoxEntryAddedChimeraService: User is not opted-in to Usage & Diagnostics or Lockbox.
09-20 01:53:01.047 8337-9517/com.google.android.googlequicksearchbox:search W/art: Verification of boolean com.google.android.apps.gsa.extradex.bloblobber.m.a(java.io.File, android.content.Context) took 136.969ms
09-20 01:53:01.327 8337-9517/com.google.android.googlequicksearchbox:search W/System: ClassLoader referenced unknown path: /system/priv-app/PrebuiltGmsCore/lib/x86
09-20 01:53:01.701 8337-8347/com.google.android.googlequicksearchbox:search I/art: Background sticky concurrent mark sweep GC freed 4689(892KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 11MB/11MB, paused 3.743ms total 355.853ms
09-20 01:53:01.939 8337-9388/com.google.android.googlequicksearchbox:search E/Surface: getSlotFromBufferLocked: unknown buffer: 0xe06f61a0
09-20 01:53:01.991 8094-8094/com.google.android.googlequicksearchbox I/Choreographer: Skipped 63 frames! The application may be doing too much work on its main thread.
09-20 01:53:02.122 7820-7833/com.android.systemui I/art: Background partial concurrent mark sweep GC freed 50589(1951KB) AllocSpace objects, 0(0B) LOS objects, 39% free, 5MB/9MB, paused 821us total 322.859ms
09-20 01:53:02.158 8337-8347/com.google.android.googlequicksearchbox:search I/art: Background partial concurrent mark sweep GC freed 4540(265KB) AllocSpace objects, 6(2MB) LOS objects, 30% free, 9MB/13MB, paused 5.075ms total 287.771ms
09-20 01:53:02.186 8337-9521/com.google.android.googlequicksearchbox:search I/HotwordRecognitionRnr: Starting hotword detection.
09-20 01:53:02.190 8337-9522/com.google.android.googlequicksearchbox:search I/MicrophoneInputStream: mic_starting com.google.android.apps.gsa.speech.audio.u#5e96f99
09-20 01:53:02.296 8094-8353/com.google.android.googlequicksearchbox W/OpenGLRenderer: Incorrectly called buildLayer on View: em, destroying layer...
09-20 01:53:02.309 7462-7976/? E/audio_hw_generic: Error opening input stream format 1, channel_mask 0010, sample_rate 16000
09-20 01:53:02.402 7462-9524/? I/AudioFlinger: AudioFlinger's thread 0xf39c0000 ready to run
09-20 01:53:02.442 8337-9522/com.google.android.googlequicksearchbox:search I/MicrophoneInputStream: mic_started com.google.android.apps.gsa.speech.audio.u#5e96f99
09-20 01:53:02.536 1187-1187/? W/SurfaceFlinger: couldn't log to binary event log: overflow.
09-20 01:53:02.563 8337-8337/com.google.android.googlequicksearchbox:search I/HotwordWorker: onReady
09-20 01:53:02.699 8337-9517/com.google.android.googlequicksearchbox:search W/System: ClassLoader referenced unknown path: /system/priv-app/PrebuiltGmsCore/lib/x86
09-20 01:53:02.700 8337-9517/com.google.android.googlequicksearchbox:search W/System: ClassLoader referenced unknown path: /system/priv-app/PrebuiltGmsCore/lib/x86
09-20 01:53:03.297 8337-8347/com.google.android.googlequicksearchbox:search I/art: Background sticky concurrent mark sweep GC freed 20524(1572KB) AllocSpace objects, 0(0B) LOS objects, 8% free, 11MB/13MB, paused 5.204ms total 170.783ms
09-20 01:53:03.326 8337-9517/com.google.android.googlequicksearchbox:search W/linker: /system/priv-app/PrebuiltGmsCore/PrebuiltGmsCore.apk: unused DT entry: type 0x7ffffffd arg 0xa0a
09-20 01:53:03.811 8337-9517/com.google.android.googlequicksearchbox:search W/System: ClassLoader referenced unknown path: /system/priv-app/PrebuiltGmsCore/lib/x86
09-20 01:53:03.813 8337-9517/com.google.android.googlequicksearchbox:search W/System: ClassLoader referenced unknown path: /system/priv-app/PrebuiltGmsCore/lib/x86
09-20 01:53:04.023 8337-8347/com.google.android.googlequicksearchbox:search I/art: Background sticky concurrent mark sweep GC freed 2343(173KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 13MB/13MB, paused 14.298ms total 92.333ms
09-20 01:53:04.154 8337-8347/com.google.android.googlequicksearchbox:search I/art: Background partial concurrent mark sweep GC freed 9385(661KB) AllocSpace objects, 1(68KB) LOS objects, 22% free, 13MB/17MB, paused 2.174ms total 103.590ms
09-20 01:53:04.283 8337-9517/com.google.android.googlequicksearchbox:search W/linker: /system/priv-app/PrebuiltGmsCore/PrebuiltGmsCore.apk: unused DT entry: type 0x1d arg 0x91
09-20 01:53:04.283 8337-9517/com.google.android.googlequicksearchbox:search W/linker: /system/priv-app/PrebuiltGmsCore/PrebuiltGmsCore.apk: unused DT entry: type 0x7ffffffd arg 0x174
09-20 01:53:04.292 8337-9517/com.google.android.googlequicksearchbox:search V/JNIHelp: Registering com/google/android/gms/org/conscrypt/NativeCrypto's 255 native methods...
09-20 01:53:05.042 8337-9517/com.google.android.googlequicksearchbox:search I/ProviderInstaller: Installed default security provider GmsCore_OpenSSL
09-20 01:53:06.078 8511-9539/com.google.android.gms D/DropBoxEntryAddedChimeraService: User is not opted-in to Usage & Diagnostics or Lockbox.
09-20 01:53:06.442 7724-7739/system_process W/art: Long monitor contention event with owner method=android.content.ComponentName com.android.server.am.ActivityManagerService.startService(android.app.IApplicationThread, android.content.Intent, java.lang.String, java.lang.String, int) from ActivityManagerService.java:15676 waiters=0 for 120ms
How can I solve this?
I also encountered the error message
Error code: 393238 | Buffer overflow, no available space.
For me, the reason was that I was targeting Android 24. Android 24 has a change that results in a FileUreExposedException being thrown when using a file:// URI instead of a content:// URI. For more details, see:
https://developer.android.com/reference/android/os/FileUriExposedException.html
Unfortunately, the emulator swallowed this exception so it was a bit difficult to detect; it showed only the "Buffer overflow, no available space." message.
A simple workaround is to target Android 23.
Better solutions are described here:
android.os.FileUriExposedException: file:///storage/emulated/0/test.txt exposed beyond app through Intent.getData()

setSupportActionBar() Makes my app disfunction

For some reason when i put the line setSupportActionBar(MyToolBarVariable)... It goes on to my Genymotion Emulator.. But when it opens the app, it says :
Unfourtuanetly "AppName" has Stoped
But if i delete the setSupportActionBar() Everything works fine... Whats the problem here.. Im going to post MainActivity.java file.. If you need to see others please tell me so below. Thanks for helping!
package com.example.amanuel.zoo4;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
setContentView(R.layout.activity_main);
}
}
Here is the LOGCAT When i press the app in my emulator!
04-06 02:09:02.522 652-1011/? I/ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.example.amanuel.zoo4/.MainActivity (has extras)} from uid 10008 on display 0
04-06 02:09:02.721 3360-3360/? I/art: Late-enabling -Xcheck:jni
04-06 02:09:02.762 652-1021/? I/ActivityManager: Start proc 3360:com.example.amanuel.zoo4/u0a63 for activity com.example.amanuel.zoo4/.MainActivity
04-06 02:09:02.815 652-667/? W/art: Long monitor contention event with owner method=void com.android.server.am.ActivityManagerService.activityPaused(android.os.IBinder) from ActivityManagerService.java:6439 waiters=1 for 136ms
04-06 02:09:02.978 3360-3360/? W/System: ClassLoader referenced unknown path: /data/app/com.example.amanuel.zoo4-2/lib/x86
04-06 02:09:03.170 3360-3360/? D/AndroidRuntime: Shutting down VM
04-06 02:09:03.178 3360-3360/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.amanuel.zoo4, PID: 3360
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.amanuel.zoo4/com.example.amanuel.zoo4.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence android.support.v7.widget.Toolbar.getTitle()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence android.support.v7.widget.Toolbar.getTitle()' on a null object reference
at android.support.v7.internal.widget.ToolbarWidgetWrapper.<init>(ToolbarWidgetWrapper.java:94)
at android.support.v7.internal.widget.ToolbarWidgetWrapper.<init>(ToolbarWidgetWrapper.java:87)
at android.support.v7.internal.app.ToolbarActionBar.<init>(ToolbarActionBar.java:77)
at android.support.v7.app.AppCompatDelegateImplV7.setSupportActionBar(AppCompatDelegateImplV7.java:198)
at android.support.v7.app.AppCompatActivity.setSupportActionBar(AppCompatActivity.java:96)
at com.example.amanuel.zoo4.MainActivity.onCreate(MainActivity.java:13)
at android.app.Activity.performCreate(Activity.java:6237)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
at android.app.ActivityThread.-wrap11(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5417) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
04-06 02:09:03.193 652-1021/? W/ActivityManager: Force finishing activity com.example.amanuel.zoo4/.MainActivity
04-06 02:09:03.500 652-1021/? I/WindowManager: Screenshot max retries 4 of Token{75d8954 ActivityRecord{722f0a7 u0 com.example.amanuel.zoo4/.MainActivity t42 f}} appWin=Window{450aeec u0 Starting com.example.amanuel.zoo4} drawState=1
04-06 02:09:03.514 652-652/? W/art: Long monitor contention event with owner method=void com.android.server.am.ActivityManagerService.crashApplication(com.android.server.am.ProcessRecord, android.app.ApplicationErrorReport$CrashInfo) from ActivityManagerService.java:12502 waiters=0 for 299ms
04-06 02:09:03.639 652-666/? W/art: Long monitor contention event with owner method=void com.android.server.am.ActivityManagerService.crashApplication(com.android.server.am.ProcessRecord, android.app.ApplicationErrorReport$CrashInfo) from ActivityManagerService.java:12502 waiters=1 for 216ms
04-06 02:09:03.640 652-652/? W/art: Long monitor contention event with owner method=void com.android.server.am.ActivityManagerService$UiHandler.handleMessage(android.os.Message) from ActivityManagerService.java:1397 waiters=1 for 111ms
04-06 02:09:03.814 652-1641/? I/OpenGLRenderer: Initialized EGL, version 1.4
04-06 02:09:04.021 652-666/? W/ActivityManager: Activity pause timeout for ActivityRecord{722f0a7 u0 com.example.amanuel.zoo4/.MainActivity t42 f}
04-06 02:09:04.129 652-1641/? W/EGL_emulation: eglSurfaceAttrib not implemented
04-06 02:09:04.130 652-1641/? W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xd60610a0, error=EGL_SUCCESS
04-06 02:09:04.198 652-667/? I/Choreographer: Skipped 32 frames! The application may be doing too much work on its main thread.
04-06 02:09:04.303 652-981/? I/ActivityManager: Killing 1792:com.android.keychain/1000 (adj 15): empty for 3078s
04-06 02:09:04.763 652-668/? E/BluetoothAdapter: Bluetooth binder is null
04-06 02:09:04.825 652-667/? I/Choreographer: Skipped 37 frames! The application may be doing too much work on its main thread.
04-06 02:09:07.697 3360-3360/? I/Process: Sending signal. PID: 3360 SIG: 9
04-06 02:09:07.732 652-679/? I/ActivityManager: Process com.example.amanuel.zoo4 (pid 3360) has died
04-06 02:09:07.771 652-1641/? E/Surface: getSlotFromBufferLocked: unknown buffer: 0xde8f0df0
04-06 02:09:07.844 652-1641/? D/OpenGLRenderer: endAllStagingAnimators on 0xda3b2380 (RippleDrawable) with handle 0xdc57f670
04-06 02:09:07.852 652-652/? W/art: Long monitor contention event with owner method=void android.view.WindowManagerGlobal.removeView(android.view.View, boolean) from WindowManagerGlobal.java:349 waiters=0 for 102ms
04-06 02:09:07.854 652-1164/? W/InputMethodManagerService: Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#bc8dc8f attribute=null, token = android.os.BinderProxy#4b639cb
04-06 02:09:08.200 652-671/? W/AppOps: Finishing op nesting under-run: uid 1000 pkg android code 24 time=0 duration=0 nesting=0
04-06 02:09:12.630 308-647/? W/AudioFlinger: write blocked for 9842 msecs, 14 delayed writes, thread 0xf1e00000
04-06 02:09:18.081 100-100/? D/Genyd: Received Set Clipboard
04-06 02:09:18.081 100-100/? D/Genymotion: Received Set Clipboard
Try putting setContentView(R.layout.activity_main); before trying to instantiate the Toolbar.

Android studio: White space over top bar icons

It seems that I'm having a small problem when testing my app on Android Studio. A white bar is always being displayed in place of top bar icons (battery, time, etc), whenever I run my app on the emulator. I am not sure what this issue is but below shows a screenshot of my problem and logcat findings:
12-07 16:05:08.932 3003-3003/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
12-07 16:05:08.934 3003-3003/? D/AndroidRuntime: CheckJNI is ON
12-07 16:05:08.954 3003-3003/? I/art: JIT created with code_cache_capacity=2MB compile_threshold=1000
12-07 16:05:08.960 3003-3003/? D/ICU: No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
12-07 16:05:09.006 3003-3003/? E/memtrack: Couldn't load memtrack module (No such file or directory)
12-07 16:05:09.006 3003-3003/? E/android.os.Debug: failed to load memtrack module: -2
12-07 16:05:09.008 3003-3003/? I/Radio-JNI: register_android_hardware_Radio DONE
12-07 16:05:09.026 3003-3003/? D/AndroidRuntime: Calling main entry com.android.commands.am.Am
12-07 16:05:09.031 1299-1311/? I/ActivityManager: Force stopping com.example.unknown.check_files appid=10057 user=0: from pid 3003
12-07 16:05:09.031 1299-1311/? I/ActivityManager: Killing 2975:com.example.unknown.check_files/u0a57 (adj 0): stop com.example.unknown.check_files
12-07 16:05:09.038 1299-1334/? W/InputDispatcher: channel '36fa2b9 com.example.unknown.check_files/com.example.unknown.check_files.testing (server)' ~ Consumer closed input channel or an error occurred. events=0x9
12-07 16:05:09.038 1299-1334/? E/InputDispatcher: channel '36fa2b9 com.example.unknown.check_files/com.example.unknown.check_files.testing (server)' ~ Channel is unrecoverably broken and will be disposed!
12-07 16:05:09.040 1299-1310/? D/GraphicsStats: Buffer count: 3
12-07 16:05:09.040 1299-1310/? I/WindowState: WIN DEATH: Window{36fa2b9 u0 com.example.unknown.check_files/com.example.unknown.check_files.testing}
12-07 16:05:09.040 1299-1310/? W/InputDispatcher: Attempted to unregister already unregistered input channel '36fa2b9 com.example.unknown.check_files/com.example.unknown.check_files.testing (server)'
12-07 16:05:09.063 1299-1311/? W/ActivityManager: Force removing ActivityRecord{4ee7b6f u0 com.example.unknown.check_files/.testing t8}: app died, no saved state
12-07 16:05:09.092 3003-3003/? D/AndroidRuntime: Shutting down VM
12-07 16:05:09.101 1299-2121/? W/ActivityManager: Spurious death for ProcessRecord{638c7d6 0:com.example.unknown.check_files/u0a57}, curProc for 2975: null
12-07 16:05:09.159 2216-2241/? W/EGL_emulation: eglSurfaceAttrib not implemented
12-07 16:05:09.159 2216-2241/? W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xa1a8e3a0, error=EGL_SUCCESS
12-07 16:05:10.147 3017-3017/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
12-07 16:05:10.148 3017-3017/? D/AndroidRuntime: CheckJNI is ON
12-07 16:05:10.179 3013-3013/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
12-07 16:05:10.181 3013-3013/? D/AndroidRuntime: CheckJNI is ON
12-07 16:05:10.222 3017-3017/? I/art: JIT created with code_cache_capacity=2MB compile_threshold=1000
12-07 16:05:10.227 3017-3017/? D/ICU: No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
12-07 16:05:10.248 3013-3013/? I/art: JIT created with code_cache_capacity=2MB compile_threshold=1000
12-07 16:05:10.264 3013-3013/? D/ICU: No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
12-07 16:05:10.324 3013-3013/? E/memtrack: Couldn't load memtrack module (No such file or directory)
12-07 16:05:10.325 3013-3013/? E/android.os.Debug: failed to load memtrack module: -2
12-07 16:05:10.326 3013-3013/? I/Radio-JNI: register_android_hardware_Radio DONE
12-07 16:05:10.341 3017-3017/? E/memtrack: Couldn't load memtrack module (No such file or directory)
12-07 16:05:10.341 3017-3017/? E/android.os.Debug: failed to load memtrack module: -2
12-07 16:05:10.371 3017-3017/? I/Radio-JNI: register_android_hardware_Radio DONE
12-07 16:05:10.378 3013-3013/? D/AndroidRuntime: Calling main entry com.android.commands.wm.Wm
12-07 16:05:10.426 1299-2121/? W/InputMethodManagerService: Got RemoteException sending setActive(false) notification to pid 2975 uid 10057
12-07 16:05:10.426 3013-3013/? D/AndroidRuntime: Shutting down VM
12-07 16:05:10.431 2216-2216/? I/Choreographer: Skipped 71 frames! The application may be doing too much work on its main thread.
12-07 16:05:10.528 3017-3017/? D/AndroidRuntime: Calling main entry com.android.commands.am.Am
12-07 16:05:10.548 1299-2121/? I/ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.unknown.check_files/.testing} from uid 0 on display 0
12-07 16:05:10.584 3017-3017/? D/AndroidRuntime: Shutting down VM
12-07 16:05:10.604 1299-1310/? I/ActivityManager: Start proc 3034:com.example.unknown.check_files/u0a57 for activity com.example.unknown.check_files/.testing
12-07 16:05:10.617 3034-3034/? I/art: Not late-enabling -Xcheck:jni (already on)
12-07 16:05:10.617 3034-3034/? I/art: Late-enabling JIT
12-07 16:05:10.684 3034-3034/? I/art: JIT created with code_cache_capacity=2MB compile_threshold=1000
12-07 16:05:10.708 3034-3034/? W/System: ClassLoader referenced unknown path: /data/app/com.example.unknown.check_files-1/lib/x86
12-07 16:05:10.823 953-1333/? E/SurfaceFlinger: ro.sf.lcd_density must be defined as a build property
12-07 16:05:10.825 3034-3049/? D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
12-07 16:05:10.861 3034-3045/? I/art: Background sticky concurrent mark sweep GC freed 6483(389KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 9MB/9MB, paused 33.060ms total 81.160ms
12-07 16:05:10.929 3034-3049/? I/OpenGLRenderer: Initialized EGL, version 1.4
12-07 16:05:11.046 3034-3049/? W/EGL_emulation: eglSurfaceAttrib not implemented
12-07 16:05:11.046 3034-3049/? W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xad72e280, error=EGL_SUCCESS
12-07 16:05:11.355 1299-1322/? I/Choreographer: Skipped 44 frames! The application may be doing too much work on its main thread.
12-07 16:05:11.413 2216-2241/? W/OpenGLRenderer: Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer...
12-07 16:05:11.413 2216-2241/? W/OpenGLRenderer: Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer...
12-07 16:05:11.417 2216-2241/? E/Surface: getSlotFromBufferLocked: unknown buffer: 0xa38c25b0
12-07 16:05:12.157 1299-1322/? I/ActivityManager: Displayed com.example.unknown.check_files/.testing: +1s576ms
As of Android 5.0, the status bar is colored separately from the ActionBar. Make sure that you haven't set android:statusBarColor to #color/white in your base theme.
More info on Themes and Status Bar coloring here.
If you watch closely, it is not just a white bar. Your status bar color is set to white. You can see all the icons. So change the color by,
Window window = activity.getWindow();
// clear FLAG_TRANSLUCENT_STATUS flag:
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
// add FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS flag to the window
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
// finally change the color
window.setStatusBarColor(YOUR_COLOR);
or, in theme, change colorPrimaryDark which will be used as statusbar color.
Note : this method is added in API level 21.
Read more about it here

Android Wifi scanning too slow

I am at the beginning stage on developing an application, which needs scan the wifi APs per second. The scanning part works well on one HTC hero, however, it takes 6 seconds for my galaxy tab to finish one scan.
I write a very simple program, scanning wifi continuously and note down how long it takes for one scan. (from wifi.startScan() to receiver get results). In HTC phone, it's 500 ms, but in Samsung tab, it takes 6s on average. I wonder if anyone can help me to solve this problem. Is it because Samsung changed the os or because the hardware's problem?
the program is as follows:
import java.util.Date;
import java.util.List;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
public class wifiScan extends Activity {
private class WifiReceiver extends BroadcastReceiver{
#Override
public void onReceive(Context c, Intent intent) {
List<ScanResult> results = wifi.getScanResults();
Date tempDate=new Date();
String info=testNumber+" "+(tempDate.getTime()-testDate.getTime())+" "+results.size();
Log.i("wifiScan", info);
wifiText.setText(info);
testNumber++;
testDate=new Date();
wifi.startScan();
}
}
private TextView wifiText;
private WifiManager wifi;
private WifiReceiver receiver;
private Date testDate;
private static int testNumber=0;
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
testNumber=0;
wifiText = (TextView) findViewById(R.id.wifiText);
receiver=new WifiReceiver();
registerReceiver(receiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
wifi =(WifiManager)getSystemService(Context.WIFI_SERVICE);
if(!wifi.isWifiEnabled()){
wifi.setWifiEnabled(true);
}
startScan();
}
#Override
public void onStop(){
super.onStop();
finish();
}
public void startScan(){
testDate=new Date();
wifi.startScan();
}
}
The log info is as follows:
02-16 15:42:22.600: WARN/PowerManagerService(2484): Timer 0x1->0x0|0x1
02-16 15:42:22.600: ERROR/PowerManagerService(2484): CurLock p:3 mPS:1
02-16 15:42:22.600: WARN/PowerManagerService(2484): type=SCREEN_DIM_WAKE_LOCK 'StayOnWhilePluggedIn Screen Dim' active (minState=1) activeT=1257228
02-16 15:42:22.607: WARN/PowerManagerService(2484): type=PARTIAL_WAKE_LOCK 'StayOnWhilePluggedIn Partial' active (minState=0) activeT=1257228
02-16 15:42:24.005: DEBUG/dalvikvm(3374): GC_EXPLICIT freed 790 objects / 55536 bytes in 143ms
02-16 15:42:24.775: DEBUG/AndroidRuntime(4056): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
02-16 15:42:24.775: DEBUG/AndroidRuntime(4056): CheckJNI is OFF
02-16 15:42:24.784: DEBUG/AndroidRuntime(4056): setted country_code = SINGAPORE
02-16 15:42:24.784: DEBUG/AndroidRuntime(4056): setted sales_code = XSP
02-16 15:42:24.784: DEBUG/AndroidRuntime(4056): found sales_code tag = <XSP>, </XSP>
02-16 15:42:24.792: DEBUG/dalvikvm(4056): creating instr width table
02-16 15:42:24.822: DEBUG/AndroidRuntime(4056): --- registering native functions ---
02-16 15:42:24.904: DEBUG/LibQmg_native(4056): register_android_app_LibQmg
02-16 15:42:24.986: DEBUG/AndroidRuntime(4056): Shutting down VM
02-16 15:42:24.986: DEBUG/dalvikvm(4056): Debugger has detached; object registry had 1 entries
02-16 15:42:24.993: INFO/AndroidRuntime(4056): NOTE: attach of thread 'Binder Thread #2' failed
02-16 15:42:25.169: DEBUG/AndroidRuntime(4064): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
02-16 15:42:25.169: DEBUG/AndroidRuntime(4064): CheckJNI is OFF
02-16 15:42:25.176: DEBUG/AndroidRuntime(4064): setted country_code = SINGAPORE
02-16 15:42:25.176: DEBUG/AndroidRuntime(4064): setted sales_code = XSP
02-16 15:42:25.176: DEBUG/AndroidRuntime(4064): found sales_code tag = <XSP>, </XSP>
02-16 15:42:25.184: DEBUG/dalvikvm(4064): creating instr width table
02-16 15:42:25.212: DEBUG/AndroidRuntime(4064): --- registering native functions ---
02-16 15:42:25.286: DEBUG/LibQmg_native(4064): register_android_app_LibQmg
02-16 15:42:25.368: INFO/ActivityManager(2484): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=nus.master.test/.wifiScan }
02-16 15:42:25.376: INFO/Launcher(3211): onPause()
02-16 15:42:25.411: DEBUG/AndroidRuntime(4064): Shutting down VM
02-16 15:42:25.411: DEBUG/dalvikvm(4064): Debugger has detached; object registry had 1 entries
02-16 15:42:25.419: INFO/AndroidRuntime(4064): NOTE: attach of thread 'Binder Thread #2' failed
02-16 15:42:25.450: INFO/wpa_supplicant(3810): CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00
02-16 15:42:25.450: INFO/WifiMonitor(2484): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00]
02-16 15:42:25.454: VERBOSE/WifiStateTracker(2484): Changing supplicant state: INACTIVE ==> SCANNING
02-16 15:42:25.454: DEBUG/NetworkStateTracker(2484): setDetailed state, old =IDLE and new state=SCANNING
02-16 15:42:25.454: DEBUG/ConnectivityService(2484): Dropping ConnectivityChange for WIFI: DISCONNECTED/SCANNING
02-16 15:42:25.611: INFO/Launcher(3211): onWindowFocusChanged(false)
02-16 15:42:30.724: DEBUG/dalvikvm(3200): GC_EXPLICIT freed 4001 objects / 233800 bytes in 118ms
02-16 15:42:30.892: INFO/WifiMonitor(2484): Event [ SCAN-RESULTS ]
02-16 15:42:30.892: INFO/wpa_supplicant(3810): WPS-AP-AVAILABLE
02-16 15:42:30.892: INFO/wpa_supplicant(3810): CTRL-EVENT-NO-CONNECTION
02-16 15:42:30.896: INFO/wpa_supplicant(3810): CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00
02-16 15:42:30.900: INFO/WifiMonitor(2484): Event [WPS-AP-AVAILABLE ]
02-16 15:42:30.900: INFO/WifiMonitor(2484): Event [CTRL-EVENT-NO-CONNECTION]
02-16 15:42:30.900: INFO/WifiMonitor(2484): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00]
02-16 15:42:30.947: INFO/wpa_supplicant(3810): SAN_RESULTS : [34]
02-16 15:42:30.958: INFO/wpa_supplicant(3810): SAN_RESULTS : [34]
02-16 15:42:30.970: VERBOSE/WifiStateTracker(2484): Changing supplicant state: SCANNING ==> INACTIVE
02-16 15:42:30.970: DEBUG/NetworkStateTracker(2484): setDetailed state, old =SCANNING and new state=IDLE
02-16 15:42:30.970: DEBUG/ConnectivityService(2484): Dropping ConnectivityChange for WIFI: DISCONNECTED/IDLE
02-16 15:42:31.009: INFO/NetworkStatusReceiver(2935): action: android.net.wifi.SHOW_AP_LIST_DIALOG
02-16 15:42:31.021: ERROR/WifiManager(2935): showApDialog
02-16 15:42:31.025: INFO/WifiService(2484): isShowingAccessPointListDialog():false
02-16 15:42:31.029: INFO/WifiService(2484): setShowAccessPointListDialog():false
02-16 15:42:31.060: INFO/wifiScan(4009): 0 5609 21
02-16 15:42:31.064: INFO/wpa_supplicant(3810): CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00
02-16 15:42:31.064: INFO/WifiMonitor(2484): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00]
02-16 15:42:31.068: VERBOSE/WifiStateTracker(2484): Changing supplicant state: INACTIVE ==> SCANNING
02-16 15:42:31.068: DEBUG/NetworkStateTracker(2484): setDetailed state, old =IDLE and new state=SCANNING
02-16 15:42:31.068: DEBUG/ConnectivityService(2484): Dropping ConnectivityChange for WIFI: DISCONNECTED/SCANNING
02-16 15:42:36.536: INFO/WifiMonitor(2484): Event [ SCAN-RESULTS ]
02-16 15:42:36.536: INFO/wpa_supplicant(3810): WPS-AP-AVAILABLE
02-16 15:42:36.536: INFO/wpa_supplicant(3810): CTRL-EVENT-NO-CONNECTION
02-16 15:42:36.540: INFO/wpa_supplicant(3810): CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00
02-16 15:42:36.544: INFO/WifiMonitor(2484): Event [WPS-AP-AVAILABLE ]
02-16 15:42:36.544: INFO/WifiMonitor(2484): Event [CTRL-EVENT-NO-CONNECTION]
02-16 15:42:36.544: INFO/WifiMonitor(2484): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00]
02-16 15:42:36.587: INFO/wpa_supplicant(3810): SAN_RESULTS : [35]
02-16 15:42:36.611: INFO/wpa_supplicant(3810): SAN_RESULTS : [35]
02-16 15:42:36.634: VERBOSE/WifiStateTracker(2484): Changing supplicant state: SCANNING ==> INACTIVE
02-16 15:42:36.634: DEBUG/NetworkStateTracker(2484): setDetailed state, old =SCANNING and new state=IDLE
02-16 15:42:36.661: INFO/NetworkStatusReceiver(2935): action: android.net.wifi.SHOW_AP_LIST_DIALOG
02-16 15:42:36.665: DEBUG/ConnectivityService(2484): Dropping ConnectivityChange for WIFI: DISCONNECTED/IDLE
02-16 15:42:36.665: ERROR/WifiManager(2935): showApDialog
02-16 15:42:36.669: INFO/WifiService(2484): isShowingAccessPointListDialog():false
02-16 15:42:36.669: INFO/WifiService(2484): setShowAccessPointListDialog():false
02-16 15:42:36.724: INFO/wifiScan(4009): 1 5662 22
02-16 15:42:36.728: INFO/wpa_supplicant(3810): CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00
02-16 15:42:36.728: INFO/WifiMonitor(2484): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00]
02-16 15:42:36.732: VERBOSE/WifiStateTracker(2484): Changing supplicant state: INACTIVE ==> SCANNING
02-16 15:42:36.732: DEBUG/NetworkStateTracker(2484): setDetailed state, old =IDLE and new state=SCANNING
02-16 15:42:36.736: DEBUG/ConnectivityService(2484): Dropping ConnectivityChange for WIFI: DISCONNECTED/SCANNING
02-16 15:42:41.247: DEBUG/BatteryService(2484): update start
02-16 15:42:41.275: DEBUG/BatteryService(2484): updateBattery level:83 scale:100 status:4 health:2 present:true voltage: 4051 temperature: 330 technology: Li-ion AC powered:false USB powered:true icon:17302421
02-16 15:42:41.314: DEBUG/CorePlayerService(3270): mSystemReceiver:onReceive(action=android.intent.action.BATTERY_CHANGED) is called
02-16 15:42:41.357: DEBUG/WifiService(2484): ACTION_BATTERY_CHANGED pluggedType: 2
02-16 15:42:42.177: INFO/WifiMonitor(2484): Event [ SCAN-RESULTS ]
02-16 15:42:42.177: INFO/wpa_supplicant(3810): WPS-AP-AVAILABLE
02-16 15:42:42.181: INFO/wpa_supplicant(3810): CTRL-EVENT-NO-CONNECTION
02-16 15:42:42.181: INFO/wpa_supplicant(3810): CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00
02-16 15:42:42.185: INFO/WifiMonitor(2484): Event [WPS-AP-AVAILABLE ]
02-16 15:42:42.189: INFO/WifiMonitor(2484): Event [CTRL-EVENT-NO-CONNECTION]
02-16 15:42:42.193: INFO/WifiMonitor(2484): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00]
02-16 15:42:42.216: INFO/wpa_supplicant(3810): SAN_RESULTS : [36]
02-16 15:42:42.240: INFO/wpa_supplicant(3810): SAN_RESULTS : [36]
02-16 15:42:42.240: VERBOSE/WifiStateTracker(2484): Changing supplicant state: SCANNING ==> INACTIVE
02-16 15:42:42.240: DEBUG/NetworkStateTracker(2484): setDetailed state, old =SCANNING and new state=IDLE
02-16 15:42:42.247: DEBUG/ConnectivityService(2484): Dropping ConnectivityChange for WIFI: DISCONNECTED/IDLE
02-16 15:42:42.271: INFO/NetworkStatusReceiver(2935): action: android.net.wifi.SHOW_AP_LIST_DIALOG
02-16 15:42:42.271: ERROR/WifiManager(2935): showApDialog
02-16 15:42:42.275: INFO/WifiService(2484): isShowingAccessPointListDialog():false
02-16 15:42:42.282: INFO/WifiService(2484): setShowAccessPointListDialog():false
02-16 15:42:42.314: INFO/wifiScan(4009): 2 5588 21
02-16 15:42:42.322: INFO/wpa_supplicant(3810): CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00
02-16 15:42:42.322: INFO/WifiMonitor(2484): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00]
02-16 15:42:42.326: VERBOSE/WifiStateTracker(2484): Changing supplicant state: INACTIVE ==> SCANNING
02-16 15:42:42.329: DEBUG/NetworkStateTracker(2484): setDetailed state, old =IDLE and new state=SCANNING
02-16 15:42:42.329: DEBUG/ConnectivityService(2484): Dropping ConnectivityChange for WIFI: DISCONNECTED/SCANNING
02-16 15:42:43.255: DEBUG/BatteryService(2484): update start
02-16 15:42:43.294: DEBUG/BatteryService(2484): updateBattery level:83 scale:100 status:4 health:2 present:true voltage: 4080 temperature: 320 technology: Li-ion AC powered:false USB powered:true icon:17302421
02-16 15:42:43.384: DEBUG/WifiService(2484): ACTION_BATTERY_CHANGED pluggedType: 2
02-16 15:42:43.388: DEBUG/CorePlayerService(3270): mSystemReceiver:onReceive(action=android.intent.action.BATTERY_CHANGED) is called
02-16 15:42:47.783: INFO/WifiMonitor(2484): Event [ SCAN-RESULTS ]
02-16 15:42:47.786: INFO/wpa_supplicant(3810): WPS-AP-AVAILABLE
02-16 15:42:47.786: INFO/wpa_supplicant(3810): CTRL-EVENT-NO-CONNECTION
02-16 15:42:47.786: INFO/wpa_supplicant(3810): CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00
02-16 15:42:47.798: INFO/WifiMonitor(2484): Event [WPS-AP-AVAILABLE ]
02-16 15:42:47.798: INFO/WifiMonitor(2484): Event [CTRL-EVENT-NO-CONNECTION]
02-16 15:42:47.814: INFO/WifiMonitor(2484): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00]
02-16 15:42:47.826: INFO/wpa_supplicant(3810): SAN_RESULTS : [38]
02-16 15:42:47.853: INFO/wpa_supplicant(3810): SAN_RESULTS : [38]
02-16 15:42:47.872: VERBOSE/WifiStateTracker(2484): Changing supplicant state: SCANNING ==> INACTIVE
02-16 15:42:47.872: DEBUG/NetworkStateTracker(2484): setDetailed state, old =SCANNING and new state=IDLE
02-16 15:42:47.904: INFO/NetworkStatusReceiver(2935): action: android.net.wifi.SHOW_AP_LIST_DIALOG
02-16 15:42:47.919: DEBUG/ConnectivityService(2484): Dropping ConnectivityChange for WIFI: DISCONNECTED/IDLE
02-16 15:42:47.923: ERROR/WifiManager(2935): showApDialog
02-16 15:42:47.927: INFO/WifiService(2484): isShowingAccessPointListDialog():false
02-16 15:42:47.931: INFO/WifiService(2484): setShowAccessPointListDialog():false
02-16 15:42:47.970: INFO/wifiScan(4009): 3 5652 26
02-16 15:42:47.974: INFO/wpa_supplicant(3810): CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00
02-16 15:42:47.974: INFO/WifiMonitor(2484): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00]
02-16 15:42:47.986: VERBOSE/WifiStateTracker(2484): Changing supplicant state: INACTIVE ==> SCANNING
02-16 15:42:47.986: DEBUG/NetworkStateTracker(2484): setDetailed state, old =IDLE and new state=SCANNING
02-16 15:42:47.986: DEBUG/ConnectivityService(2484): Dropping ConnectivityChange for WIFI: DISCONNECTED/SCANNING
02-16 15:42:53.423: INFO/WifiMonitor(2484): Event [ SCAN-RESULTS ]
02-16 15:42:53.427: INFO/wpa_supplicant(3810): WPS-AP-AVAILABLE
02-16 15:42:53.427: INFO/wpa_supplicant(3810): CTRL-EVENT-NO-CONNECTION
02-16 15:42:53.427: INFO/wpa_supplicant(3810): CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00
02-16 15:42:53.435: INFO/WifiMonitor(2484): Event [WPS-AP-AVAILABLE ]
02-16 15:42:53.439: INFO/WifiMonitor(2484): Event [CTRL-EVENT-NO-CONNECTION]
02-16 15:42:53.439: INFO/WifiMonitor(2484): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00]
02-16 15:42:53.462: INFO/wpa_supplicant(3810): SAN_RESULTS : [37]
02-16 15:42:53.482: INFO/wpa_supplicant(3810): SAN_RESULTS : [37]
02-16 15:42:53.493: VERBOSE/WifiStateTracker(2484): Changing supplicant state: SCANNING ==> INACTIVE
02-16 15:42:53.497: DEBUG/NetworkStateTracker(2484): setDetailed state, old =SCANNING and new state=IDLE
02-16 15:42:53.525: DEBUG/ConnectivityService(2484): Dropping ConnectivityChange for WIFI: DISCONNECTED/IDLE
02-16 15:42:53.529: INFO/NetworkStatusReceiver(2935): action: android.net.wifi.SHOW_AP_LIST_DIALOG
02-16 15:42:53.529: ERROR/WifiManager(2935): showApDialog
02-16 15:42:53.532: INFO/WifiService(2484): isShowingAccessPointListDialog():false
02-16 15:42:53.532: INFO/WifiService(2484): setShowAccessPointListDialog():false
02-16 15:42:53.575: INFO/wifiScan(4009): 4 5602 24
02-16 15:42:53.579: INFO/wpa_supplicant(3810): CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00
02-16 15:42:53.579: INFO/WifiMonitor(2484): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00]
02-16 15:42:53.591: VERBOSE/WifiStateTracker(2484): Changing supplicant state: INACTIVE ==> SCANNING
02-16 15:42:53.591: DEBUG/NetworkStateTracker(2484): setDetailed state, old =IDLE and new state=SCANNING
02-16 15:42:53.595: DEBUG/ConnectivityService(2484): Dropping ConnectivityChange for WIFI: DISCONNECTED/SCANNING
02-16 15:42:59.040: INFO/WifiMonitor(2484): Event [ SCAN-RESULTS ]
02-16 15:42:59.040: INFO/wpa_supplicant(3810): WPS-AP-AVAILABLE
02-16 15:42:59.044: INFO/wpa_supplicant(3810): CTRL-EVENT-NO-CONNECTION
02-16 15:42:59.048: INFO/wpa_supplicant(3810): CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00
02-16 15:42:59.048: INFO/WifiMonitor(2484): Event [WPS-AP-AVAILABLE ]
02-16 15:42:59.056: INFO/WifiMonitor(2484): Event [CTRL-EVENT-NO-CONNECTION]
02-16 15:42:59.075: INFO/WifiMonitor(2484): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00]
02-16 15:42:59.091: INFO/wpa_supplicant(3810): SAN_RESULTS : [38]
02-16 15:42:59.115: INFO/wpa_supplicant(3810): SAN_RESULTS : [38]
02-16 15:42:59.122: VERBOSE/WifiStateTracker(2484): Changing supplicant state: SCANNING ==> INACTIVE
02-16 15:42:59.122: DEBUG/NetworkStateTracker(2484): setDetailed state, old =SCANNING and new state=IDLE
02-16 15:42:59.138: DEBUG/ConnectivityService(2484): Dropping ConnectivityChange for WIFI: DISCONNECTED/IDLE
02-16 15:42:59.142: INFO/NetworkStatusReceiver(2935): action: android.net.wifi.SHOW_AP_LIST_DIALOG
02-16 15:42:59.154: ERROR/WifiManager(2935): showApDialog
02-16 15:42:59.158: INFO/WifiService(2484): isShowingAccessPointListDialog():false
02-16 15:42:59.161: INFO/WifiService(2484): setShowAccessPointListDialog():false
02-16 15:42:59.204: INFO/wifiScan(4009): 5 5626 22
02-16 15:42:59.204: INFO/wpa_supplicant(3810): CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00
02-16 15:42:59.204: INFO/WifiMonitor(2484): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00]
02-16 15:42:59.208: VERBOSE/WifiStateTracker(2484): Changing supplicant state: INACTIVE ==> SCANNING
02-16 15:42:59.208: DEBUG/NetworkStateTracker(2484): setDetailed state, old =IDLE and new state=SCANNING
02-16 15:42:59.208: DEBUG/ConnectivityService(2484): Dropping ConnectivityChange for WIFI: DISCONNECTED/SCANNING
02-16 15:43:00.025: VERBOSE/AlarmManager(2484): set: Alarm{47dfb360 type 1 android}
I would guess that what you see is the difference between passive and active scan.
If you scan passively you have to stay at least 100ms on each channel (probably
closer to 200ms in practice) while with an active scan you can scan a lot quicker.
Presumably the 6s scan is passive while the 500ms scan is active.
With regulatory domain the device is not allowed to transmit unless it can figure
out which channels are allowed so it must scan passively until it gets the information
it needs. After that it should be able to switch to active scanning.
If you want active scan, you can call wifi.startScanActive().

Categories

Resources