I have subclassed UITabBarController to allow for some customization specific to my app. It is the root view controller of my UIWindow and displays itself correctly on launch, and even shows the correct tab's view hierarchy as well.

The problem is with the selected tabbar item's tint color. Inside viewDidLoad of the custom tab bar controller subclass, I have set both the unselected and selected tint colors for the tab bar. See below:

override func viewDidLoad() {
    super.viewDidLoad()

    tabBar.tintColor = .tabBarItemActiveTint
    tabBar.unselectedItemTintColor = .tabBarItemInactiveTint
    tabBar.barTintColor = .tabBarBg

    let dashboardVC = DashboardViewController.build()
    let settingsVC = SettingsTableViewController.build()
    let settingsNavC = UINavigationController(rootViewController: settingsVC)
    settingsNavC.navigationBar.barStyle = .black

    viewControllers = [dashboardVC, settingsNavC]
    selectedViewController = dashboardVC

    // Accessing the view property of each tab's root view controller forces
    // the system to run "viewDidLoad" which will configure the tab icon and
    // title in the tab bar.
    let _ = dashboardVC.view
    let _ = settingsVC.view
}

As you can see, the controller has its child view hierarchies set, and the views are loaded at the bottom so their respective viewDidLoad methods run where I have code that sets the tabBarItem. Here's an example from the dashboard view controller:

tabBarItem = UITabBarItem(title: "Dashboard", image: UIImage(named: Theme.dashboardTabBarIcon), tag: 0)

Everything about this works except for the selected icon and title. When the app launches I can see the tab bar, the first view hierarchy (the dashboard) is visible onscreen and the tabs all function properly. But the dashboard's icon and title are in an unselected state. I have to actually tap the tab bar icon to get the state to change such that it is selected.

Once you tap one of the tabs, the selected state works as normal. The issue is only on the first presentation of the tab bar.

Here is an image showing the initial state of the tab bar on launch. Notice the dashboard icon is not selected, even though it is the presented view controller.

broken tab bar icon, nothing selected

I Have Eight Searching parameter which(Optional parameters) is passed by front end using angular 6 to web API. This query is written in web API and wants to get the result based on any searching parameter passed. But Query returns null some time and some time it provides result but executes only one where condition

var CallDetails = (from tblTrans in masObjEntities.tbl_MetaData_Trn where (CallStTime != null || CallETime != null || PhnDialed != "" || AgntLivVoxId != "" || AcntNo != "" || recFileName != "" ) && (tblTrans.Call_Start_Time >= CallStTime || CallStTime == null) && (tblTrans.Call_End_Time <= CallETime || CallETime == null) && (tblTrans.Phone_Dialed == PhnDialed || PhnDialed == "") && (tblTrans.Client_Id == AgntLivVoxId || AgntLivVoxId == "") && (tblTrans.Account == AcntNo || AcntNo == "") && (tblTrans.Rec_File_Name == recFileName || recFileName == "") && ((selectedCars1Length > 0 && callRecording1.selectedCars1.Contains(tblTrans.Call_Center.ToString())) || (selectedAgentsLength > 0 && callRecording1.selectedAgents.Contains(tblTrans.Agent_Result.ToString()))) orderby tblTrans.ID ascending select new {
tblTrans.Account, tblTrans.Agent_Name, tblTrans.Agent_Result, tblTrans.Call_Center, tblTrans.Call_Start_Time, tblTrans.CSV_MetaDataFileName, tblTrans.Duration_Secs, tblTrans.Phone_Dialed, tblTrans.Rec_File_Name }).ToList();

I am using a python script for GNU radio which is using PyQt4. My gnuradio is having PyQt5. Since setGraphicsSystem is no longer there in PyQts, what can be the substitute for Qt.QApplication.setGraphicsSystem in PyQt5.

I'm a goal-oriented person.

And so one of my current goals is to become an elite-tiered software engineer; to the extent where I can build, or at least prototype, any piece of software that I have an idea for.

Thus I have divided this goal into sub-goals by putting together a curriculum for myself; consisting of probably around a years-worth of must-read software engineering books, language reference manuals, projects to apply new skills, maths, etc.

And the more I ponder over it, the more I find myself feeling somewhat overwhelmed; sometimes thinking too far in advance instead of remaining in the present (for example: focusing more on the chapters I will be reading/completing over the weekend whilst reading the chapters I'm trying to read/complete).

So should I continue along this path? Or should I just build stuff, and only research what I need for the projects (I've heard of this method once before, that is why I mention it).

Or is there another method I'm unaware of?

But don't get me wrong, I'm learning a ton from this method, and I'm not too worried about burning-out; I know how to ration my studying.

Maybe a better question is, what is the fundamental base-knowledge that a software engineer needs to know in order to build anything that he/she wants to?

I have deployed a Tornado application that exposes rest API's, This application dose lot of CPU bound tasks (Query ML models), the API call take 2-3 seconds to respond due to which TPS is low. I cannot spin up multiple processes of tornado since the application is 5-8GB. Which is a good server in python to do concurrent request, since the tornado is good for I/O bound tasks?

I need to come-up with a software engineering plan for migrating a legacy application to ReactJS.

My dilemma here is to what factors should I consider and include in the plan and what to exclude.

Basically what would constitute a good plan for this kind of migration project.

Any insights / examples would be highly appreciated. Thanks in advance.

My goal is to calculate our enterprise product team velocity in order to find process in-efficiencies and understand what could be fixed. I came across a report published by circleci that states stability, deploy time and deploy frequency to be the metrics that would help to determine engineering teams . I have a few questions when I tried to calculate the metrics for us. They are detailed as below

  1. Stability - For our application we have around 5-10 CI builds during the day. The build takes around 1 hour to execute as it runs around 25k junits and integration tests. Once this build is green further tests including a smoke test, multiple regression and performance tests are executed.

    a. Do we consider mainline to be stable only if all tests (smoke, regression, performance and client simulation tests) pass or after a CI build (that runs junits and integration tests) is green?

    b. Is stability the time spend in fixing red builds? If so, do we calculate a percentage of this time vs 24 hours? How do we include the number of builds in the calculation?

  2. Deploy time - We have a release process before which the builds are certified for production deployment. There are a few manual steps performed after all tests are green. Do we include this time in addition to the downtime taken for client upgrades?

  3. Deploy frequency - We deploy once every month for each of our customers. This frequency is part of the client agreement and not determined based on any engineering metrics. If we were to figure out the deploy frequency based on engineering teams performance, how should we be calculating it?

Thanks!

I am just trying to send an int value from my Android app to my C# server, however I am messing something up since the values received on the server are impossible to convert to int due to encoding issues.

Android app is sending the int value (n):

OutputStream oos = new ObjectOutputStream(socket.getOutputStream());
int n = 1;
oos.write((""+n).getBytes());
oos.flush();

My TCP C# Server is reading:

byte[] message = new byte[4096];
int bytesRead=0;
bytesRead = clientStream.Read(message, 0, message.Length);
string dataReceived = System.Text.Encoding.ASCII.GetString(message);

dataReceived is "??\0\u0005w\u00011\0\0.......0\0"

cordova plugin add cordova-plugin-speechrecognition

Installed Version : cordova-plugin-speechrecognition@1.2.0

I'm getting this error while running this code Error: exec proxy not found for :: SpeechRecognition :: isRecognitionAvailable

<button mat-mini-fab  onclick="startRecordingSpeech()"><mat-icon>done</mat-icon></button>


function startRecordingSpeech(){
    console.log(windows);
    window.plugins.speechRecognition.isRecognitionAvailable(successCallback,errorCallback)
}

function successCallback(CallBack){
    console.log(CallBack);
}
function errorCallback(CallBack){
    console.log(CallBack);
} 

While using the latest mupdf-source-1.14 version, there is no MuPDFCore or PDFViewer for displaying pdf files in android.As per the new source code,i can see compile the library and see the pdf page count etc.But i coudnt see any view for displaying pdf.

Does anybody have integrated the latest mupdf library? Sample code:

         @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    LinearLayout linear = findViewById(R.id.linearMain);
    try {
        String[] filelistInSubfolder = getAssets().list("");
        System.out.println("Asset path "+filelistInSubfolder[0]);
        File file = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);

        for (int i=0;i<file.list().length;i++){
            System.out.println("jjjj "+file.list()[i]);
        }
        String path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).toString()+"/sample (1).pdf";
        Log.e("PATH",path);
       // Context.init();
        //Document doc1= Document.openDocument(path);

        //doc.loadPage(1);
        //PDFDocument pp = new PDFDocument();
       // pp.path=path;
        //pp.loadPage(1);
        //PDFDocument.openNativeWithPath(path);

        Document doc = PDFDocument.openNativeWithPath(path);
        Page page = doc.loadPage(7);
        System.out.println("pagessss--->"+doc.countPages());
        System.out.println("pagessss--->"+doc.isPDF());
        }}

Thanks in advance.

How to pass an intent with parameters? Neither array nor bundles are working.

Intent intent = new Intent(Apply_leave_Activity.this, ApplyingReason_Activity.class);
intent.putExtra("ID_EXTRA", new String[] { "21",countOfCL,countOfSL ,countOfEL,startDatey,endDatey,currentDatey});
startActivity(intent);

Receiving code

 String x[]=new String[10];
 x  =getIntent().getStringArrayExtra("ID_EXTRA");

Using bundles

Bundle extras = new Bundle();
  extras.putString("EID", "21");
  extras.putString("countOfCL", countOfCL);
  extras.putString("countOfSL", countOfSL);
  extras.putString("countOfEL", countOfEL);
  extras.putString("From_date", startDatey);
  extras.putString("To_date", endDatey);
  extras.putString("applied_date", currentDatey);
 intent.putExtras(extras);
 startActivity(intent);

Receiving side

Intent intent = getIntent();
Bundle extras = intent.getExtras();
      final   String EID = extras.getString("EID");
      final String numberOfCasualLeaves = extras.getString("countOfCL");
      final   String numberOfsickLeaves = extras.getString("countOfSL");
      final String numberOfearnedLeaves = extras.getString("countOfEL");
      final String from_date = extras.getString("From_date");
      final String to_Date = extras.getString("To_date");
      final String applied_date = extras.getString("applied_date");

Can someone show me your modified code in android studio on how to show the user's location. Somehow my built app crashes everytime i debug it on my phone, i follow all the guides, tutorials and documentations about mapbos sdk Im using Android Studio (Marshmallow 6.0) Mapbos sdk version 7.1.2 Location Layer plugin 0.11.0

This code is taken from pretty complex codebase. Hopefully I extracted relevant parts without missing information. Imagine a fragment/activity displaying your inbox, which contains lot of chats.

The code is roughly like this:

fun initData() {
        listChats = ArrayList()
        listChats.add(....))

        chatAdapter!!.updateListChat(listChats)

        getDiscussionList()
}

getDiscussionList(){
    pbChat.visibility = View.VISIBLE
    lvChat.visibility = View.GONE

    listChats.clear();

    // do HTTP GET to populate listChats
    // blah blah blah

    pbChat.visibility = View.GONE
    lvChas.visibility = View.VISIBLE
}

Other than displaying/hiding ProgressBar and ListView, most of the work in getDiscussionList() is parsing JSON from HTTP GET and populating listChat properly. This works fine. Now what's missing is auto-refresh feature.

I added a minor modification, now the code looks like this:

