want to learn JAVA LOOK FOR MY NEW POST FOR LESSON A1 - G1 Android Development

Lately I have been learning alot of java(mostly public class ....) so I though that I could teach other people about java...
I need help from u to post how I could teach u guys. If u want me to make videos than ok I will(going to make videos with my g1 so might be boring) or I could post my lessons here on a post or at alldroid.org...
What every ur idea is just tell me, it could help.

vids with summarys and some sort of test....im learning right now lol

Cool.. no problem I would hate to type up my lessons... lol

videos pleeese

sample files
How about a sample file/s. Like start file and a completed file so we can see, besides the video what the end result should be.

JJbdoggg said:
videos pleeese
Click to expand...
Click to collapse
Yeah I agree with this!

I understand... it will basicly be like online schooling. For about a week I would teach u than test u on firdaqy on something. Please note that I will be recording from my g1 so their will be no editing done. I will give the worksheets to read and stuffs similar to that.

Can u do a favor, I have been waiting....
one simple Application, say it just says "Hello", from starting to till putting on G1 as .apk.
Can u plz do that??

Lol hey moshin! Can't wait for your guide. You know me haha

g1lol said:
Can u do a favor, I have been waiting....
one simple Application, say it just says "Hello", from starting to till putting on G1 as .apk.
Can u plz do that??
Click to expand...
Click to collapse
There are so many guides out there telling u how to do this. I created my first hello world app by searching " how to create app for g1 " on google and found a video guide that helped me. So just search and soon u will find it.

I know java, but I am just not quite sure about the android sdk and stuff so this would be cool

something to add
if anyone is interested, here is the code used to set the system to read/write in my app.
A few people may need this in their app so i hope it helps.
Code:
Button YES = (Button) findViewById(R.id.btnYES);
YES.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
Process process = null;
try {
process = Runtime.getRuntime().exec("su");
} catch (IOException e1) {
e1.printStackTrace();
}
DataOutputStream os = new DataOutputStream(process.getOutputStream());
try {
os.writeBytes("mount -o rw,remount -t yaffs2 /dev/block/mtdblock03 /system \n");
} catch (IOException e) {
e.printStackTrace();
}
try {
os.writeBytes("exit\n");
} catch (IOException e) {
e.printStackTrace();
}
try {
os.flush();
} catch (IOException e) {
e.printStackTrace();
}
Could probably be done much easier, but hey, it works for me
I'm a complete novice at java, but executing SU commands was the thing i struggled with the most.
Great idea for a thread btw!!
EDIT: btw, if anyone knows of an easier way of doing this, please let me know

i think this could eventually be included in one of the stickies above!?? hope it carries on!!

I agree

We will start with " public class "... I will teach about the syntext errors and stuff like that.
By the way, before we start I want everyone to download bluejay(free software)....
The website is bluej.org
Eclispe is to complecated... so stay with bluej
RECOMMENDED FOR CLASS IS BLUEJ (site listed above)

I'll help eventually, need to brush up on my java (last I used was java 1.2 about 8 years ago!). I myself am looking to create a scrolling cursor view that mimics the behavior of the activity selector tab in the Hero rom so that I can implement that in a new project I'm making (only missing that part!).

Meltus said:
EDIT: btw, if anyone knows of an easier way of doing this, please let me know
Click to expand...
Click to collapse
Not an easier way, but better code would have been to do this:
Code:
Button YES = (Button) findViewById(R.id.btnYES);
YES.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
try {
Process process = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(process.getOutputStream());
os.writeBytes("mount -o rw,remount -t yaffs2 /dev/block/mtdblock03 /system \n");
os.writeBytes("exit\n");
os.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
You don't need to surround each individual line with a try-catch. The reason you print the stack trace is so that you can trace the call stack and find out where the error came from, so you can put all of your code inside the try. You can even have multiple catches on a singe try for different errors (in case you didn't know).
If you go putting a try on every line that could throw an exception you are going to end up with long, bloated and unreadable code. You will also frquently run into scoping errors, which it looks like your 'process' and 'os' variables did here.

