I am experiencing an IPv6 problems with tvOS app. Apple was rejected my app for performing issue on IPv6 network. I am not understanding why apple reject my app for IPv6 reason. I had submitted my application on August 2106 and apple approved my application. I had not made any changes for any APIs. I have made only UI related changes in this version. I am using blow code for checking internet connection is active or not in last version and current version.

class func isConnectedToNetwork() ->Bool {


    var zeroAddress = sockaddr_in()
    zeroAddress.sin_len = UInt8(sizeofValue(zeroAddress))
    zeroAddress.sin_family = sa_family_t(AF_INET)

    let defaultRouteReachability = withUnsafePointer(&zeroAddress) {
        SCNetworkReachabilityCreateWithAddress(nil, UnsafePointer($0))
    }
    var flags = SCNetworkReachabilityFlags.ConnectionAutomatic
    if SCNetworkReachabilityGetFlags(defaultRouteReachability!, &flags) == false {
        return false
    }
    let isReachable = (flags.rawValue & UInt32(kSCNetworkFlagsReachable)) != 0
    let needsConnection = (flags.rawValue & UInt32(kSCNetworkFlagsConnectionRequired)) != 0
    return (isReachable && !needsConnection)
}

I have tested my app on local IPv6 network as Apple suggested and it is working fine.

I have done lots of R&D for this issue but not understand to solve this problem. Please suggest it.

Thanks.

I know that it is not possible to add a static UITableView inside an UIViewController (or at least I could not find any way to do it). Trying to do a workaround (as pointed here), I am following these steps:

  • I have created an UIViewController on my Main.storyboard.
  • I have drag an UIContainerView inside my UIViewController.
  • I have deleted the UIViewController embedded by default on my UIContainerView.
  • I have created an UITableViewController and drag it to the UIContainerView.
  • I have added a label with the text "Hello" into my UITableViewCell.

Here is the structure of this part on my Main.storyboard:

enter image description here

And here is the result that I am getting:

enter image description here

I can only get an empty UITableView without any information inside of it.

Am I missing something? Am I doing it in the wrong way?

P.S: I am using Xcode8 and Swift3.

Thanks in advance!

I am trying to record audio using AVAudioEngine. The file gets recorded and plays correctly. However, I also need to send AVAudioPCMBuffer that I receive in the tap handler to my server via socket. I am converting AVAudioPCMBuffer to NSData and sending it. The server is receiving it - however the file doesn't play correctly on the server. Am I missing something while converting AVAudioPCMBuffer to NSData or is my recording missing some configuration.

Any help would be appreciated guys. Thanks!

let audioEngine  = AVAudioEngine()
let inputNode = audioEngine.inputNode
let bus = 0

 try file = AVAudioFile(forWriting: URLFor("recording.wav")!, settings: audioEngine.inputNode!.inputFormatForBus(0).settings)


inputNode!.installTapOnBus(bus, bufferSize: 4096, format: inputNode!.inputFormatForBus(bus)) {
                (buffer: AVAudioPCMBuffer!, time: AVAudioTime!) -> Void in


  self.file?.writeFromBuffer(buffer)  
  self.socketio.send(self.toNSData(buffer))

}

 do{
    audioEngine.prepare()
    try audioEngine.start()
}
catch{
    print("catch")
}



func toNSData(PCMBuffer: AVAudioPCMBuffer) -> NSData {
    let channelCount = 1  // given PCMBuffer channel count is 1
    let channels = UnsafeBufferPointer(start: PCMBuffer.floatChannelData, count: channelCount)
    let ch0Data = NSData(bytes: channels[0], length:Int(PCMBuffer.frameCapacity * PCMBuffer.format.streamDescription.memory.mBytesPerFrame))
    return ch0Data
}

After a long 2 hours investigation into why my json from Galaxy S4 and devices Android API less then 23 was being accepted by .Net webpi and not from Nexus 5 (Android 6.0+ Marshmallow), I have found that the cause was in Java->Json serialization which produced objects with $ref and $id putting first as members, which was not deserialized on WebApi.

This json is accepted by server:

[
  {
    "Id":8043,
    "$ref":0
  }
]

and this Json is received as nothing but an empty array on server

[
  {
    "$ref":0
    "Id":8043,
  }
]

I am using Retrofit with Gson to create the JSON and then send it to server using

interface:

@POST("EmployeeJobs/AddEmpJobs")
    Call<List<EmployeeJob>> addUpdateEmpJobs(@Body List<EmployeeJob> empJobs);

serialization:

 JsonElement element = MyGsonBuilder.getPostGson().toJsonTree(empJobsList, new TypeToken<List<EmployeeJob>>() {
            }.getType());

 JsonArray jsonArray = new JsonArray();
            if (element.isJsonArray()) {
                jsonArray = element.getAsJsonArray();

I have also checked this behavior with Postman so Retrofit or Gson has no problem.

I don't know what could be the reason, on web api side. I solved it by skipping '$ref'when serializing, I received them to use in deserialization to handle circular references.

Server side method for accepting these request:

 [Route("addEmpJobs")]
  public List<EmployeeJob> AddEmpJobs(List<Delta<EmployeeJob>> empJobs)
  {
   //-----save with ids <= 0 and patch with ids >0
  }

I want to be able to randomly generate values behind an ImageView. I want the value to be revealed if the correct value is behind the touched ImageView I made a youtube video to better explain what I'm trying to say. If you can help that would be great. https://www.youtube.com/watch?v=6m8jBEFNFVo

As title, this problem occurs on devices with a navigationbar.

normal image
Abnormal image

Pictured above, this is a splash page, when the page is loaded, through windowBackground specified forms the background of this picture for the splash page when the page displays through the setContentView () method to specify a layout, a ImageView components in the layout, used for loading and above the same GIF figure, so that to achieve the effect of startup splash the animation.Show this is normal, "dl" away from the screen the following distance is 400, but on some equipment, background image distance did not change, but it turned out to be 400 + navigationbar ImageView distance height, make the GIF image and background image is no coincidence, then found set SYSTEM_UI_FLAG_LAYOUT_STABLE flag can solve part of the devices do not overlap, such as nexus5. But some devices or there will be not overlap, such as HTC htc_a3tl.

//splash_layout.xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/splash">

    <ImageView
        android:id="@+id/iv_splash"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:scaleType="fitCenter" />

</FrameLayout>

//SplashActivity.java ....

protected void onCreate(Bundle savedInstanceState) {
        View decorView = getWindow().getDecorView();
        int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_FULLSCREEN
                | View.SYSTEM_UI_FLAG_IMMERSIVE;
        decorView.setSystemUiVisibility(uiOptions);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_load_dex);
    }

......

Code above is my set full screen, but will appear in some equipment GIF image and background image is not coincidence, but at this point, if the modification of the code is as follows, in the oncreate then showed normal:

protected void onCreate(Bundle savedInstanceState) {
        /*View decorView = getWindow().getDecorView();
        int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_FULLSCREEN
                | View.SYSTEM_UI_FLAG_IMMERSIVE;
        decorView.setSystemUiVisibility(uiOptions);*/
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_load_dex);
    }

So the question comes, how do I determine whether the equipment you need to set up the SYSTEM_UI_FLAG_LAYOUT_STABLE and so on a series of flag, who can help me?

I want to learn control lights switch through android app using Raspberry Pi. Please share some nice tutorial, it will help for all. Preferred step by step tutorials. I am beginner in this.

I have multiple fragments, when switching from fragment to fragment, tool bar will updated with back arrow. user will now have option to go previous fragment.

animation is working when toggling between hamburger menu and back arrow but the back arrow is not animating when switching between fragments.

 private FragmentManager.OnBackStackChangedListener backStackListener = new FragmentManager.OnBackStackChangedListener() {
        @Override
        public void onBackStackChanged() {
            setNavIcon();
        }

        ;
    };


@Override
protected void onCreate(Bundle savedInstanceState) {

    Log.d(taglaunch, "on Create Running");
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_appdrawer);
    navigate();
    if (savedInstanceState == null) {
        switchtofragment();
    }
    getFragmentManager().addOnBackStackChangedListener(backStackListener);

}