fun initData() {
        listChats = ArrayList()
        listChats.add(....))

        chatAdapter!!.updateListChat(listChats)

        getDiscussionList()

        activity.runOnUiThread {

            Timer().schedule(5000){
                getDiscussionList()
            }
        }
 }

I run this code and eventually will get "Only the original thread that created a view hierarchy can touch its views.". How to properly execute getDiscussionList() every X seconds, then?

I have the following functions that retrive the current position of the device. My problem is that I am unable to run this Service the background(I tried using Service intent but to no avail).

private LocationRequest mLocationRequest;

private long UPDATE_INTERVAL = 10 * 1000;  /* 10 secs */
private long FASTEST_INTERVAL = 2000; /* 2 sec */

 protected void startLocationUpdates() {

    // Create the location request to start receiving updates
    mLocationRequest = new LocationRequest();
    mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
    mLocationRequest.setInterval(UPDATE_INTERVAL);
    mLocationRequest.setFastestInterval(FASTEST_INTERVAL);

    // Create LocationSettingsRequest object using location request
    LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder();
    builder.addLocationRequest(mLocationRequest);
    LocationSettingsRequest locationSettingsRequest = builder.build();

    // Check whether location settings are satisfied
    // https://developers.google.com/android/reference/com/google/android/gms/location/SettingsClient
    SettingsClient settingsClient = LocationServices.getSettingsClient(this);
    settingsClient.checkLocationSettings(locationSettingsRequest);
    if(ActivityCompat.checkSelfPermission(this,Manifest.permission.ACCESS_FINE_LOCATION)!=PackageManager.PERMISSION_GRANTED &&
            ActivityCompat.checkSelfPermission(this,Manifest.permission.ACCESS_COARSE_LOCATION)!=PackageManager.PERMISSION_GRANTED){


        ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.ACCESS_FINE_LOCATION},1);
    }else{
        //  locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,0,0,locationListener);

    }
    // new Google API SDK v11 uses getFusedLocationProviderClient(this)
    getFusedLocationProviderClient(this).requestLocationUpdates(mLocationRequest, new LocationCallback() {
                @Override
                public void onLocationResult(LocationResult locationResult) {
                    // do work here
                    Log.d("test",locationResult.getLastLocation().toString());
                    onLocationChanged(locationResult.getLastLocation());
                }
            },
            Looper.myLooper());
}


public void onLocationChanged(Location location) {
    // New location has now been determined
    String msg = "Updated Location: " +
            Double.toString(location.getLatitude()) + "," +
            Double.toString(location.getLongitude());
    Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
    // You can now create a LatLng Object for use with maps
}


public void getLastLocation() {
    // Get last known recent location using new Google Play Services SDK (v11+)
    FusedLocationProviderClient locationClient = getFusedLocationProviderClient(this);
    if(ActivityCompat.checkSelfPermission(this,Manifest.permission.ACCESS_FINE_LOCATION)!=PackageManager.PERMISSION_GRANTED &&
            ActivityCompat.checkSelfPermission(this,Manifest.permission.ACCESS_COARSE_LOCATION)!=PackageManager.PERMISSION_GRANTED){


        ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.ACCESS_FINE_LOCATION},1);
    }else{
        //  locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,0,0,locationListener);

    }
    locationClient.getLastLocation()
            .addOnSuccessListener(new OnSuccessListener<Location>() {
                @Override
                public void onSuccess(Location location) {
                    // GPS location can be null if GPS is switched off
                    if (location != null) {
                        onLocationChanged(location);
                    }
                }
            })


            .addOnFailureListener(new OnFailureListener() {
                @Override
                public void onFailure(@NonNull Exception e) {
                    Log.d("MapDemoActivity", "Error trying to get last GPS location");
                    e.printStackTrace();
                }
            });
}

at the moment I start the location update Service trough the startLocationUpdates(); function. I am open to any suggestions as long as they retain the current functionality of the Service. Sorry if the question seems stupid but I am very new to android.