mohsinkhan47 said:
We will start with " public class "... I will teach about the syntext errors and stuff like that.
By the way, before we start I want everyone to download bluejay(free software)....
The website is bluej.org
Eclispe is to complecated... so stay with bluej
RECOMMENDED FOR CLASS IS BLUEJ (site listed above)
Click to expand...
Click to collapse
why not use notepad ++? use it along with jdk and you can compile right from the editor.
---edit---
Oh, I see, it's a nice training IDE. I guess it's better for a begginer.

really looking forward to this, been wanting to work on customizing android within the sdk, possiblly a better launcher

This is kind of thread that I've been waiting for. Thanks for starting this.

Related

Wanting to develop for WM haivng some problems

Hi I want to make an application using location, I found this tutorial
http://msdn.microsoft.com/en-us/library/dd938890.aspx#RetrievingLocationInformationthroughGPS
which looks very helpful but because I am new to visual studio I am having some problems.
1) is the article it says "This article includes complete sample code." but I cant find a download for all the code.
2) he only mentions referencing Microsoft.WindowsMobile.Samples.Location.dll which I have done but the class LatLong is still unknown
3) I made a sample program without the LatLong class just to experiment I get the following error on my device
"Microsoft.WindowsMobile.Samples.Location, Version=1.0.3448.25673, Culture=neutral, PublicKeyToken=null, or one of its dependencies, was not found
any idea what this means?
4) Could all my problems be because I am using visual studio 2005 and not 2008? I found a code project that looked really helpful but when trying to open it it says that it cant because it is from a newer version of the software, anything that can be done?
5) I find MSDN confusing for finding out what to reference to add a class for example this is the page for the LatLong class http://msdn.microsoft.com/en-us/library/cc514548.aspx
with the java online info the first thing you always see is where the class is found but it seems to be missing for this class. Other basig classes appear similar to java.
below is my sample code its basically taken from the article but I have commented out the references to LatLong and put in checks instead
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.WindowsMobile.Samples.Location;
namespace DeviceApplication3
{
public partial class Form1 : Form
{
private Gps gps;
int count = 0;
public Form1()
{
InitializeComponent();
gps = new Gps();
gps.Open();
}
private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = (getGpsString());
}
private string getGpsString()
{
GpsPosition position = gps.GetPosition();
/*LatLong location = new LatLong();
if (position.LatitudeValid)
location.Latitude = position.Latitude;
if (position.LongitudeValid)
location.Longitude = position.Longitude;
if (position.HeadingValid)
location.Heading = position.Heading;*/
StringBuilder sb = new StringBuilder();
sb.Append("\n");
sb.Append("Latitude = ");
if (position.LatitudeValid)
{
sb.Append(position.Latitude.ToString() + "\n");
}
else
{
sb.Append("Not found yet\n");
}
sb.Append("Longitude = ");
if (position.LongitudeValid)
{
sb.Append(position.Longitude.ToString() + "\n");
}
else
{
sb.Append("Not found yet\n");
}
sb.Append("Heading = ");
if (position.HeadingValid)
{
sb.Append(position.Heading.ToString() + "\n");
}
else
{
sb.Append("Not found yet\n");
}
return sb.ToString();
}
}
}
Microsoft.WindowsMobile.Samples.Location.dll
is this file located in bin\debug and or \bin\release
?
and does it only give runtime errors or also compile time ?
no it compiles fine, can you see anything wrong with my code? The weird thing is the form comes up using the emulator but not on the device. Could it be because I have a custom rom that seems to have compact framework 3.5? I would assume it would be back compatible?
How have you deployed it to the device? Have you copied the .exe and the Location.dll?
one thing you could also test was if you could disable the stuff in the gps
and just run a program without it to verify that it's not missing net3.5's fault
heliosdev said:
How have you deployed it to the device? Have you copied the .exe and the Location.dll?
Click to expand...
Click to collapse
Hi thanks for this I didnt copy over the dll I'm very silly.
So what do you guys think about loading projects ment for vs 2008 in 2005 is this impossible ? or can i convert them somehow?
sure it's only the project and solution files which differ
add the cs files manualy and it should work fine
Use the same name to create the new project in vs2005 to have the same namespace.
You'll have to do some manual changes if the code uses c#3.0 .net 3.5 features.
Thanks guys your awesome,
very random and off topic but since your programming kings ill ask anyway,
I think I want to eventually work in the gaming industry, I'm close(3months) to finishing my MSc CompSci conversion course and I am looking for jobs, its quite aparent that most games companys don't want unexperienced people so do you guys have any ideas of places to apply for that will give the the necessary experience? btw I have no taught experience with C++ which I think is my biggest dissadvantage, I do know C and java quite well though and as you can tell just starting to play with C#.
your help is always appreciated.
well, continue with general programming (object oriented programming, ui development, database, network,...). There are so many different fields in software development!
For example take a look at the chapters of the books in the game programming gems series to see what (not only) gaming companies are working on. In general for beginning there is a lot of information online where you'll find tons of tutorials.
Try to get a profound base in programming.
Starting with your gps application, develop a gui, save/load the positions (database), visualize the points...
heliosdev said:
well, continue with general programming (object oriented programming, ui development, database, network,...). There are so many different fields in software development!
For example take a look at the chapters of the books in the game programming gems series to see what (not only) gaming companies are working on. In general for beginning there is a lot of information online where you'll find tons of tutorials.
Try to get a profound base in programming.
Starting with your gps application, develop a gui, save/load the positions (database), visualize the points...
Click to expand...
Click to collapse
Hi sorry for the late reply I upgraded to windows 7 last night to try and improve my rubbish laptop, seems to be a bit better btw,
anyway just want to say thanks for the advice. also my app will use google maps yahoo zonetag and windows live earth (or bing maps if thats what there calling it now) I think for some of thoes services I will need to pay to realease my app to the public even if its free but what about testers would I be able to give it to say 10 people?

