Google Confirms “Android Lollipop Day” for November 3rd

A little over a week ago, Google announced the latest iteration of … more

Get Your XDA 2015 Custom Avatar and Signature Images Here

As stated in our motto, XDA Developer is for developers, by developers. The … more

Pin Your Photos on Android Lollipop with Photo Pinner

In the last few weeks,we have been talking quite a bit about Android 5.0 Lollipop. This … more

Samsung Galaxy Note Edge Hands On – XDA TV

Perhaps one of the more peculiar announcements this year was the curved edge-screened … more
Post Reply

App development

OP vinodmadhu6

3rd April 2014, 05:38 AM   |  #1  
OP Junior Member
Thanks Meter: 0
 
12 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, 12:00 AM   |  #2  
Archer's Avatar
Senior Moderator / Recognized Developer - (Un)Recognized Pole Dancer
Flag Northampton
Thanks Meter: 4,097
 
10
13,868 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, 03:16 AM   |  #3  
MattMatt0240's Avatar
Senior Member
Thanks Meter: 104
 
240 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, 05:13 AM   |  #4  
OP Junior Member
Thanks Meter: 0
 
12 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, 12: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, 04:22 AM   |  #6  
MattMatt0240's Avatar
Senior Member
Thanks Meter: 104
 
240 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 04:25 AM.
13th April 2014, 10: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, 04:14 AM   |  #8  
OP Junior Member
Thanks Meter: 0
 
12 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


Top Threads in Java for Android App Development by ThreadRank