public void dialog_Custom(){
	    	 AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
	    	 builder.setMessage( R.string.dialogtitleurl);	 
	    	 LayoutInflater inflater = (LayoutInflater) mContext.getSystemService( Context.LAYOUT_INFLATER_SERVICE );	 
	     		  View layout = inflater.inflate( R.layout.dialog_url, (ViewGroup) findViewById(R.id.LinearLayout01));
            	  final EditText   edit_url= (EditText)layout.findViewById(R.id.edit_url);
	     	    builder.setView(layout)
	     	    // Add action buttons
	     	           .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
	     	             //  @Override
	     	               public void onClick(DialogInterface dialog, int id) {
	     	                   // sign in the user ...
	     	            	//  EditText   edit_url= (EditText)dialog.findViewById(R.id.edit_url);
	     	            	//  String t_string=edit_url.getText().toString();
	     	            	    String text=edit_url.getText().toString();
                                if(text.length()==0){
                                	Toast msg = Toast.makeText(getBaseContext(),text+"  error", Toast.LENGTH_LONG);
                                }else{
                                	Toast msg = Toast.makeText(getBaseContext(),"Play "+text,   Toast.LENGTH_LONG);
                                
                            		Fun_playFile( new File(text));
                                }
	     	               
	     	            	   
	     	               }
	     	           })
	     	           .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
	     	               public void onClick(DialogInterface dialog, int id) {
	     	            	   dialog.cancel();
	     	               }
	     	           });      
	     	        // 3. Get the AlertDialog from create()
	     	       	AlertDialog dialog = builder.create();
	     	       	
	     	           builder.show();
	     }
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
     
         android:id="@+id/LinearLayout01"
     
     
     
     android:layout_width="wrap_content"
     android:layout_height="wrap_content">
       <TextView
        android:id="@+id/textView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Play URL Video/Audio" />
     <ImageView
         android:src="@drawable/icon"
         android:layout_width="match_parent"
         android:layout_height="64dp"
         android:scaleType="center"
         android:background="#FFbbbbbb"
         android:contentDescription="hi!" />
     <EditText
         android:id="@+id/edit_url"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_marginTop="16dp"
         android:layout_marginLeft="4dp"
         android:layout_marginRight="4dp"
         android:layout_marginBottom="4dp"
         android:imeOptions="actionDone"
			android:inputType="textUri"
		 android:text="rtsp://192.168.1.120:554/stream1"
         android:hint="rtsp://192.168.1.120:554/stream1" />
 </LinearLayout>

By admin-powenko

Dr. Powen Ko is a teacher and CEO on LoopTek LLC, and like to teaching. if you need to class, please let PowenKo know, he will love to service and sharing. LoopTek web site is www.looptek.com

Leave a Reply