public void switchtofragment() {
        FragmentMenu fragmentMenu = new FragmentMenu();
        FragmentManager manger = getFragmentManager();
        manger.beginTransaction().replace(R.id.app_bar, fragmentMenu, "fragmenu").commit();
    }

 public void navigate() {

        Log.d(taglaunch, "Navigating");
        toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        toggle = new ActionBarDrawerToggle(
                this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
        drawer.setDrawerListener(toggle);
        toggle.syncState();

        NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
        navigationView.setNavigationItemSelectedListener(this);

    }



public void setDefault() {
        Log.d(taglaunch, "Setting to default");
        drawer.openDrawer(GravityCompat.START);
    }


    protected void setNavIcon() {
        int backStackEntryCount = getFragmentManager().getBackStackEntryCount();
        toggle.setDrawerIndicatorEnabled(backStackEntryCount == 0);
    }

tool bar xml

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/AppTheme.AppBarCustom">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:popupTheme="@style/AppTheme.customToolbar">

    </android.support.v7.widget.Toolbar>

style :

<style name="AppTheme.customToolbar" parent="ThemeOverlay.AppCompat.Light">
        <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
    </style>

I want to select Two values from the Database using php and then pass it to android.

i have 1 AutoCompleteTextView, when i select an item of it, then it will display the name and store the ID of it.

I tried alot but not getting any idea for it .

Here is my complete code

    package com.example.sachin.addvisit;

import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.TextView;
import android.widget.Toast;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONObject;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class MainActivity extends Activity {
    private WebView wv1;
    InputStream is=null;
    String result=null;
    String line=null;
    JSONObject jsonobject;
    private static String url_visitor = "http://10.0.2.2/portal/fetchwod.php";
    JSONParser jParser = new JSONParser();
    JSONArray ownerObj;
    ArrayList<String> arraylist;
    String suid,uid,wt_wod_code1,wt_party1;
    TextView abcd,abc1;
View view;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        new DownloadJSON().execute();
        abcd =(TextView)findViewById(R.id.abc);
        abc1 =(TextView)findViewById(R.id.abc1);
    }

    private class MyBrowser extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url ) {
            view.loadUrl(url);
            return true;
        }
    }
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();
        return super.onOptionsItemSelected(item);
    }
    private class DownloadJSON extends AsyncTask<Void, Void, Void> {
        @Override
        protected void onPreExecute() {
            super.onPreExecute();
        }

        @Override
        protected Void doInBackground(Void... voids) {

            try {
                HttpClient httpclient = new DefaultHttpClient();
                HttpPost httppost = new HttpPost("http://10.0.2.2/autocomplete.php");
                HttpResponse response = httpclient.execute(httppost);
                HttpEntity entity = response.getEntity();
                is = entity.getContent();
                Log.e("Pass 1", "connection success ");
            } catch (Exception e) {
                Log.e("Fail 1", e.toString());
                Toast.makeText(getApplicationContext(), "Invalid IP Address", Toast.LENGTH_LONG).show();
            }
            try {
                BufferedReader reader = new BufferedReader(new InputStreamReader(is, "iso-8859-1"), 8);
                StringBuilder sb = new StringBuilder();
                while ((line = reader.readLine()) != null) {
                    sb.append(line + "\n");
                }
                is.close();
                result = sb.toString();
                Log.e("Pass 2", "connection success ");
            } catch (Exception e) {
                Log.e("Fail 2", e.toString());
            }
            return null;
        }
        @Override
        protected void onPostExecute(Void args) {
            try {
                JSONArray JA = new JSONArray(result);
                JSONObject json = null;
                final String[] str1 = new String[JA.length()];
                final String[] str2 = new String[JA.length()];

                for (int i = 0; i < JA.length(); i++) {
                    json = JA.getJSONObject(i);
                    str1[i] = json.getString("wt_party");
                    str2[i]= json.getString("wt_wod_code");
                }
                final AutoCompleteTextView text = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView1);
                final List<String> list = new ArrayList<String>();

                for (int i = 0; i < str1.length; i++) {
                    list.add(str1[i]);
                }
                Collections.sort(list);
                final ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(getApplicationContext(), R.layout.my_list_item, list);
                dataAdapter.setDropDownViewResource(android.R.layout.simple_list_item_1);
                text.setThreshold(1);
                text.setAdapter(dataAdapter);
                text.setOnItemClickListener(new OnItemClickListener() {
                    @Override
                    public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,long arg3) {
                       wv1=(WebView)findViewById(R.id.webView);
                        wv1.setWebViewClient(new MyBrowser());
                        wv1.loadUrl("http://10.0.2.2/portal/on_target.php?cod=RT13056");
                        wv1.getSettings().setLoadsImagesAutomatically(true);
                        wv1.getSettings().setJavaScriptEnabled(true);
                        wv1.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
                        Toast.makeText(getApplicationContext(),(CharSequence)arg0.getItemAtPosition(arg2), Toast.LENGTH_LONG).show();
                        wt_wod_code1 = text.getText().toString();
                        wt_party1 = text.getText().toString();
                      //  abcd.setText(text.getText());
                       // abc1.setText(text.getText());


                        Log.d("wt_wod_code",wt_party1);

                        new fill().execute();
                    }
                });
            } catch (Exception e) {
                Log.e("Fail 3", e.toString());
            }
        }
    }
    private class fill extends AsyncTask<Void, Void, Void> {

        @Override
        protected Void doInBackground(Void... voids) {

            // Create an array
            try {
                arraylist = new ArrayList<>();
                List<NameValuePair> params = new ArrayList<NameValuePair>();
                params.add(new BasicNameValuePair("wt_party", uid));
                params.add(new BasicNameValuePair("wt_wod_code", suid));
                JSONObject json = jParser.makeHttpRequest(url_visitor, "GET", params);

                int success1 = Integer.parseInt(json.getString("success4"));
                Log.d("success4", json.toString());

                if (success1 == 0) {
                    Snackbar.make(view, "Not Data Found", Snackbar.LENGTH_LONG).show();
                }
                if (success1 == 1) {
                    ownerObj = json.getJSONArray("visit");
                    for (int i = 0; i < ownerObj.length(); i++) {
                        //HashMap<String, String> map = new HashMap<String, String>();
                        jsonobject = ownerObj.getJSONObject(i);
                        // Retrive JSON Objects
                        if (jsonobject.getString("wt_party").equalsIgnoreCase("uid") && (jsonobject.getString("wt_wod_code").equalsIgnoreCase("suid")))
                        {
                         AutoCompleteTextView text=(AutoCompleteTextView)findViewById(R.id.autoCompleteTextView1);
                        Log.d("wt_wod_code",wt_wod_code1);
                        Log.d("wt_wod_code",wt_party1);

                    }
                }
            }
            } catch (Exception e) {
            }
            return null;
        }

    }
        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            getMenuInflater().inflate(R.menu.activity_main, menu);
            return true;

        }
    }

Here My API

 <?php

include("connection.php");

    $response = array();
//  $id = $_GET["wt_wod_code"];
    //$uid=$id;


    $result = mysql_query("SELECT DISTINCT wt_wod_code,wt_party FROM wod_target ") or die(mysql_error());
    $count = mysql_num_rows($result);

    // check for empty result
    if ($count > 0) {
        // looping through all results
        // products node
        $response["visit"] = array();

        while ($row = mysql_fetch_array($result))
        {


            $Ordera = array();

            $visit["wt_wod_code"] = $row["wt_wod_code"];
            $visit["wt_party"] = $row["wt_party"];


            $response["success"]=1;


            // push single product into final response array
            array_push($response["visit"], $visit);
        }


            $response["success4"] = 1;
        // echoing JSON response
        echo json_encode($response);


    }

    else 
    {
        // no products found
        $response["success"] = 0;
        $response["message"] = "No picture found";

        // echo no users JSON
        echo json_encode($response);
    }


?>

please help me out from this.

I have used Push notification in my web application using asp .net webforms .That push notification works fine in my Local host connecting live Database but failed to work in Production Server. What can be the Issue ?Do i Need to make changes in my webConfig file????? please Suggest

    public static void CallPUshNotiFication(string Msg,string EmailId,string PageName)
        {
            try
            {
                
                DataSet dsregID = new DataSet();

                StringBuilder strBldId = new StringBuilder();

               
                var applicationID = Validate.ApplicationId;
                var SENDER_ID = Validate.SenderId;


                List<MobileRegistration11> PuschList = MobileRegistrationManager1.GetDataFromMobileRegistration1(EmailId);
                if (PuschList.Count > 0)
                {
                    foreach (var item in PuschList)
                    {
                       

                        string regId = Convert.ToString(item.RegistrationId);
                        
                        WebRequest tRequest;
                        tRequest = WebRequest.Create("https://android.googleapis.com/gcm/send");
                        //
                        tRequest.UseDefaultCredentials = true;
                        tRequest.PreAuthenticate = true;
                        tRequest.Credentials = CredentialCache.DefaultCredentials;
                        tRequest.Method = "post";
                        //
                        tRequest.ContentType = " application/x-www-form-urlencoded;charset=UTF-8";
                        tRequest.Headers.Add(string.Format("Authorization: key={0}", applicationID));
                        tRequest.Headers.Add(string.Format("Sender: id={0}", SENDER_ID));
                       
                        string postData = "collapse_key=score_update&time_to_live=108&delay_while_idle=1&data.message="
                            + Msg + "&registration_id=" + regId + "&data.id=" + PageName+ "&data.recordId="+147+"";

                        
                        Console.WriteLine(postData);
                        Byte[] byteArray = Encoding.UTF8.GetBytes(postData);
                        tRequest.ContentLength = byteArray.Length;
                        Stream dataStream = tRequest.GetRequestStream();
                        dataStream.Write(byteArray, 0, byteArray.Length);
                        dataStream.Close();
                        WebResponse tResponse = tRequest.GetResponse();
                        dataStream = tResponse.GetResponseStream();
                        StreamReader tReader = new StreamReader(dataStream);
                        String sResponseFromServer = tReader.ReadToEnd();
                        strBldId.Append(sResponseFromServer + "<br>"); //printing response from GCM server.
                        tReader.Close();
                        dataStream.Close();
                        tResponse.Close();
                    }

                }
            }
            catch (Exception ex)
            {

            }
        }

I have three XML file. First, two is I am applying some gradient start color , end color, and the third one is I am checking pressed status (true or false for changing Bg). how can I change my first two XML gradient start color ,end color dynamically ( 1.blue_rounded_bg and 2.gray_rounded_bg) and that dynamic start color and end color is reflected my third file(pressed status checking- 3, blue_btn)?

First XML file: Blue color Bg (file name: blue_rounded_bg)

<?xml version="1.0" encoding="UTF-8"?>

<corners
    android:bottomLeftRadius="@dimen/size25"
    android:bottomRightRadius="@dimen/size25"
    android:topLeftRadius="@dimen/size25"
    android:topRightRadius="@dimen/size25" />
<padding
    android:bottom="@dimen/size5"
    android:left="@dimen/size5"
    android:right="@dimen/size5"
    android:top="@dimen/size5" />

<solid android:color="@color/btn_gray" />
<gradient
    android:angle="270"
    android:startColor="@color/btn_blue"
    android:endColor="@color/btn_light_blue"
    android:type="linear" />

Second XML file: Gray color Bg (file name: gray_rounded_bg)

<?xml version="1.0" encoding="UTF-8"?>

<corners
    android:bottomLeftRadius="@dimen/size25"
    android:bottomRightRadius="@dimen/size25"
    android:topLeftRadius="@dimen/size25"
    android:topRightRadius="@dimen/size25" />
<padding
    android:bottom="@dimen/size5"
    android:left="@dimen/size5"
    android:right="@dimen/size5"
    android:top="@dimen/size5" />

<solid android:color="@color/btn_gray" />

Third XML file: I am checking pressed status using below code (File name: blue_btn )

<?xml version="1.0" encoding="utf-8"?>

<item android:drawable="@drawable/gray_rounded_bg" android:state_pressed="true" />
<item android:drawable="@drawable/gray_rounded_bg" android:state_enabled="false" />
<item android:drawable="@drawable/blue_rounded_bg" />

My normal XML code

 <Button
        android:id="@+id/cont_btn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/blue_btn"
        android:padding="@dimen/size6" />

Then, How can I change drawable gradient start color ,end color dynamically and that changes reflected in