Within my current Android application I have a screen that displays a android.support.v4.app.DialogFragment.

This DialogFragment view contains the following UI components

HEADING
== Sub Heading
== NestedScrollView
==== RecyclerView
==== RadioGroup
==== Spinner
==== EditText
==== Action Buttons

The DialogFragment is configured to be Full Screen using Style as follows:-

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setStyle(DialogFragment.STYLE_NO_TITLE, R.style.AppDialogTheme);
}

My dialog style is

<!-- Define your custom dialog theme here extending from base -->
<style name="AppDialogTheme" parent="Theme.AppCompat.Light.Dialog">
    <!-- Define color properties as desired -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">#000</item>
    <item name="android:textColorHighlight">@color/background_url</item>
    <item name="colorAccent">@color/dark_grey</item>
    <item name="colorControlNormal">@color/colorPrimaryDark</item>
    <!-- Define window properties as desired -->
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowBackground">@android:color/white</item>
    <item name="android:windowIsFloating">true</item>
    <item name="android:windowCloseOnTouchOutside">false</item>
</style>

The reason I employ a nestedScrollView is so that the View will work in both Portrait and Landscape.

I wish to limit the height of the RecyclerView

The closest I have got is using the layout below.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="wrap_content"
    android:orientation="vertical">

    <TextView
        android:id="@+id/headline_literal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:gravity="center"
        android:padding="10dp"
        android:text="Heading"
        android:textSize="20sp"
        android:textStyle="bold" />

    <View
        android:id="@+id/divider"
        android:layout_width="fill_parent"
        android:layout_height="2dp"
        android:layout_marginTop="5dp"
        android:background="#c0c0c0" />

    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        tools:context=".MainActivity">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:weightSum="5"
            android:orientation="vertical">

            <TextView
                android:id="@+id/sub_headline_literal"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:padding="10dp"
                android:text="dfghdfgh dfghd fgh dfgh dfgh dfgh dfgh dfgh dfgh dfgh dfgh dfgh dfghd fghd fdfgh dfgh dfgh dfgh dfgh dfgb xfb dfgh dfg dfgb dfgb dfghdf dfh fgh fhsfh hs ghsdrh "
                android:textSize="16sp"
                android:textStyle="normal" />

            <android.support.v7.widget.RecyclerView
                android:id="@+id/dummy_rv"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_margin="10dp"
                android:layout_marginStart="9dp"
                android:layout_marginEnd="9dp"
                android:layout_weight="1"
                android:background="@drawable/rv_border"
                android:fadingEdge="horizontal"
                android:fadingEdgeLength="10dp"
                android:padding="10dp"
                android:requiresFadingEdge="vertical" />

            <RadioGroup
                android:id="@+id/myRadioGroup"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginTop="10dp"
                android:checkedButton="@+id/sound">

                <RadioButton
                    android:id="@+id/sound"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Sound" />

                <RadioButton
                    android:id="@+id/vibration"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Vibration" />

                <RadioButton
                    android:id="@+id/silent"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Silent" />

            </RadioGroup>

            <EditText
                android:id="@+id/notes"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="Notes" />

            <LinearLayout
                android:id="@+id/buttons"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:padding="10dp">

                <TextView
                    android:id="@+id/cancel_button"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:text="Cancel" />

                <TextView
                    android:id="@+id/submit_button"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:text="Submit" />

            </LinearLayout>

        </LinearLayout>

    </android.support.v4.widget.NestedScrollView>

</LinearLayout>

By using weightSum on the inner LinearLayout of the NestedScrollView I can limit the height of the Recyclerview however the NestedScrollView Height is far to large, with more than half its height being blank.

How can I limit the height of my RecyclerView and get NestedScrollView to Wrap Content?

I've tried NestedScrollView with height wrap_content but this has no effect.

How can I achieve the desired UI?

