Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,807,797 Members 51,557 Now Online
XDA Developers Android and Mobile Development Forum

App development

Tip us?
 
vinodmadhu6
Old
#1  
Junior Member - OP
Thanks Meter 0
Posts: 10
Join Date: Dec 2012
Phone App development

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.
 
Archer
Old
#2  
Archer's Avatar
Senior Moderator / Recognized Developer - (Un)Recognized Pole Dancer
Thanks Meter 4,026
Posts: 13,771
Join Date: Jul 2008
Location: Northampton
Quote:
Originally Posted by vinodmadhu6 View Post
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.
.
"I live by my own rules, nobody else's, not even my own."
.
My xda links

New User Guide | XDA Forum Rules | 10 Posts - Why and How? | Admins & Mods | My xda Bookmarks

.

.
 
MattMatt0240
Old
#3  
MattMatt0240's Avatar
Senior Member
Thanks Meter 99
Posts: 225
Join Date: Sep 2011
Info 2 Very Easy

Quote:
Originally Posted by vinodmadhu6 View Post
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
Root it and boot it!

Samsung Galaxy Note 3 | PAC-ROM

Retired phones: Epic Touch 4G| Evo shift 4g | Evo 4g
The Following User Says Thank You to MattMatt0240 For This Useful Post: [ Click to Expand ]
 
vinodmadhu6
Old
#4  
Junior Member - OP
Thanks Meter 0
Posts: 10
Join Date: 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>
 
bluesc0rp
Old
#5  
Junior Member
Thanks Meter 0
Posts: 5
Join Date: Apr 2014
Default 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
 
MattMatt0240
Old
(Last edited by MattMatt0240; 9th April 2014 at 04:25 AM.)
#6  
MattMatt0240's Avatar
Senior Member
Thanks Meter 99
Posts: 225
Join Date: Sep 2011
Quote:
Originally Posted by vinodmadhu6 View Post
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
Root it and boot it!

Samsung Galaxy Note 3 | PAC-ROM

Retired phones: Epic Touch 4G| Evo shift 4g | Evo 4g
 
ks@ace
Old
#7  
Junior Member
Thanks Meter 1
Posts: 12
Join Date: 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: [ Click to Expand ]
 
vinodmadhu6
Old
#8  
Junior Member - OP
Thanks Meter 0
Posts: 10
Join Date: Dec 2012
Yeah i am a newbie , Can any one please provide some links for starting with basics

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes