Enable Call Recording on Xperia Z2 and Z3

Call recording, while not legal in every part of the world, is quite handy in certain situations. … more

Google Play Store Payments Available in China

Google has taken a big step to make its services accessible globally. Since the introduction of … more

How to Set a Video as Your Boot Animation

If you wish to make your phone truly unique, you may want to consider adding a nice boot animation. … more

TWRP for Nexus 6 and 9 Available, Unofficial CM12 Alpha for HTC Explorer! – XDA TV

Team Win Recovery Project for the Nexus 6 and Nexus … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

App development

OP vinodmadhu6

3rd April 2014, 06:38 AM   |  #1  
OP Junior Member
Thanks Meter: 0
 
14 posts
Join Date:Joined: Dec 2012
Hello Guys,
I want to develop a app which will display a simple html page, i new to andriod coding , so please help me out in developing this app

Requirement : when i open my app it will just display a HTML page .
actually i want to stream my raspberrypi video from this page .
i am able to do that via browser and wanted to build a coustm app for the same.



P.S sorry about the language.
4th April 2014, 01:00 AM   |  #2  
Archer's Avatar
Senior Moderator / Recognized Developer - (Un)Recognized Pole Dancer
Flag Northampton
Thanks Meter: 4,107
 
10
13,899 posts
Join Date:Joined: Jul 2008
More
Quote:
Originally Posted by vinodmadhu6

Hello Guys,
I want to develop a app which will display a simple html page, i new to andriod coding , so please help me out in developing this app

Requirement : when i open my app it will just display a HTML page .
actually i want to stream my raspberrypi video from this page .
i am able to do that via browser and wanted to build a coustm app for the same.



P.S sorry about the language.

You can go many routes to do this - Java and a WebView would be the most obvious way, but it may be easier to look at using Cordova or Phonegap as it's a lot easier to pick up if you have any existing web skills.
5th April 2014, 04:16 AM   |  #3  
MattMatt0240's Avatar
Senior Member
Thanks Meter: 105
 
244 posts
Join Date:Joined: Sep 2011
More
Info 2 Very Easy
Quote:
Originally Posted by vinodmadhu6

Hello Guys,
I want to develop a app which will display a simple html page, i new to andriod coding , so please help me out in developing this app

Requirement : when i open my app it will just display a HTML page .
actually i want to stream my raspberrypi video from this page .
i am able to do that via browser and wanted to build a coustm app for the same.



P.S sorry about the language.

To simply load and display a webpage, add this Activity to your code:

WebpageActivity.java
Code:
public class WebpageActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.my_webpage);

		WebView wv = (WebView) findViewById(R.id.my_webview);
                wv.getSettings().setJavaScriptEnabled(true);
		wv.loadUrl("http://www.mywebpage.com");

	}

}
my_webpage.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <WebView
        android:id="@+id/my_webview"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</RelativeLayout>
Add permissions to manifest.xml
Quote:

<uses-permission android:name="android.permission.INTERNET" />

As for streaming a video, you may need to use JavaScript. I do not have much experience with web, but this should get you started in the right direction
The Following User Says Thank You to MattMatt0240 For This Useful Post: [ View ]
8th April 2014, 06:13 AM   |  #4  
OP Junior Member
Thanks Meter: 0
 
14 posts
Join Date:Joined: Dec 2012
my_webpage cannot be resolved or is not a field
I am unable to resolve this error

Main activity.java
Code:
  package com.example.xda;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.webkit.WebView;

public class MainActivity extends Activity {

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

	
	
	
	public class WebpageActivity extends Activity {

		@Override
		protected void onCreate(Bundle savedInstanceState) {
			super.onCreate(savedInstanceState);

			setContentView(R.layout.my_webpage);

			WebView wv = (WebView) findViewById(R.id.my_webview);
	                wv.getSettings().setJavaScriptEnabled(true);
			wv.loadUrl("http://www.mywebpage.com");

		}

	}
	
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}

Activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<WebView
android:id="@+id/my_webview"
android:layout_width="match_parent"
android:layout_height="match_parent" />

</RelativeLayout>
8th April 2014, 01:13 PM   |  #5  
Junior Member
Thanks Meter: 0
 
5 posts
Join Date:Joined: Apr 2014
Game Development
Hello


I want to integrade amazon game cricle and amazon ads with google ads for my game
tried all the tutorials

there is not error with google skd but when i add the amazon sdk it start giving errors
9th April 2014, 05:22 AM   |  #6  
MattMatt0240's Avatar
Senior Member
Thanks Meter: 105
 
244 posts
Join Date:Joined: Sep 2011
More
Quote:
Originally Posted by vinodmadhu6

my_webpage cannot be resolved or is not a field
I am unable to resolve this error

Main activity.java

Code:
  package com.example.xda;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.webkit.WebView;

public class MainActivity extends Activity {

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




public class WebpageActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.my_webpage);

WebView wv = (WebView) findViewById(R.id.my_webview);
                wv.getSettings().setJavaScriptEnabled(true);
wv.loadUrl("http://www.mywebpage.com");

}

}


@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

}

Activity_main.xml





I'm sorry, there was some miscommunication...

You need to find your webView by Id in xml. Then set the data for it to load. Do this in your onCreate method of your Activity. I was showing an example of what your whole class could look like, not add my example to existing code. Sorry for misunderstanding.

Ex:
Code:
  package com.example.xda;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.webkit.WebView;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// find webview by Id in xml
WebView myWebView = (WebView) findViewById(R.id.your_webview_here);

// if you are going to use JavaScript, set enabled in webview
myWebView.getSettings().setJavaScriptEnabled(true);

//then specify data for webview to load
myWebView.loadUrl("http://www.xda-developers.com");
}
Do not add this to existing code. This is an example of an Activity to load data in webview.

I hope this clarifies our misunderstanding, good luck to you and happy coding!

Noted to self thrice via tapatalk
Last edited by MattMatt0240; 9th April 2014 at 05:25 AM.
13th April 2014, 11:36 AM   |  #7  
Junior Member
Thanks Meter: 1
 
13 posts
Join Date:Joined: Mar 2014
It seems like you are totally new to the android framework. It would be good if you can read up on the basics and familiarize yourself on the basics before pasting code snippets into your project.
The Following User Says Thank You to ks@ace For This Useful Post: [ View ]
24th April 2014, 05:14 AM   |  #8  
OP Junior Member
Thanks Meter: 0
 
14 posts
Join Date:Joined: Dec 2012
Yeah i am a newbie , Can any one please provide some links for starting with basics

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes