I want ETag to get the newer version of cache made by retrofit in the android studio so ,I try different header but not getting the result

public static final String HEADER_CACHE_CONTROL = "Cache-Control";
public static final String HEADER_PRAGMA = "Pragma"; 
return response.newBuilder()
                    .header("Cache-Control:", "private, must-revalidate")//cacheControl.toString())

I created an app that collects data from users (location based on google). I need to use the data to create best routes that are of interest to the app developer not the user. Do I need 2 different apps? What is the general approach in this situation?

Basically I've done call recording but it's not working up to Oreo. I read an article in Wich google stop call recording in up to Oreo anyone have any idea how to record call in Android pie? Code comments will be appreciated. Thanks

there is a kind of failure on the OnActivityResult ( GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data); ).I managed to find out where the problem was

public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data);

    // Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
    if (requestCode == 101) {
        GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
        if (result.isSuccess()) {
            FirebaseUser user = mAuth.getCurrentUser();

            GoogleSignInAccount account = result.getSignInAccount();
        } else {

Very weird behavior. When I click a bottom navigation button and then click on a drawer button or vice versa, the previous button stays highlighted. Is there something am not doing right? My code is as follows;

public class MainActivity extends AppCompatActivity {

        private ActionBar actionBar;
        private Toolbar toolbar;
        private BottomNavigationView navigation;
        private String postUrl = "url";
        private WebView webView;
        public static ImageView share;

        protected void onCreate(Bundle savedInstanceState) {


            webView = (WebView) findViewById(R.id.webView);
            webView.setWebViewClient(new MyWebViewClient());
            //request Focus on down.
            //set OnTouchListener to your webView.
            webView.setOnTouchListener(new View.OnTouchListener() {
                public boolean onTouch(View v, MotionEvent event) {
                    switch (event.getAction()) {
                        case MotionEvent.ACTION_DOWN:
                        case MotionEvent.ACTION_UP:
                            if (!v.hasFocus()) {
                    return false;

            progress_bar = (ProgressBar) findViewById(R.id.progress_bar);
            share = (ImageView) findViewById(R.id.action_share);


        private void initToolbar() {
            toolbar = (Toolbar) findViewById(R.id.toolbar);
            actionBar = getSupportActionBar();
            actionBar.setTitle("App Name");
            // Tools.setSystemBarColor(this);

        private void initComponent() {
            navigation = (BottomNavigationView) findViewById(R.id.navigation);
            navigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
                public boolean onNavigationItemSelected(@NonNull MenuItem item) {
                    switch (item.getItemId()) {
                        case R.id.navigation_favorites:
                            return true;
                        case R.id.navigation_nearby:
                            return true;
                    return false;


        public boolean onCreateOptionsMenu(Menu menu) {
            getMenuInflater().inflate(R.menu.menu_search_setting, menu);
            return true;

       private void initNavigationMenu() {
            NavigationView nav_view = (NavigationView) findViewById(R.id.nav_view);
            final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
            ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close) {
                public void onDrawerOpened(View drawerView) {
            nav_view.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
                public boolean onNavigationItemSelected(final MenuItem item) {

                    switch (item.getItemId()) {
                        case R.id.nav_starred:
                        case R.id.nav_setting:

                    return true;

            // open drawer at start
            // drawer.openDrawer(GravityCompat.START);

        private class MyWebViewClient extends WebViewClient {

            public void onPageStarted(WebView view, String url, Bitmap favicon) {
                super.onPageStarted(view, url, favicon);

            public boolean shouldOverrideUrlLoading(WebView view, String url) {

                return true;



        // This method is used to detect back button
        public void onBackPressed() {
            if(webView.canGoBack()) {
            } else {
                // Let the system handle the back button



Any help is welcomed. I have searched for a solution but I am not getting anything useful.

Well, my "ClickListeners" for certain "TabItems" which I would like to handle do not work unfortunately.

TabItem TabItem1;

        View.OnClickListener Klick = new View.OnClickListener() {
        public void onClick(View v) {
            switch(v.getId()) {
                case R.id.guiTabItem1:
                    Toast.makeText(MainActivity.this,"Lol wtf asdsadfdfs", Toast.LENGTH_LONG);
                case R.id.guiTabItem2:
                    // test

The app loads but pushing on a tab has no effect. I also tried assigning the click event to the tabs with "setOnClickListener". This results in a crash.


Thanks in advance!

enter image description here

I need to make this type of views so I thought a TabLayout with fragments would help.

But the problem is, instead of having each menu item hardcoded, I need to make the tab titles programmatically as name may change or the amount of itemmenu also change.

I think an ArrayList of Strings can help storing each item menu title.

How can I have the titles set programmatically?

recently I started admiring the big touch screen in the new Tesla Model 3, and was thinking into building a similar thing for my car. I thought about using some kind of mini PC running Android and a big touch screen. With that figured out, now to the software side. I'd like to have a small part of the screen covered by information about my car, and the bigger part by Google Maps or Spotify or any other app. I'd also like it to be in a app form. Now here's my question: is it possible to make a part of the usable app space to be a different app? Something like multi-window, but for an app.

I am learning to implement firebase in an android studio. And I have studied various tutorials on this subject. So in order to minimize the chances of making mistakes, I decided to implement a simple token generated scripts in my mainactivity inside the onCreate() method; these codes below:

    .addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {

        public void onComplete(@NonNull Task<InstanceIdResult> task) {
            if (!task.isSuccessful()) {

                Log.w(TAG, "getInstanceId failed", task.getException());


            String token = task.getResult().getToken();


Then the app keeps crashing after generating its apk.

Then following codes were then implemented:

FirebaseInstanceId.getInstance().getInstanceId().addOnSuccessListener( MainActivity.this,  new OnSuccessListener<InstanceIdResult>() {
     public void onSuccess(InstanceIdResult instanceIdResult) {

           String newToken = instanceIdResult.getToken();


I am using latest dependency :

  • firebase messaging:17.6.0
  • firebase-core:16.0.8

The problem is each time I generated the APK , the app keeps crashing with error message "app has stopped". But when I built any other android app without firebase ,the app will work perfectly.

Is there any scaler function to add day ,month and year in sql server

In my android app I create a temporary table to make some joins on it.


Could you tell me for how long time it's available? It seems that if I restart app it's gone but without restart it seems to be in database but for how long time?

All I found in docs that it's created in temp database.

If the "TEMP" or "TEMPORARY" keyword occurs between the "CREATE" and "TABLE" then the new table is created in the temp database.

I'm trying to assign an enum value type to a structure property using a switch statement. I believe I have the syntax appropriately written (with a ":" after each case statement), however, I'm still getting an error on the "default:" statement. The error reads: "Expected ':' after 'case'" Does anyone know what's causing this?

I'm not sure what else to try.

struct Town {

enum Size {
    case small
    case medium
    case large
    case unknown

// structure properties
let region = "South"
var population: Int = 5_422
var numberOfStoplights: Int = 4
var name: String?
lazy var townSize: Size = {
    switch self.population {
    case 0...10000:
        return Size.small
    case 10001...100000:
        return Size.medium
    case let pop where pop >= 100001:
        return Size.large
    case default:    //***********ERROR: Expected ':' after 'case'
        return Size.unknown


Expected results: no error Actual results: error (even though the ":" exists)

I'm trying to have a way to change query url when user switches tabs to load their corresponding contents.

The app uses tabLayout with fragments to display articles, so every fragment has a different topic and I find it repetitive to have to repeat same code with differents query url

The articles are fetched from a JSON file from the url and I use a single method to parse the data then set them to views

the query and parsing method looks like: And what need to be changed on every fragment is the hardcoded value Constants.ALL_ARTICLES_URL

private void fetchData() {
        JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(Constants.ALL_ARTICLES_URL,
                new Response.Listener<JSONArray>() {
                    public void onResponse(JSONArray response) {
                        ArrayList<News> newsList = new ArrayList<>();
                        for(int i = 0; i < response.length(); i++){
                                JSONObject jsonObject = response.getJSONObject(i);
                                News article = new News();
                            }catch (JSONException e){
                }, new Response.ErrorListener() {
            public void onErrorResponse(VolleyError error) {
                Log.e("Volley", error.toString());
        RequestQueue requestQueue = Volley.newRequestQueue(this);


I realize there are lots of other pages that attempt to solve the challenge of getting user location using CLLocationManager() in ios swift but they don't work for me which is why I created this question. My code is below which I believe correctly implements the CLLocationManagerDelegate but the call to locationManager.startUpdatingLocation() never calls the locationManager function. This makes the Google Map simply open to a random position. I've simulated certain locations in the scheme and they work great like South Africa

example of Google Map with simulated location: https://i.ibb.co/8s71tH9/Screen-Shot-2019-04-20-at-3-32-18-PM.png

However, when I uncheck the simulation, the location is never found. Any advice or help would be appreciated. Not sure if this is a problem with my computer or code.

import UIKit
import GoogleMaps

class Map: UIViewController, CLLocationManagerDelegate  {

    var mapView: GMSMapView?
    let locationManager = CLLocationManager()

    override func viewDidLoad() {

        self.mapView = GMSMapView.map(withFrame: CGRect.zero, camera: GMSCameraPosition.camera(withLatitude: 40.7, longitude: -74.0, zoom: 4.0))
        view = mapView

        if (CLLocationManager.locationServicesEnabled()){
            locationManager.delegate = self
            locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters


    func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {

        let center = CLLocationCoordinate2D(latitude: locations.last!.coordinate.latitude, longitude: locations.last!.coordinate.longitude)

        let camera = GMSCameraPosition.camera(withLatitude: center.latitude, longitude: center.longitude, zoom: 4.0);
        self.mapView?.camera = camera
        self.mapView?.isMyLocationEnabled = true

        let marker = GMSMarker(position: center)

        print("Latitude :\(center.latitude)")
        print("Longitude :\(center.longitude)")

        marker.map = self.mapView
        marker.title = "Current Location"



I released my app in the app store. After I tested several times, it crashed. How do I get the corresponding crash report? I open the xcode and go the window-> organizer tab, but nothing shows up.enter image description here

App crashes on iPhone simulator with ffpyplayer error.

Kivy/Python program runs fine on Mac. Created an Xcode project with Kivy-ios toolchain. App runs fine on iPhone simulator, but when audio button is pushed, it crashes. Here is some simplified code which results in the same crash. The error Xcode gives after the app crashes on the iPhone simulator is shown at the top.

# File "ffpyplayer/player.pyx", line 203, in 
# ffpyplayer.player.MediaPlayer.__cinit__   TypeError: __cinit__()
# takes at least 2 positional arguments (1 given)

import os

os.environ['KIVY_AUDIO'] = 'ffpyplayer'
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.gridlayout import GridLayout
from ffpyplayer.player import MediaPlayer

import kivy, time

class MainScreen(GridLayout):
    def __init__(self, **kwargs):
        super(MainScreen, self).__init__(**kwargs)
        self.cols = 2
        self.row = 1
        self.hello = Button(text="play the audio")

    def playit(self, *args):
        audiofiletoload = "hours.ogg"
        self.newplayer = MediaPlayer(audiofiletoload)
        self.newplayer.seek(30, relative=False, accurate=False)

class MyApp(App):
    def build(self):
        return MainScreen()

if __name__ == '__main__':

I have this interface design: enter image description here

I need to implement it in iOS and I have no idea how to start. I created a story board in Main Storyboard: enter image description here

Now i need to make it iteractive. What are the first steps? Do I group the icons together for left and right characters? Do i group the choices? How can i make the first choices (blue interface) remembered for the next "yellow interface"? How can i implement drag and drop? I need it to be in that way so when i drag "milk", it will be seen in the icon.

In my v1 core data model, I had:

    relation: Image (to-one)
    relation: Discussion (to-one)

In v2 model, I now have:

FileObject (abstract)

FileMediaObject: parent FileObject (abstract)
    relation: DiscussionFileObject (to-one)

DiscussionFileObject: parent FileObject
    relation: FileMediaObject (to-one)

ImageMediaObject: parent FileMediaObject

The DiscussionFileObject and ImageMediaObject (concrete) entities replace the prior Discussion and Image entities one-to-one. I am using the method described in How to refactor a core data model to make two existing entities inherit from a new abstract entity to migrate from the v1 model to the v2 using a mapping model. There are non-relation attributes as well (describe below), and those appear to be migrating just fine.

The problem I'm running into is with migrating the relations. For example, all of the ImageMediaObject's inherited relations (DiscussionFileObject's) end up being nil-- not being migrated properly from the v1 model.

Here are the details of the mapping model: enter image description here

The Value Expression for the relation mapping is:

FUNCTION($manager, "destinationInstancesForSourceRelationshipNamed:sourceInstances:" , "image", $source.image)

enter image description here

The Value Expression for the relation mapping is:

FUNCTION($manager, "destinationInstancesForEntityMappingNamed:sourceInstances:" , "ImageToImageMediaObject", $source.discussion)

Suggestions are welcomed.

I am trying to make a regex string for date like this. My code (Swift 5 example):

let dateValidator = TextValidator(input: dateTextField.rx.text.asObservable(), regex: try! NSRegularExpression(pattern:

let v = Observable.combineLatest(dateValidator.validate(), anotherValidator.validate()) {
    (date, another) in
    return date && another
//another code

class TextValidator {
    var input: Observable<String?>
    var regex: NSRegularExpression

    init(input: Observable<String?>, regex: NSRegularExpression) {
        self.input = input
        self.regex = regex

    func validate() -> Observable<Bool> {
        return input.map { text in
            let range = NSRange(location: 0, length: text!.utf8.count)
            return self.regex.firstMatch(in: text!, options: [], range: range) != nil

And I get error:

Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSRegularExpression enumerateMatchesInString:options:range:usingBlock:]: Range or index out of bounds'

Another regex works correctly. I think that error for backslash in regex.

I have done light coding in C++ and Matlab. I'm looking to build a non-static mobile app that supports both iOS and android (so i'm hoping for something that is cross-platform) and a program for the admin device (computer). The connection between them will not be through the internet but via LAN. The function of the program is simple, a multiple choice quiz. The user opens the app on their phone and taps the "quiz" button. The admin computer receives the signal to send a question and then does so. The user answers the multiple choice question and sends the result back to the admin device. All of the users complete the quiz (a finite number of questions) and then the quiz can not be accessed again by the same device. The admin computer will need to collect all of the scores from each device (approximately 1000 devices). Additionally, the user devices must be identifiable, so that when a phone is brought to the administrator, you can match the phone to the data sent from it.

Which programming language should I start studying in order to learn how to create this? How would you suggest I go about learning it? Does someone have access to some code that is similar that I should modify instead of trying to build it all from scratch? Thanks in advance!

I'm looking on how to make audio bars visualizer in my iOS app, considering I want to play music through Apple music (MusicKit).

With this question I've got that the main way to do that is by using Audio Queue services and FFT. But the problem is that I can't figure out how to use it with MusicKit.

Based on apple's forum topic it's not possible to get audio data from MusicKit. I'm newbie in iOS Core Audio, but maybe there's a way to get realtime data of all device's outbound sounds and analyze it? I'm also considering other streaming services (spotify, google music), in case there's no way to realize that with MusicKit.