<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><category>pcsoft.us.windev</category><copyright>Copyright 2026, PC SOFT</copyright><lastBuildDate>5 Mar 2018 15:35:58 Z</lastBuildDate><pubDate>5 Mar 2018 15:35:58 Z</pubDate><description>Hi, I am trying (desperately) to make the following class work in windev mobile 23. It is supposed to show a custom made toast every time the phone calls. It works fine in android studio...but I am struggeling in windev mobile 23. I have allready added that class as java and that works fine, but I am not sure how to call this class within the windev code. &#13;
&#13;
import android.content.BroadcastReceiver;&#13;
import android.content.Context;&#13;
import android.content.Intent;&#13;
import android.telephony.TelephonyManager;&#13;
import android.view.Gravity;&#13;
import android.view.LayoutInflater;&#13;
import android.view.View;&#13;
import android.view.ViewGroup;&#13;
import android.widget.ImageView;&#13;
import android.widget.Toast;&#13;
&#13;
/**&#13;
 * Created by janerikmeidell on 07.02.18.&#13;
 */&#13;
&#13;
public class PhoneStateReceiver extends BroadcastReceiver{&#13;
&#13;
    public void onReceive( Context context, Intent intent) {&#13;
        try {&#13;
            System.out.println("Receiver start");&#13;
            String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE);&#13;
&#13;
            //Toast.makeText(context," Receiver start ",Toast.LENGTH_SHORT).show();&#13;
            if(state.equals(TelephonyManager.EXTRA_STATE_RINGING)){&#13;
               //Toast.makeText(context,"Ringing State Number is -",Toast.LENGTH_SHORT).show();&#13;
&#13;
                LayoutInflater inflater = (LayoutInflater) context.getSystemService( context.LAYOUT_INFLATER_SERVICE );&#13;
                View layout = inflater.inflate(R.layout.toast, null, false);&#13;
                ViewGroup container = (ViewGroup) layout.findViewById(R.id.custom_toast_container);&#13;
                ImageView img = (ImageView) layout.findViewById(R.id.img);&#13;
&#13;
                Toast toast = new Toast(context);&#13;
                toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);&#13;
                toast.setDuration(Toast.LENGTH_LONG);&#13;
                toast.setView(layout);&#13;
                toast.show();&#13;
&#13;
&#13;
            }&#13;
            if ((state.equals(TelephonyManager.EXTRA_STATE_OFFHOOK))){&#13;
                Toast.makeText(context,"Received State",Toast.LENGTH_SHORT).show();&#13;
            }&#13;
            if (state.equals(TelephonyManager.EXTRA_STATE_IDLE)){&#13;
                Toast.makeText(context,"Idle State",Toast.LENGTH_SHORT).show();&#13;
            }&#13;
        }&#13;
        catch (Exception e){&#13;
            e.printStackTrace();&#13;
        }&#13;
    }&#13;
&#13;
}&#13;
&#13;
--&#13;
Erik</description><ttl>30</ttl><generator>WEBDEV</generator><language>en_US</language><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/64828-java-class-windev/read.awp</link><title>Java class in Windev</title><managingEditor>moderateur@pcsoft.fr (El moderador)</managingEditor><webMaster>webmaster@pcsoft.fr (El webmaster)</webMaster></channel></rss>
