Changing mac address bluestack

[postlink] https://the-best-way-of-life-is-islam.blogspot.com/2015/07/changing-mac-address-bluestack.html [/postlink]

I have a rooted blue stack ,when I tried to change its mac address using same methods. As in an Android phone,but no use ,please can any one help me,it has been installed with busy box ,root explorer and android terminal emulator,I have tried turning off the Ethernet using ifconfig eth0 off,but still the same result

Cannot get the position of the tabhost from a fragment to another fragment using bundle

[postlink] https://the-best-way-of-life-is-islam.blogspot.com/2015/07/cannot-get-position-of-tabhost-from.html [/postlink]

I have two fragments. One is for the tab and one is for the main layout that calls a list view. I am having trouble passing the "position" from my AlarmTab Class to my AlarmActivity Class. The position is being passed but it only gets the length of my array. When i click a list from my position [0] tab, it returns the length of myTabHost and not the clicked tab. I want to get the position of the clicked and below are the codes of what i have done so far. I've been working with this for hours already. Hopefully someone can help me point out what i am missing. Thank you in advance!

from AlarmTab Class

mTabHost = (FragmentTabHost) rootView.findViewById(android.R.id.tabhost);
widget = (TabWidget) rootView.findViewById(android.R.id.tabs);
hs = (HorizontalScrollView) rootView.findViewById(R.id.horizontalScrollView);
mTabHost.setup(getActivity(), getChildFragmentManager(), android.R.id.tabcontent);

for(int i=0; i<SmashDeviceData.get_instance().devices.size(); i++) {

    AlarmActivity alarmActivity = new AlarmActivity();
    Bundle bundle = new Bundle();
    bundle.putInt("position", i);
    alarmActivity.setArguments(bundle);
    mTabHost.addTab(mTabHost.newTabSpec("i").setIndicator(SmashDeviceData.get_instance().devices.get(i).deviceName), AlarmActivity.class, bundle);
    } 

and from AlarmActivity Class

   public void addAlarm(){
        ImageView addAlarmButton = (ImageView) getActivity().findViewById(R.id.add_alarm);
        addAlarmButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                FragmentActivity mainDrawer = (FragmentActivity) context;
                Fragment fragment;
                Bundle b = getArguments();
                int position = b.getInt("position", 0);
                Toast.makeText(context, String.valueOf(b.getInt("position")), Toast.LENGTH_SHORT ).show();
                fragment = AlarmSetActivity.newInstance(context, position);
                FragmentManager fragmentManager = mainDrawer.getSupportFragmentManager();
                FragmentTransaction ft = fragmentManager.beginTransaction();
                ft.replace(R.id.content_frame, fragment);
                ft.addToBackStack(null);
                ft.commit();
            }
        });
    }

my androidstudio app doesnt display the adapter in the listview

[postlink] https://the-best-way-of-life-is-islam.blogspot.com/2015/07/my-androidstudio-app-doesnt-display.html [/postlink]

i already parse a json String from my website and save it into an arraylist but when i run the app the elements doesnt show in the fragment, i already debug and the info does save it in the arraylist but it doesnt show it, i already check the similars topics but no one solve my problem, here is my code:

Adapter:

package com.example.luiggi.myapplication;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import java.util.ArrayList;

/**
 * Created by andre_000 on 6/28/2015.
 */
public class FacturasAdapter extends ArrayAdapter<Invoices> {
    Context context;
    int layoutResourceId;
    ArrayList<Invoices> data;

    public FacturasAdapter(Context context, int layoutResourceId, ArrayList<Invoices> data) {
        super(context, layoutResourceId, data);
        this.layoutResourceId = layoutResourceId;
        this.context = context;
        this.data = data;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View row = convertView;
        FacturasHolder holder = null;

        if (row == null) {
            LayoutInflater inflater = ((Activity) context).getLayoutInflater();
            row = inflater.inflate(layoutResourceId, parent, false);

            holder = new FacturasHolder();

            holder.shipping_id = (TextView) row.findViewById(R.id.shipping_id);
            holder.company_id = (TextView) row.findViewById(R.id.company_id);
            holder.user_id = (TextView) row.findViewById(R.id.user_id);
            holder.driver_id = (TextView) row.findViewById(R.id.driver_id);
            holder.id = (TextView) row.findViewById(R.id.id);
            holder.fecha_factura = (TextView) row.findViewById(R.id.fecha_factura);
            holder.monto = (TextView) row.findViewById(R.id.monto);
            holder.precio_km = (TextView) row.findViewById(R.id.precio_km);
            holder.nombre = (TextView) row.findViewById(R.id.nombre);
            holder.direccion = (TextView) row.findViewById(R.id.direccion);
            holder.telefono = (TextView) row.findViewById(R.id.telefono);
            holder.estado = (TextView) row.findViewById(R.id.estado);

            row.setTag(holder);
        } else {
            holder = (FacturasHolder) row.getTag();
        }

        Invoices pedido = data.get(position);

        holder.shipping_id.setText(pedido.shipping_id);
        holder.company_id.setText(pedido.company_id);
        holder.user_id.setText(pedido.user_id);
        holder.driver_id.setText(pedido.driver_id);
        holder.id.setText(pedido.id);
        holder.fecha_factura.setText(pedido.fecha_factura);
        holder.monto.setText(pedido.monto);
        holder.precio_km.setText(pedido.precio_km);
        holder.nombre.setText(pedido.nombre);
        holder.direccion.setText(pedido.direccion);
        holder.telefono.setText(pedido.telefono);
        holder.estado.setText(pedido.estado);

        //final int pos = position;

        /*row.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                PresupuestosFragment.presupuestoSeleccionado = PresupuestosFragment.listPresupuestos.get(pos);

                new PresupuestoRepuestoTask().execute();
            }
        });
*/
        return row;
    }



