Output
Source Code
#include<stdio.h>
void main()
{
int i,j,k,rows=7;
clrscr();
for(i=1;i<=rows;i++)
{
//print blank space
for(j=1;j<=rows;j++)
{
if((i+j)<=rows)
printf(" ");
else
printf("*");
}
printf("\n");
}
getch();
}
Video
Tech Programming Ideas is one of the best places on the programming for programmers. Learn coding with Tech Programming Ideas tutorials. We are covered android programming, php, yii2 framework, javascript, mysql, vb.net etc.
Output
Source Code
#include<stdio.h>
void main()
{
int i,j,k,rows=7;
clrscr();
for(i=1;i<=rows;i++)
{
//print blank space
for(j=1;j<=rows;j++)
{
if((i+j)<=rows)
printf(" ");
else
printf("*");
}
printf("\n");
}
getch();
}
Video
By the help of MediaController and VideoView classes, we can play the video files in android.
- Dsiplaying loacal videos
- Create an application that displays a video clip, which is stored locally
in our applications “res” directory
- Create a row directory
Paste video file to raw directory
- Add VideoView to your UI
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<VideoView
android:id="@+id/videoView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
MainActivity.java
package com.lb.videoplay;
import androidx.appcompat.app.AppCompatActivity;
import android.net.Uri;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
VideoView videoView = (VideoView) findViewById(R.id.videoView);
//Attach a media controller to video view
MediaController mediaController = new MediaController(this);
videoView.setMediaController(mediaController);
mediaController.setAnchorView(videoView);
//Specify the location of media file
Uri uri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.favicon);
videoView.setVideoURI(uri);
videoView.requestFocus();
videoView.start();
}
}
previous tutorial we are discuss about
how to play video on videoview from local file
First set to internet permission
your manifest must include the permissions:
<uses-permission android:name="android.permission.INTERNET" />
Then and to video url
Check this code
package com.lb.videoplay;
import androidx.appcompat.app.AppCompatActivity;
import android.net.Uri;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
VideoView videoView = (VideoView) findViewById(R.id.videoView);
//Attach a media controller to video view
MediaController mediaController = new MediaController(this);
videoView.setMediaController(mediaController);
mediaController.setAnchorView(videoView);
//add your video URL
Uri uri = Uri.parse("Add URL here..");
videoView.setVideoURI(uri);
videoView.requestFocus();
videoView.start();
}
}
Create file res/xml/network_security_config.xml
<?xml version="1.0" encoding="utf-8"?> <network-security-config> <base-config cleartextTrafficPermitted="true"> <trust-anchors> <certificates src="system" /> </trust-anchors> </base-config> </network-security-config>
New in the AndroidManifest.xml file under application:
android:networkSecurityConfig="@xml/network_security_config"
sudo apt update && upgrade
sudo apt-get install php
Install MySql and phpMyAdmin
sudo apt-get install mysql-server
mysql-client
Then install phpmyadmin
sudo apt-get install phpmyadmin -y
Then check phpmyadmin
The requested URL /phpmyadmin was not found on this server
sudo -H gedit /etc/apache2/apache2.conf
add following line to end of apache config file
Include /etc/phpmyadmin/apache.conf
Then restart apache:
/etc/init.d/apache2 restart
More details - https://askubuntu.com/questions/668734/the-requested-url-phpmyadmin-was-not-found-on-this-serverSolutions for Access Denied For User Localhost on Ubuntu Linux
How to change MySQL 'root' password
Hello Friends
Welcome back to android tutorials in this post we are going to earn about How to place a YouTube Video in Your android app.
Start new project in android studio.
Specify application name
To play Your YouTube video you need to the internet permission for the application
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
Place YouTube video in Your app You need to add YouTube API. Download and add library in Your project.
YouTube Android API (Click to Download)
Extract File
Now open libs folder
Copy jar files
Now open android studio
Open project view
Open app folder
Paste that jar file inside lib folder and right click then click Add As Library
To play YouTube video then create YouTube API Key.
Get the API key to submit application package name and SHA1 certificate fingerprint on google developer console.
Create new project
Go to credentials option and create API key
Copy this API key and to add java class in your android project
Go to Activity, then add Custom View select YouTube Player View and to add a Button text as Play
Then following these code
Config.Java
public class Config {
private static final String YOUTUBE_API_KEY = "Paste Your key....";
public static String getYoutubeApiKey() {
return YOUTUBE_API_KEY;
}
}
MainActivity.Java
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.google.android.youtube.player.YouTubeBaseActivity;
import com.google.android.youtube.player.YouTubeInitializationResult;
import com.google.android.youtube.player.YouTubePlayer;
import com.google.android.youtube.player.YouTubePlayerView;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends YouTubeBaseActivity {
YouTubePlayerView aYouTubePlayerView;
Button btnPlay;
YouTubePlayer.OnInitializedListener mOnInitializedListener;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnPlay = (Button) findViewById(R.id.btnPlay);
aYouTubePlayerView = (YouTubePlayerView) findViewById(R.id.youtubeplay);
mOnInitializedListener = new YouTubePlayer.OnInitializedListener() {
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) {
//Load video list
/* List<String> videoList = new ArrayList<>();
videoList.add("saIqHKolTHc");
videoList.add("ov8YX9tNyio");
youTubePlayer.loadVideos(videoList); */
//play list
//youTubePlayer.loadPlaylist("PLIFW--Hzc0hbgKs_ZIzMWnElNkHkpsmGP");
//play video
youTubePlayer.loadVideo("saIqHKolTHc");
}
@Override
public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {
}
};
btnPlay.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
aYouTubePlayerView.initialize(Config.getYoutubeApiKey(),mOnInitializedListener);
}
});
}
}
Thanks You