i need your help, i have a project for a game just need help from you guys.
I want to pack several pictures on top of each other so that I can swipe up / down how does it work on insta?
I guess the best solution is to use a WebView, because it is “swipe-able”.
See an example here. Instead of a page on the web, you refer a local one.
I mean Like this https://youtu.be/Ci5146VOyg4 only high
Have you tried the WebView but with instead of Google the Instagram address?
yes, but I don’t want to see an Instagram page, just not the pictures😂
That’s why I said, make your own local local page with pictures on top of each other and voila.
without using Instagram this was just an example
Yes, use some web editor app, make a new page and put the pictures you want and you’r done.
can you show me an example
Tomorrow I’ll post one. It’s late here. Good night.
Thanks and good nicht👍🏻
@noel can you pleased Help me now or No Time?
I’m at work at the moment.
As soon as I get home I will try.
Thank you
Try the following code.
You have to make a web page with images.
You can do this by copying the following to a text editor and save it with the extension .html (myPage.html) You have of course to change the name and size of the images and website accordingly to yours.
Save all the images + the web page in the sketch data folder.
<!DOCTYPE html>
<html>
<head>
<title>HTML img Tag</title>
</head>
<body>
<img src="image1.png" alt="Image name" width="400"
height="480">
<br>
<img src="image2.png" alt="Image name" width="400"
height="480">
<br>
<img src="image3.png" alt="Image name" width="400"
height="480">
<br>
<img src="image4.png" alt="Image name" width="400"
height="480">
<br>
<img src="image5.png" alt="Image name" width="400"
height="480">
<br>
<img src="image6.png" alt="Image name" width="400"
height="480">
</body>
</html>
Do not forget to give the internet permission!
import android.webkit.WebViewClient;
import android.view.ViewGroup.LayoutParams;
import android.webkit.WebView;
import android.view.ViewGroup;
import android.app.Activity;
import android.widget.RelativeLayout;
import android.widget.FrameLayout;
import processing.android.CompatUtils;
import android.view.View;
FrameLayout fl;
Activity act;
WebView web;
WebViewClient wbc;
int webId;
boolean toggle;
public void onStart() {
super.onStart();
act = this.getActivity();
wbc = new WebViewClient();
web = new WebView(act);
web.setLayoutParams(new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT));
web.setY(60);
web.setWebViewClient(wbc);
web.getSettings().setJavaScriptEnabled(true);
web.loadUrl("file:///android_asset/new1.html");
webId = CompatUtils.getUniqueViewId();
web.setId(webId);
//web.setVisibility(View.GONE);
fl = (FrameLayout)act.getWindow().getDecorView().getRootView();
fl.addView(web);
}
void setup() {
background(0, 0, 100);
fullScreen();
textAlign(CENTER);
textSize(40);
fill(255);
text("Click to open/close WebView", width/2, 45);
}
void draw() {
}
void mousePressed() {
if (mouseY < 60) {
act.runOnUiThread(
new Runnable() {
public void run() {
WebView wv = (WebView)act.findViewById(webId);
if (toggle) {
wv.setVisibility(View.VISIBLE);
} else {
wv.setVisibility(View.GONE);
}
}
}
);
toggle =! toggle;
}
}
Who wrote that line "Internal storage/Sketchbook/…etc ?
It has to be web.loadUrl(“file:///android_asset/new1.html”);
Where you only change the file name “new1.html” to what you are using. (Site.html I believe)
This address points to the data folder in your sketch.
I also see that you are using small images. (icons?)
So maybe what you want is just one image that you can slide from the top to the bottom to click and choose player types or something. Thus no scrolling needed like Instagram.
I now also see, that you are using APDE’s preview mode. When you are using certain permissions like INTERNET (setting in the menu properties), you need to use the App mode, otherwise it won’t find the web page.
Omg xd haha thank you
But is this what you need?