1.Create New Project
src
----------->drag and drop Webkit from Palette
----------------->drag and drop button and name it like go
------------------------>drag and drop Edit Text for web address
-------------------------------->create onclick method for button
2.Go to src file
src
-------------->create mecthod name from onclick
---------------->make Edit text link using find view by id
------------------->make webview link using find view by id
----------------------->enable java script and client options
coding:
private EditText edt;
private WebView web;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
edt=(EditText)findViewById(R.id.editText1);
web=(WebView)findViewById(R.id.webView1);
}
public void go(View v)
{
String s="https://" ;
String a=s+edt.getText().toString();
web.getSettings().setJavaScriptEnabled(true);
web.setWebViewClient(new WebViewClient());
web.loadUrl(a);
}
3.Add usesPermission in AndroidManifeast.xml
AndroidManifeast.xml
------------------------->add
------------------------------>usesPermission
----------------------------------->select Internet
--------------------------------------->Run your Project
(click the image)
Thankyou..........................!
Friday, 22 March 2013
SIMPLE VIDIO PLAYER
1.Create A New Project
Layout
--------------->Main_Activity
------------------>Drag and drop Button and Video View from Palette
---------------------->Make Button name Start and add onClickMethod
2.Add 3.gp into raw folder
res
----------------------->Right click res then create raw folder
---------------------------->Add 3.gp into raw
--------------------------------->src file
Click the image
coding:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
vid=(VideoView)findViewById(R.id.videoView1);
Uri uri=Uri.parse("android.resource://"+getPackageName()+"/"+R.raw.zz);
vid.setVideoURI(uri);
vid.setMediaController(new MediaController(this));
vid.requestFocus();
}
public void play(View v)
{
vid.start();
}
3.Run your Project
-------------------->Click start button then video will be play
-------------------------->Click Video then Videocontroller will be display
Thank you...........!
Layout
--------------->Main_Activity
------------------>Drag and drop Button and Video View from Palette
---------------------->Make Button name Start and add onClickMethod
2.Add 3.gp into raw folder
res
----------------------->Right click res then create raw folder
---------------------------->Add 3.gp into raw
--------------------------------->src file
Click the image
coding:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
vid=(VideoView)findViewById(R.id.videoView1);
Uri uri=Uri.parse("android.resource://"+getPackageName()+"/"+R.raw.zz);
vid.setVideoURI(uri);
vid.setMediaController(new MediaController(this));
vid.requestFocus();
}
public void play(View v)
{
vid.start();
}
3.Run your Project
-------------------->Click start button then video will be play
-------------------------->Click Video then Videocontroller will be display
Thank you...........!
SIMPLE AUDIO PLAYER
1.Create a new Project
Layout
--------------->Main_Activity.xml
------------------>Drag and Drop 3 image buttons from palette
--------------------->name it like play,pause,stop
------------------------>add onClick method names like play pause stop
2.Add mp3 file into raw folder
layout
--------------->right click layout
-------------------->New
----------------------->Folder ,(Name :raw)
-------------------------->type onclick method
-------------------------------->Create media player variable
(Click below image)
Run Your Project...............
Layout
--------------->Main_Activity.xml
------------------>Drag and Drop 3 image buttons from palette
--------------------->name it like play,pause,stop
------------------------>add onClick method names like play pause stop
2.Add mp3 file into raw folder
layout
--------------->right click layout
-------------------->New
----------------------->Folder ,(Name :raw)
-------------------------->type onclick method
-------------------------------->Create media player variable
(Click below image)
Run Your Project...............
Subscribe to:
Posts (Atom)