<item android:drawable="@drawable/gray_rounded_bg" android:state_pressed="true" />

this file also ? its possible or not?

When I see my view, the list of images are only on one side. They are not MATCH_PARENT width even if I told my views to do just that.

I am doing the following:

public void setComicPartSegmentTo(List<Integer> partSegments)
{
    mRelativeLayoutHomeScreenLoading.setVisibility(View.VISIBLE);
    mLinearLayoutComicView.removeAllViews();

    Point screenSize = Constants.getScreenSize(getContext());

    for(int i : partSegments)
    {
        Point imageSize = new Point();
        BitmapDrawable bd = (BitmapDrawable) ContextCompat.getDrawable(getContext(), i);
        imageSize.x = bd.getBitmap().getWidth();
        imageSize.y = bd.getBitmap().getHeight();
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);

        ImageView segment = new ImageView(getContext());
        segment.setAdjustViewBounds(true);
        segment.setScaleType(ImageView.ScaleType.FIT_XY);
        segment.setLayoutParams(params);

        mLinearLayoutComicView.addView(segment);

        //float scalingRatio = ((float) imageSize.y /(float) imageSize.x);
        //segment.getLayoutParams().width = screenSize.x;
        //segment.getLayoutParams().height = Math.round(scalingRatio * screenSize.x);
        //segment.requestLayout();

        Glide.with(getContext())
            .load(i)
            // .override(imageSize.x, imageSize.y)
            .into(segment);
    }

    YoYo.with(Techniques.FadeOut).duration(500).playOn(mRelativeLayoutHomeScreenLoading);

    mIsReady = false;
}

Here is my XML layout:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/relativelayout_comic"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    android:clickable="true" >

    <com.indigo.android.sample.comicviewer.ui.custom.ZoomableScrollView
        android:id="@+id/zoomablerecyclerview_comic"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:id="@+id/linearlayout_comic_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

        </LinearLayout>

    </com.indigo.android.sample.comicviewer.ui.custom.ZoomableScrollView>

    <RelativeLayout
        android:id="@+id/relativelayout_homescreen_loading"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#333333">

        <com.wang.avi.AVLoadingIndicatorView
            android:id="@+id/avloadingindicatorview_homescreen"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            app:indicatorName="LineSpinFadeLoaderIndicator"
            app:indicatorColor="#78f220" />

    </RelativeLayout>

    <include layout="@layout/layout_navigation_panel" />

</RelativeLayout>

It looks like this:

enter image description here

Anything amiss in my code?

I'm using lastest AndroidAnnotations 4.1.0(link) and try to change appcompat to 24.2.1 to support targetVersion 24. But, My app is crashed when using appcompat-v7 version 23+, however, it runs normally on appcompat-v7:22.2.0. Any suggestion is appriciated. Below is my error logs:

    FATAL EXCEPTION: main
  Process: ABC, PID: 1275
  java.lang.RuntimeException: Unable to start activity ComponentInfo{MyPackage/MyPackage.activities.MainActivity_}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2237)
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2286)
      at android.app.ActivityThread.access$800(ActivityThread.java:144)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
      at android.os.Handler.dispatchMessage(Handler.java:102)
      at android.os.Looper.loop(Looper.java:212)
      at android.app.ActivityThread.main(ActivityThread.java:5137)
      at java.lang.reflect.Method.invokeNative(Native Method)
      at java.lang.reflect.Method.invoke(Method.java:515)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:902)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:718)
      at dalvik.system.NativeStart.main(Native Method)
   Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
      at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284)
      at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
      at MyPackage.activities.MainActivity_.setContentView(MainActivity_.java:51)
      at MyPackage.activities.MainActivity_.onCreate(MainActivity_.java:40)
      at android.app.Activity.performCreate(Activity.java:5231)
      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2201)
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2286) 
      at android.app.ActivityThread.access$800(ActivityThread.java:144) 
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246) 
      at android.os.Handler.dispatchMessage(Handler.java:102) 
      at android.os.Looper.loop(Looper.java:212) 
      at android.app.ActivityThread.main(ActivityThread.java:5137) 
      at java.lang.reflect.Method.invokeNative(Native Method) 
      at java.lang.reflect.Method.invoke(Method.java:515) 
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:902) 
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:718) 
      at dalvik.system.NativeStart.main(Native Method) 
   Caused by: java.lang.IllegalArgumentException: Binary XML file line #7: Must specify unique android:id, android:tag, or have a parent with an id for MyPackage.fragments.MainFragment_
      at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2387)
      at android.support.v4.app.FragmentController.onCreateView(FragmentController.java:120)
      at android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:376)
      at android.support.v4.app.BaseFragmentActivityHoneycomb.onCreateView(BaseFragmentActivityHoneycomb.java:33)
      at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:75)
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
      at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
      at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
      at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
      at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284) 
      at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
      at MyPackage.activities.MainActivity_.setContentView(MainActivity_.java:51) 
      at MyPackage.activities.MainActivity_.onCreate(MainActivity_.java:40) 
      at android.app.Activity.performCreate(Activity.java:5231) 
      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2201) 
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2286) 
      at android.app.ActivityThread.access$800(ActivityThread.java:144) 
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246) 
      at android.os.Handler.dispatchMessage(Handler.java:102) 
      at android.os.Looper.loop(Looper.java:212) 
      at android.app.ActivityThread.main(ActivityThread.java:5137) 
      at java.lang.reflect.Method.invokeNative(Native Method) 
      at java.lang.reflect.Method.invoke(Method.java:515) 
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:902) 
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:718) 
      at dalvik.system.NativeStart.main(Native Method) 

I want to transmit set commands in datecs DRD 50 audio reader. i am new to android programming.I have SDK for DRD50.

byte[] mfselect={(byte)0x00,(byte)0xA4,(byte)0x00,(byte)0x00}; /* byte[] dfselect={(byte)0x00,(byte)0xA4,(byte)0x00,(byte)0x00,(byte)0x02,(byte)0x40,(byte)0x00}; byte[] personalinfoselect={(byte)0x00,(byte)0xA4,(byte)0x00,(byte)0x00,(byte)0x40,(byte)0x04}; byte[] getpersonalinfo={(byte)0x00,(byte)0xB0,(byte)0x00,(byte)0x00,(byte)0xFF}; byte[] selectendorsment={(byte)0x00,(byte)0xA4,(byte)0x00,(byte)0x00,(byte)0x40,(byte)0x06}; byte[] getendorsment={(byte)0x00,(byte)0xB2,(byte)0x00,(byte)0x00,(byte)0xFF}; These are my commands.

Thank you in advance

Hi I am going to upload my app as alpha testing in google play,So can I add Admob ads(no test ads) now in my app during alpha testing or I should add it later when I upload my apk as production apk in google play.Can anyone suggest me.

My String is like this String Result="Your A/c No. XXXXXXXX2335 is debited for Rs. 20 on 04-10-16 and A/c linked to mobile 9818685050 credited " + "( IMPS Ref No. 627814178257 )"; i want to fetch the IMPS Ref no. from string How can i do this?//My Method of fetching is // I want to fetch it with IMPS Ref. No. String Result="Your A/c No. XXXXXXXX2335 is debited for Rs. 20 on 04-10-16 and A/c linked to mobile 9818685050 credited " + "( IMPS Ref No. 627814178257 )"; if(Result.indexOf("IMPS Ref No.") > 0) { System.out.println(Result.indexOf("IMPS Ref No.")); String[] result=Result.split("\("); System.out.println(result[1]); String imps=result[1]; String numberOnly= imps.replaceAll("[^0-9]", ""); System.out.println(numberOnly);

            }

I have an OData web service that I need to create an offline cache API for. This class will be leveraged by an offline-capable mobile client (iOS/Android/HTML5).

One option would be a class that updates both the server and the client at the same time:

ViewControllerUpdatesData()
{
  // Method1: UpdateTheLocalCachePendingConfirmation()
  // Method2:  UpdateTheServerAuthorityAndProcessFailures()
}

The problem I have with this concept is that I need to account for no network access, and retrying the results.

This means I need to do the following:

  • Create a queue for Method2. This is where pending data of Adds/Changes/Deletes will be present and need to be managed.
  • I need a QueueManager to process the pending items of the queue so a performance-optimized batch can be created.
  • If some of the queued operations are updated, then delete the pending change in queue, replace it with the fresh update.
  • Handle conflicts if the record is already updated on the server.

The problem I'm having regarding this implementation:

  • The API needs to consider updating local and cloud versions of data.
  • The OData datatypes can not be subclassed.
  • There needs to be a mapping layer between the SqlLite keys & the ODataKeys.
  • The keys located in OData are composite of specific values in the SQLLite Keys.
  • LocalSQL tables need to by mapped to a single PartitionKey

Background

  • Azure only supports transaction operations in the same PartitionKey.
  • MySQL can't handle more than one "record type" in the same table
  • A foreign key relationship needs to manage this asymmetry

Any examples, direction, or ways to handle these constraints would be helpful.

Sedgewick's Algorithm 4ed says

Several fundamental data types involve collections of objects. Specifically, the set of values is a collection of objects, and the operations revolve around adding, removing, or examining objects in the collection. In this section, we consider three such data types, known as the bag, the queue, and the stack. They differ in the specification of which object is to be removed or examined next.

...

A linked list is a recursive data structure that is either empty (null) or a reference to a node having a generic item and a reference to a linked list.

  • Is the concept of "collection" well defined in general programming language theory, or just in Java's language or library?

  • Is a linked list a collection?

    The book doesn't say a linked list is a collection, but says that the three collections, namely a bag, queue and stack, can be implemented in terms of linked lists.

    But it seems that a linked list possesses some features of a collection, but I am not sure if it possesses all the characteristics of a collection to be qualified as a collection.

Thanks.

I want to create an app that is able to write R language and compile it to produce charts. From what i know, i need to create an compiler. I have no idea how can it be done using android studio. Do i need to code from scratch ? Is there any shorter way to do it ?

CIFaceFeature in Swift can only detect eyes and mouth locations. Are there libraries for me to detect more features than just eyes and mouth ?. If there are not, please point me some walk-around ways to do this.

Ionic app is not able to "Run" on ios 10. It gets stuck on the splash screen. I already add value to description for privacy such as camera, photo, location etc. It is running fine on ios 9 and deployed to play store fine.

I press the home button to exit out of the app and when I go in the app again, it works 100% fine. My app update got rejected from apple because of this and I'm not sure how to fix.

Any help would be greatly appreciated. Here's the log from xcode when trying to run on ios10. The spinner keeps spinning too.

2016-10-07 12:21:00.848884 GoGENIE[2303:717683] Loaded
2016-10-07 12:21:01.866899 GoGENIE[2303:717683] Apache Cordova native platform version 4.1.1 is starting.
2016-10-07 12:21:01.868078 GoGENIE[2303:717683] Multi-tasking -> Device: YES, App: YES
2016-10-07 12:21:02.134647 GoGENIE[2303:717683] Using UIWebView
2016-10-07 12:21:02.138260 GoGENIE[2303:717683] [CDVTimer][handleopenurl] 0.127971ms
2016-10-07 12:21:02.141908 GoGENIE[2303:717683] [CDVTimer][intentandnavigationfilter] 3.525972ms
2016-10-07 12:21:02.142136 GoGENIE[2303:717683] [CDVTimer][gesturehandler] 0.132978ms
2016-10-07 12:21:02.146689 GoGENIE[2303:717683] [CDVTimer][keyboard] 4.429996ms
2016-10-07 12:21:02.189008 GoGENIE[2303:717683] [CDVTimer][statusbar] 42.160988ms
2016-10-07 12:21:02.219923 GoGENIE[2303:717683] [CDVTimer][file] 30.754983ms
2016-10-07 12:21:02.269676 GoGENIE[2303:717683] [CDVTimer][splashscreen] 49.588978ms
2016-10-07 12:21:02.269815 GoGENIE[2303:717683] [CDVTimer][TotalPluginStartup] 131.729007ms
2016-10-07 12:21:03.860727 GoGENIE[2303:717683] Resetting plugins due to page load.
2016-10-07 12:21:06.373501 GoGENIE[2303:717683] Finished load of: file:///var/containers/Bundle/Application/4C6823F5-54DF-4581-A8A1-100DD7F6AC22/GoGENIE.app/www/index.html#/app/temp-jobs