I've been searching for my issue but I didn't find any results. On the beginning of my new projects, an error pops up and says 'could not find shared.jar' and the layouts doesn't work. can you help me on this??

I implemented AlertDialog in my class which extend Application class, also added proper permission in manifest file

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />

See my code:

private void showAlertDialog(Context context) {
        DialogInterface.OnClickListener listener
                = new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                // do some stuff eg: context.onCreate(super)
            }
        };


        AlertDialog.Builder builder = new AlertDialog.Builder(context)
                .setCancelable(false)
                .setMessage("Messag...")
                .setTitle("Title")
                .setPositiveButton("OK", listener);

        Dialog dialog = builder.create();
        dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
        dialog.show();

    }

Call Method:

 showAlertDialog(getApplicationContext());

BTW, it was working yesterday, I don't know why it is not working today, what am I missing?

I have been using recyclerview to display my contacts and show their basic data including user images. It works as it should, Picasso is great and I get a very cool looking list.

Right now I am trying to disable users to view images until validated - ie I want to disable viewing images to anyone who is not an authenticated user. I have done this on my services and disabled anyone except my laravel app to open the image link. Now I face one issue - when I return image it is not a link, but it is in a byte[] format, and I cannot display it using Picasso. I could try and convert it to Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length); and then convert bitmap to drawable like: Drawable drawable = new BitmapDrawable(getResources(), bitmap);, and then display drawable as image imageView.setImageDrawable(drawable); but reading into this I found quite a few drawbacks.

My question would be what is the best way to display image using picasso or glide, and retrofit to return images for authenticated users only. Is there a different way I can return image from laravel service? Is there a way to use the byte format with either picasso or glide? Or is there another format I can convert my byte[] to display in the recyclerview, that would not negatively influence performance?

Currently displaying image with Picasso in my ContactsAdapter:

@Override
public void onBindViewHolder(ContactsAdapter.ContactsViewHolder holder, int position) {
    Contact contact = contactList.get(position);

    holder.userName.setText(contact.getUserName());

    TextDrawable.IBuilder builder = TextDrawable.builder()
            .beginConfig()
            .withBorder(0)
            .toUpperCase()
            .endConfig()
            .round();

    ColorGenerator generator = ColorGenerator.MATERIAL;
    int color = generator.getColor(contact.getUserId());
    textDrawable = builder.build(contactList.get(position).getUserName().substring(0, 1), color);
    holder.thumbNail.setImageDrawable(textDrawable);

    Picasso.with(context)
            .load(AppConfig.URL_PROFILE_PHOTO + contact.getThumbnailUrl()) // DISK URL WITH USER IMAGE NAME
            .placeholder(textDrawable)
            .error(textDrawable)
            .transform(new CircleTransform())
            .into(holder.thumbNail);
}

Laravel service converts link to image like this:

return Image::make($storagePath)->response();

I extracted the ProfileImage method and tried to modify it to use the service I got:

private void ProfileImage(HashMap<String, String> user, String name, String id) {
    TokenManager tokenManager = TokenManager.getInstance(getSharedPreferences("prefs", MODE_PRIVATE));
    ApiInterface apiService = ApiClient.createServiceWithAuth(ApiInterface.class, tokenManager);

    ColorGenerator generator = ColorGenerator.MATERIAL;
    int color = generator.getColor(id);
    String firstLetter = name.substring(0, 1);
    TextDrawable textDrawable = TextDrawable.builder().buildRect(firstLetter, color);
    holder.thumbNail.setImageDrawable(textDrawable);

    Call<ResponseBody> call = apiService.getUserImage(id);
    call.enqueue(new Callback<ResponseBody>() {
        @Override
        public void onResponse(Call<ResponseBody> call, retrofit2.Response<ResponseBody> response) {

            if (response.isSuccessful()) {
                byte[] bytes = new byte[0];
                try {
                    bytes = response.body().bytes();

                    Picasso.with(getApplicationContext())
                            .load(/** I CANNOT USE THE URL HERE */)
                            .placeholder(textDrawable)
                            .error(textDrawable)
                            .centerCrop()
                            .fit()
                            .into(holder.thumbNail);
                } catch (IOException e) {
                    e.printStackTrace();
                }
            } else {
                if (response.code() == 401) {
                    finish();
                } else {
                    Log.d(TAG, "There was an error: " + response);
                }
            }
        }

        @Override
        public void onFailure(Call<ResponseBody> call, Throwable t) {
            Log.e(TAG, t.toString());
        }
    });
}