    static class FacturasHolder {
        public TextView shipping_id;
        public TextView company_id;
        public TextView user_id;
        public TextView driver_id;
        public TextView id;
        public TextView fecha_factura;
        public TextView monto;
        public TextView precio_km;
        public TextView nombre;
        public TextView direccion;
        public TextView telefono;
        public TextView estado;

    }
}

Fragment:

package com.example.luiggi.myapplication;

import android.app.Activity;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import org.json.JSONArray;
import org.json.JSONException;

import java.io.IOException;
import java.net.URISyntaxException;
import java.util.ArrayList;


public class FacturasFragments extends Fragment {

    View rootView;
    private ListView ListFacturas;


    //public static Presupuestos presupuestoSeleccionado;
    //public static ArrayList<PresupuestoRepuesto> presupuestoRepuesto;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        rootView=inflater.inflate(R.layout.facturas_fragments, container, false);

        ListFacturas = (ListView)rootView.findViewById(R.id.ListFacturas);

        Jsonclass conexion = new Jsonclass();
        conexion.execute();



        return rootView;
    }

    public class Jsonclass extends AsyncTask<Void, Void, String> {
        public ArrayList<Invoices> listfacturas;

        @Override
        protected String doInBackground(Void... params) {
            WebRequest facturas = null;

            try {
                facturas = new WebRequest(
                        "http://ift.tt/1HyuK3G"
                );
            } catch (IOException e) {
                e.printStackTrace();
                return null;
            } catch (URISyntaxException e) {
                e.printStackTrace();
                return null;
            }

            return facturas.getResponse();
        }

        @Override
        protected void onPostExecute(final String result) {
            //if (result != null) {
            //Log.v("Prueba",result);
            listfacturas = StringToFacturas(result);
            ListFacturas.setAdapter(new FacturasAdapter(getActivity(),R.layout.facturasadapterview, listfacturas));

            //} else {

            //}
        }

        // TODO: Convertir string a JSON y luego a ArrayList<presupuestos>
        private ArrayList<Invoices> StringToFacturas(String result) {
            ArrayList<Invoices> listfacturas = new ArrayList<Invoices>();

            try {
                JSONArray presupuestos = new JSONArray(result);

                for (int i = 0; i < presupuestos.length(); i++) {
                    //JSONArray p = presupuestos.getJSONObject(i).getJSONArray("presupuestos");

                    //for (int j = 0; j < p.length(); j++) {


                    Invoices invoice = new Invoices(
                            presupuestos.getJSONObject(i).getString("id"),
                            presupuestos.getJSONObject(i).getString("shipping_id"),
                            presupuestos.getJSONObject(i).getString("company_id"),
                            presupuestos.getJSONObject(i).getString("user_id"),
                            presupuestos.getJSONObject(i).getString("driver_id"),
                            presupuestos.getJSONObject(i).getString("fecha_factura"),
                            presupuestos.getJSONObject(i).getString("monto"),
                            presupuestos.getJSONObject(i).getString("precio_km"),
                            presupuestos.getJSONObject(i).getString("nombre"),
                            presupuestos.getJSONObject(i).getString("direccion"),
                            presupuestos.getJSONObject(i).getString("telefono"),
                            presupuestos.getJSONObject(i).getString("estado")
                            //p.getJSONObject(j).getJSONObject("usuario").getString("correo") + " (" + p.getJSONObject(j).getJSONObject("usuario").getString("nombre") + " " + p.getJSONObject(j).getJSONObject("usuario").getString("apellido") + ")"
                    );

                    listfacturas.add(invoice);
                    //}
                }




                //JSONObject jsonResponse = new JSONObject(result);
                //Log.v("FINAPARTY", result);


                //Log.v("FINAPARTY", presupuestos.getJSONObject(0).getString("fecha_registro"));

                //Log.v("FINAPARTY", presupuestos.getJSONObject(0).getJSONArray("presupuestos").getJSONObject(0).getString("id_usuario"));

            } catch (JSONException e) {
                e.printStackTrace();
            }



            return listfacturas;
        }
    }


}

Fragment XML:

<!-- TODO: Update blank fragment layout -->

<ListView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/ListFacturas"
    android:layout_gravity="center_horizontal|top"
    android:layout_alignParentLeft="true"
    android:layout_marginLeft="0dp"
    android:layout_alignParentTop="true"
    android:layout_marginTop="0dp" />

Adapter XML:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
    android:orientation="vertical" android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:text="Large Text"
        android:id="@+id/shipping_id"
        android:layout_gravity="bottom"
        android:layout_alignParentLeft="true"
        android:layout_marginLeft="0dp"
        android:layout_alignParentTop="true"
        android:layout_marginTop="0dp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:text="Large Text"
        android:id="@+id/company_id"
        android:layout_gravity="center_vertical"
        android:layout_alignParentLeft="true"
        android:layout_marginLeft="0dp"
        android:layout_alignParentTop="true"
        android:layout_marginTop="52dp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:text="Large Text"
        android:id="@+id/user_id"
        android:layout_alignParentLeft="true"
        android:layout_marginLeft="0dp"
        android:layout_alignParentTop="true"
        android:layout_marginTop="104dp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:text="Large Text"
        android:id="@+id/driver_id"
        android:layout_alignParentLeft="true"
        android:layout_marginLeft="0dp"
        android:layout_alignParentTop="true"
        android:layout_marginTop="156dp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:text="Large Text"
        android:id="@+id/id"
        android:layout_alignParentLeft="true"
        android:layout_marginLeft="0dp"
        android:layout_alignParentTop="true"
        android:layout_marginTop="208dp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:text="Large Text"
        android:id="@+id/fecha_factura"
        android:layout_alignParentLeft="true"
        android:layout_marginLeft="0dp"
        android:layout_alignParentTop="true"
        android:layout_marginTop="260dp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:text="Large Text"
        android:id="@+id/monto"
        android:layout_alignParentLeft="true"
        android:layout_marginLeft="0dp"
        android:layout_alignParentTop="true"
        android:layout_marginTop="312dp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:text="Large Text"
        android:id="@+id/precio_km"
        android:layout_alignParentLeft="true"
        android:layout_marginLeft="0dp"
        android:layout_alignParentTop="true"
        android:layout_marginTop="364dp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:text="Large Text"
        android:id="@+id/nombre"
        android:layout_alignParentLeft="true"
        android:layout_marginLeft="0dp"
        android:layout_alignParentTop="true"
        android:layout_marginTop="416dp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:text="Large Text"
        android:id="@+id/direccion"
        android:layout_alignParentLeft="true"
        android:layout_marginLeft="0dp"
        android:layout_alignParentTop="true"
        android:layout_marginTop="468dp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:text="Large Text"
        android:id="@+id/telefono"
        android:layout_alignParentLeft="true"
        android:layout_marginLeft="0dp"
        android:layout_alignParentTop="true"
        android:layout_marginTop="520dp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:text="Large Text"
        android:id="@+id/estado"
        android:layout_alignParentLeft="true"
        android:layout_marginLeft="0dp"
        android:layout_alignParentTop="true"
        android:layout_marginTop="572dp" />

</RelativeLayout>

how i can access and copy the files from internal folder (/acct) and paste in SD Card

[postlink] https://the-best-way-of-life-is-islam.blogspot.com/2015/07/how-i-can-access-and-copy-files-from.html [/postlink]

I need copy files from internar /folder/file

How i can access and copy the files from internal folder (/acct) and paste in SD Card, or i can read these files in the internal folder?

Can I add protected void onResume() to Fragment class to launch something when the UI restored in Android?

[postlink] https://the-best-way-of-life-is-islam.blogspot.com/2015/07/can-i-add-protected-void-onresume-to.html [/postlink]

In AppCompatActivity , I can add the code protected void onResume() to launch some function when UI is shown or restored.

Now I created a Tabbed Activity, I add the code protected void onResume() to PlaceholderFragmentOld class , and I hope the system do someting when the UI cleanup_delete_fragment_old is shown, but the system crash and return the following error.