[SDK]HD2MultitouchSDK

Beta-Version is out!!
Multitouch for everyone!!!!
HD2Multitouch is for all who want to support multitouch on the HD2 in their apps like the Album-App does.
This is the really first version, so don't expect a perfect solution....
And it's free, so start developing....
Getting started:
Code:
public YourForm()
{
InitializeComponent();
bool doRestart;
multitouch = Multitouch.GetMultitouch(this, out doRestart);
if (doRestart)
{
MessageBox.Show("To activate the multitouch, the app will perform a restert now.", "Multitouch", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
Multitouch.PerformSoftReset();
this.Close();
return;
}
if (multitouch == null)
{
MessageBox.Show("Failed to initialize the multitouch.", "MultitouchDemo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
this.Close();
return;
}
multitouch.TouchDown += new EventHandler<MultitouchEventArgs>(multitouch_TouchDown);
multitouch.TouchUp += new EventHandler<MultitouchEventArgs>(multitouch_TouchUp);
multitouch.TouchMove += new EventHandler<MultitouchEventArgs>(multitouch_TouchMove);
multitouch.EnableEvents = true;
}
Please note (if you download the app you agree!):
The SDK is provided 'as is'
The developer does NOT give any warranty of any kind and can't be held for any damage or loss caused directly or indirectly by the SDK (just in case)
The developer does NOT guarantee any kind of support (but I'll try to help everyone )
You're not allowed to develope commercial apps with this sdk. Your app and the sdk MUST be sold free. For commercial prjects contact the developer.
You are not allowed to disassemble the SDK or reverse engineer it.
you are not allowed to post the attachement(s) below to any other website. you can always link to this tread.
If you are going to use it in your application, you MUST put a link in your application/offical website that reffers to this XDA thread.
The developer reserves the right to make this a paid SDK at any point of time.
The developer reserves the right to relocate this SDK to another website or even take it offline.
Reserved for futere posts...
Reserved. (the last one)
hi Dude...i am a very newbies for this and i own a hd2...
i had download the file and now how i suppost to do? where i should i put the file??
Thanks...
sorry for a stupid question...
Hey
I'm not sure what you're trying to get. The file you downloaded is a sdk (which means software development kit), so it's meant to use it in your own project, but if you aren't a developer, there's no need for the sdk on your hd2...
Cheers

[Q] web app

Hello,
I dont know if the title fits, so i gonna explain my Problem.
I want to Programm a Game With User Login. Sadly wp7 doesnt Support SQL api, so i cant make the User Management directly over sql.
So i got a Website with a working Login Formular. I want to link the wp7 textboxes with the textboxes of the Website which works with SQL.
Is there a simple way to get this working? Or does anyone have a better idea to get my User Management working?
Greatings win99
Sent from my HD2 using Board Express
Hmm... I can only suggest you to learn how to do http requests (and general programming of course). I hope u'll stop thinking in terms like "linking textboxes"
yeah, "linking" is maybe the wrong word
What exactly do you mean with "http request"?
I can program a bit html an php, which i could include in a "WebBrowser" control. This way i could use php with mysql, but i don't want to make a browser game.
Is there somethink like a "http database"? Cause i don't know yet any database based on http. And is there an API availible to do this requests from a panorama app?
Sorry for this basicly questions, but i'm just a hobby programmer and since now i just programme windows desktop projects, where i could easily use SQL.
Your "very basic question" requires a very long answer (sorry, but I don't have enough time. Also, I'm not an expert in SQL http communication). FYI, all communications between web page (and you can treat your WP7 page as a web page) and SQL server based on HTTP POST requests (but of course not on "linked textboxes"! ). So, try to google with words such as "WP7 SQL HTTP POST" - first five links possible will have all info you need (but you should understand "how everything works" first!)
ok, if i understand it correctly, this sound like instead of using "app<->SQL" i should use "appy<->http<->sql".
i will try to find some good tutorials and reply on success/ no success.
win98 said:
ok, if i understand it correctly, this sound like instead of using "app<->SQL" i should use "appy<->http<->sql".
i will try to find some good tutorials and reply on success/ no success.
Click to expand...
Click to collapse
Well, from the sounds of it, I am going to assume you networking and web API knowledge and maybe decent enough MySQL/SQL/Database knowledge, and possibly somewhat new to WP7 C#.NET (Don't take this personal or a lashing towards you, not the case, I mention it so I can be basic and to the point without assuming you know what references I make or offend you).
If you want an "out-of-the-box" easy solution, let's stop and go download RestSharp (http://restsharp.org). After you get it, visit: https://github.com/restsharp/RestSharp/wiki/Getting-Started, as this will give you a great example of HOWTO use this solution.
You also need to remember about the footprint, a 90MB limit (Max) on 256MB phones. Too big can cause some issues.
Also, another good option is SQLlite, probably one of the most popular, straight forward and well respected (I even use it on some projects). Should you choose to use it, go to http://sviluppomobile.blogspot.com/2010/07/wp7-sqliteclient-preview.html and read his Blog post, VERY informative and a Sample available for you to learn from as well.
If you really wanted to do this yourself, you could create an HTML page and do all your coding in it (e.g. Login Box) and use JavaScript as well, this way you grab the contents from your textbox(s) and send to the embedded web browser you load the HTML page in, hence scripting is available for WP7 but must enable scripting support and highly recommend to use IsolatedStorage and can invoke JS just as easy as:
window.external.notify("(Task)Param)");
So this should hopefully get you to where you want to be but if any of the above statement I made was true, I recommend out-of-the-box solutions for you.
Thanks,
Lance
lseidman said:
If you really wanted to do this yourself, you could create an HTML page and do all your coding in it (e.g. Login Box) and use JavaScript as well, this way you grab the contents from your textbox(s) and send to the embedded web browser you load the HTML page in, hence scripting is available for WP7 but must enable scripting support and highly recommend to use IsolatedStorage and can invoke JS just as easy as:
window.external.notify("(Task)Param)");
Click to expand...
Click to collapse
This is the way i planned to do it. How do you call it? For me it is hard to find a tutorial or book or something like that, cause i don't know which keyword to google
thanks anyway
win98 said:
This is the way i planned to do it. How do you call it? For me it is hard to find a tutorial or book or something like that, cause i don't know which keyword to google
thanks anyway
Click to expand...
Click to collapse
First and foremost, I appreciate your honesty which is why I will basically show you the way...
Well, if you wish to invoke JavaScript via WP7 you can, like below:
1). Open your Mainpage.xaml and find the grid and insert:
<phone:WebBrowser HorizontalAlignment="Left" Name="webBrowser1" VerticalAlignment="Top" Height="xxx" Width="xxx" IsScriptEnabled="True" ScriptNotify="webBrowser_callback" />
2). Make an HTML page, go in the HEADER section and type something like: "<SCRIPT LANGUAGE="JavaScript" src="HelloWorld.js"></SCRIPT>" and add a button that has a function to fire upon clicking + name the section like:
<h1 id='myName'>Hello World!</h1>
<form>
<input id="button" type="button" class="button-standard" style="width:200;height:100" value="Hello World!" onClick="HelloWorld()"/>
* Remove the Quotes from above...
3). Make a file called HelloWorld.js and put in something like:
function HelloWorld() {
window.external.Notify("Name");
}
function sets(val) {
document.getElementById('myName').innerHTML = val;
}
4). In your Mainpage.xaml.cs, find where you want to invoke the script/site and put in:
webBrowser1.Navigate(new Uri("http://lance.compulsivetech.biz/login", UriKind.Relative));
*Change the URI to your address, not my blog's fake login...
5). Since we are loading the site locally in Isolated Storage, go forth and type this in:
private void CreateDirOnStore(string strDir)
{
// Create a directory for local storeage.
IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication();
if (!isoStore.DirectoryExists(strDir))
isoStore.CreateDirectory(strDir);
}
private void SaveFileToIsoStore(string strFileName)
{
// This will save the file to the isolated storage based on the string provided.
IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication();
//remove the file if exists to allow each run to independently write to
// the Isolated Storage
if (isoStore.FileExists(strFileName) == true)
{
isoStore.DeleteFile(strFileName);
}
StreamResourceInfo sr = Application.GetResourceStream(new Uri(strFileName, UriKind.Relative));
using (BinaryReader br = new BinaryReader(sr.Stream))
{
byte[] data = br.ReadBytes((int)sr.Stream.Length);
//save file to Isolated Storage
using (BinaryWriter bw = new BinaryWriter(isoStore.CreateFile(strFileName)))
{
bw.Write(data);
bw.Close();
}
}
}
6). In your public MainPage() put:
this.Loaded += new RoutedEventHandler(Load_WebPage);
* Always put stuff after your Intialize call
7). We need to make a page load function as below (in xaml.cs):
void Load_WebPage(object sender, RoutedEventArgs e)
{
//Set the start folder of the widget and navigate to the start page
CreateDirOnStore("helloworld");
SaveFileToIsoStore("helloworld/index.html");
SaveFileToIsoStore("helloworld/helloworld.js");
webBrowser1.Base = "helloworld";
webBrowser1.Navigate(new Uri("index.html", UriKind.Relative));
}
8). Now we invoke the function as seen below:
void webBrowser_callback(object sender, NotifyEventArgs e)
{
//Use invokeScript to give to the web env.
webBrowser1.InvokeScript("eval", new string[] { "sets('txtName.Text')"});
}
Hope this helps, this is basically off the top of my head but should be pretty close to being right and Mango Compat.
Creating a WCF services that calls SQL will be the quickest way...about 30 minutes.

[Q] [android][development]how to record a call in android

Hi, this is my first thread, I want to record a call in my app.
Can anyone help me with this task?
I have some code, but the file created by de recorder is empty.
Thanks!
some help
can anyone help me?, please!
first of all what's the phone you have and what's android version you use? i know that call record possible only from 2.3.3 and not on all kernels
I'd like to know this too
I use the one of the bigest russian sites 4PDA, and see that you need custom kernel with recording option: that you can to use aftermarket app. http://forum.xda-developers.com/showthread.php?t=488475
well, the thing is I need to make a recording app, but the code get stack in the record state, like a loop, and the activity don't refresh
it's a dev problem. if anyone have some code of info, post it please!
thanks a lot!
need a brainstorm or a good teacher
last chance to this thread...
some android dev to help me?
Although it might be a problem with your code at the moment, it ultimatively is a problem with the kernel.
The android api natively allows you to use i.e. a MediaRecorder and just select the call as source.
BUT on most kernels it doesn't work because it is intentionally crippled by the manufactor to avoid legal problems.
That being said, how can anyone help you with your code, if you don't show it.
I use a good aplication to record all the calls in my android phone. The aplication is CallRecorder 1.0.43 alpha. It's perfect for me in my hd2 with a TBD 3.5 room. In a other sites i see another version 1.1.5 trial, but i don't wannna change the things working good.
Dark3n said:
Although it might be a problem with your code at the moment, it ultimatively is a problem with the kernel.
The android api natively allows you to use i.e. a MediaRecorder and just select the call as source.
BUT on most kernels it doesn't work because it is intentionally crippled by the manufactor to avoid legal problems.
That being said, how can anyone help you with your code, if you don't show it.
Click to expand...
Click to collapse
U r right Dark3n...here is...
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this._fileTrace = new FileTraceListener();
try {
File myNewFolder = new File(REPOSITORY + "/logs/");
if (!myNewFolder.exists())
myNewFolder.mkdirs();
this._logFileName = "/calldate" + sdf.format(c1.getTime()) + ".log";
this._fileTrace.open(myNewFolder.toString() + _logFileName);
} catch (Exception exc) {
exc.printStackTrace();
this._fileTrace.close();
this._fileTrace = null;
}
}
protected void onResume() {
super.onResume();
setContentView(R.layout.testcallactivity);
try {
_CurrTelephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
} catch (Exception exc) {
exc.printStackTrace();
}
phoneListener = new PhoneStateListener() {
public void onCallStateChanged(int state, String incomingNumber) {
switch (state) {
case TelephonyManager.CALL_STATE_IDLE:
if (call) { //call is a boolean
recorder.stop();
recorder.release();
}
break;
case TelephonyManager.CALL_STATE_OFFHOOK:
call = true; recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL); recorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile(REPOSITORY + "/calls/audio.3gp");
recorder.setMaxDuration(30000);
try {
recorder.prepare();
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
recorder.start();
break;
case TelephonyManager.CALL_STATE_RINGING:
if (call) {
recorder.stop();
recorder.release();
}
break;
}
}
};
_CurrTelephonyManager.listen(phoneListener,
PhoneStateListener.LISTEN_CALL_STATE);
}
Thanks!
Well yeah... No...
Post here, post link
https://gist.github.com/
Dark3n said:
Well yeah... No...
Post here, post link
https://gist.github.com/
Click to expand...
Click to collapse
great web...
https://gist.github.com/1829663
thankz again!
Took a quick glance.
Looks okay, most likely what i already mentioned.
Code:
recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
Your kernel has the VOICE_CALL crippled. You will need an uncrippled one for your device.
Dark3n said:
Took a quick glance.
Looks okay, most likely what i already mentioned.
Code:
recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
Your kernel has the VOICE_CALL crippled. You will need an uncrippled one for your device.
Click to expand...
Click to collapse
this is the problem?
the statement recorder.play() stock becuase the kernel has the VOICE_CALL crippled, I try it in the AVD from Android SDK, you know if I can chance something to probe my code?
At the moment I try to change VOICE_CALL to MIC and post again whit the result
Thanks again men!
Well, I probe with MIC and DEFAULT, but the application still block in the recorder.start()
I'm going INSANE!!! LOL!
well, even if I made a simply record app, the statement recorder.start() still block my app.
some tips to this crazy bug?

Where should my thread go?

So, this is basically a question about where i should best find my solution in this forum, im making an app (just for learning purposes) and wanted to know where i should post about that question as well. This app should only open a website in WebView, and i got that far, now i want to announce something on the website that is excluded with some CSS maybe display: none; for example.
How do i do that? I have been looking for a way to modify the CSS (This announcement is all about the app) contained in a div with a class and an id to make it easier to make that connection. (I own the website and got full control over the files on the server side.)
Bare with me, this is the first time developing anything for android ^^ Thanks!
EDIT: Just because i wrote here i found something interesting in this subject, unfortunatly it's getting late here so ill have to come back tomorrow morning an fill you in. ^^ any suggestions are still appreciated.
So i found this:
public class MyWebClient extends WebViewClient {
@override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
@override
public void onPageFinished(WebView view, String url) {
view.loadUrl("document.getElementsByClassName('someClass').style.display = 'none'");
}
}
.........
final MyWebClient myWebViewClient = new MyWebClient();
mWebView.setWebViewClient(myWebViewClient);
to probably do what i asked for. any suggestions?

Categories

Resources