I have a structure in firebase like:

 community
 |--<communityID>
    |--cities
    |   |--<locationID>:boolean
    |   |--<locationID>:boolean
    |   |--<locationID>:boolean
    |--name
    |--users
    |-- ...
  |--<communityID>
    |--cities
    |   |--<locationID>:boolean
    |   |--<locationID>:boolean
    |   |--<locationID>:boolean
    |--name
    |--users
    |-- ...

With other many fields.

I need to get only the communities where in the cities list they have, match with a specific locationID.

In other query I used something like this:

firebaseDatabase.child("users").orderByChild("location").equalsTo(<cityID>)

That works perfect when the child location is not an "array".

So there is any way to do it?

Or I just need to bring all the communities, and then filter in the device?

Hi I have a runnig code (wroks on Samsung Tab3 4.2.2) that iterate over Music dir, list all mp3 files in there and put it in a listView:

listView = findViewById(R.id.listView);
        String path = Environment.getExternalStorageDirectory().toString() + "/Music/" + tmp;
        ArrayAdapter <String> streetListAdapter = new ArrayAdapter(StreetSounds.this,android.R.layout.simple_list_item_1 , mp3);
        File [] files = new File(path).listFiles();
        for (File name : files) {
            mp3.add(name.getName());
        }
        Log.e("Array:  ", String.valueOf(mp3));
        listView.setAdapter(streetListAdapter);
        final int i = temp;
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

            public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {

                String ListviewCellValueContent = (String) listView.getItemAtPosition(position);
                Intent intent = new Intent(StreetSounds.this , MPlayer.class);
                intent.putExtra("ListviewCellValueContent", ListviewCellValueContent);
                switch (i) {
                    case 1:
                        intent.putExtra("value", 1);
                        break;
                    case 2:
                        intent.putExtra("value", 2);
                        break;
                    case 3:
                        intent.putExtra("value", 3);
                        break;
                    case 4:
                        intent.putExtra("value", 4);
                        break;
                    case 5:
                        intent.putExtra("value", 5);
                        break;
                    case 6:
                        intent.putExtra("value", 6);
                        break;
                    case 7:
                        intent.putExtra("value", 7);
                        break;
                }
                startActivity(intent);
            }
        });
    }

When I run teh same code on Samsung tabA(5.1.1) i get this exception:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.knight.thevoice/com.example.knight.thevoice.StreetSounds}: java.lang.NullPointerException: Attempt to get length of null array at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3151) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3261) at android.app.ActivityThread.access$1000(ActivityThread.java:219) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1735) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:6939) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199) Caused by: java.lang.NullPointerException: Attempt to get length of null array at com.example.knight.thevoice.StreetSounds.onCreate(StreetSounds.java:82)

line 82 is the loop:

 for (File name : files) {
            mp3.add(name.getName());
        }

and there are mp3 files in Music/Home dir... I didnt manage to debug it.... any suggestions please

i've been searching for this disintegration effect for a few weeks now. https://www.youtube.com/watch?v=5dsZuHxPUUI

Can give someone a source code or link to create this effect in swift. Maybe for spritekit. I was on the homepage of Matt Reagan, but I did not find any code.

I am a beginner, so please explain easily.

Please help me. Many Thanks.