android.support.v4.app.SuperNotCalledException: Fragment PlaceholderFragmentOld{40e55078 #0 id=0x7f0f0070 android:switcher:2131689584:0} did not call through to super.onResume()

PlaceholderFragmentOld.java

public class PlaceholderFragmentOld extends Fragment {

    private AdView adView;
    private SMSRange mSmsRange;

    private View mView;
    private Context mContext;
    private Spinner spinnerRanger;
    private CheckBox chIsWriteLog;

    public PlaceholderFragmentOld() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,  Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.cleanup_delete_fragment_old, container, false);

        mView=rootView;
        mContext=rootView.getContext();


        return rootView;
    }


    @Override
    protected void onResume() {
       DoSometing();
    }
}

CleanupDelete.java

public class CleanupDelete extends ActionBarActivity implements ActionBar.TabListener {

    SectionsPagerAdapter mSectionsPagerAdapter;
    ViewPager mViewPager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.cleanup_delete);

        final ActionBar actionBar = getSupportActionBar();
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

        mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());

        mViewPager = (ViewPager) findViewById(R.id.pager);
        mViewPager.setAdapter(mSectionsPagerAdapter);

        mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
            @Override
            public void onPageSelected(int position) {
                actionBar.setSelectedNavigationItem(position);
            }
        });

        for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
            actionBar.addTab(
                    actionBar.newTab()
                            .setText(mSectionsPagerAdapter.getPageTitle(i))
                            .setTabListener(this));
        }
    }

    @Override
    public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
        mViewPager.setCurrentItem(tab.getPosition());
    }

    @Override
    public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
    }

    @Override
    public void onTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
    }


    public class SectionsPagerAdapter extends FragmentPagerAdapter {

        public SectionsPagerAdapter(FragmentManager fm) {
            super(fm);
        }

        @Override
        public Fragment getItem(int position) {
            Fragment fragment;
            switch(position){
                case 0:
                    fragment = new PlaceholderFragmentOld();
                    break;
                case 1:
                    fragment = new PlaceholderFragmentReduce();
                    break;
                case 2:
                    fragment = new PlaceholderFragmentTrim();
                    break;
                case 3:
                    fragment = new PlaceholderFragmentPerson();
                    break;
                default:
                    throw new IllegalArgumentException("Invalid section number");
            }

            return fragment;
        }



        @Override
        public int getCount() {
            return 4;
        }

        @Override
        public CharSequence getPageTitle(int position) {
            Locale l = Locale.getDefault();
            switch (position) {
                case 0:
                    return getString(R.string.Tab_Old);
                case 1:
                    return getString(R.string.Tab_Reduce);
                case 2:
                    return getString(R.string.Tab_Trim);
                case 3:
                    return getString(R.string.Tab_Person);
            }
            return null;
        }
    }



}

Android Media Player Stuttering with CountDownTimer

[postlink] https://the-best-way-of-life-is-islam.blogspot.com/2015/07/android-media-player-stuttering-with.html [/postlink]

I'm trying to make an app to teach someone how to count music. The media player is initialize to a 30 second sound clip of a persistent A note. I am using a countdown timer to tell my media player when to pause and play. The code below causes the first and last second of audio to stutter.

MediaPlayer myMediaPlayer = MediaPlayer.create(MusicCounting.this, R.raw.a_note);
CountDownTimer time = new CountDownTimer(4000,500) {
    @Override
    public void onTick(long millisUntilFinished) {
        if(myMediaPlayer.isPlaying()) {
            myMediaPlayer.pause();
        } else {
            myMediaPlayer.start();
        }
    }

    @Override
    public void onFinish() {
        myMediaPlayer.pause();
        myMediaPlayer.seekTo(0);
    }
};

time.start();

This code is for quarter notes and my eighth notes code looks identical except the second parameter for the countdown timer is 250. Any suggestions would be greatly appreciated. Thanks :)

RESTful Api authentication for an android app

[postlink] https://the-best-way-of-life-is-islam.blogspot.com/2015/07/restful-api-authentication-for-android.html [/postlink]

I have an assignment where i need to use an email and password to authenticate a user and get an access token. I have both the api key, secret and the base URL. I am not required to use a redirect URL for the assignment and it wasn't provided. I am not sure which approach or which library to use. I am drowning in the abundance of information and it is confusing me. I need to be pointed in the right direction.... any kind of help will be welcome. Thanks

 
حقوق النشر: Published by | Template Created by | القناة على اليوتيب
copyright © 2014. The Best Way Of Life Is Islam -يمكن نقل كل ما هو موجود في موقع الرحمة تيوب
القرآن الكريم و الأحاديث النبوية أناشيد و دروس اسلامية منوعة موقع الفيديوهات الاسلامية
تطوير و تعريب مدونة ثعلوب