Android Routes library is easy way to use android Intent
Add this in your root build.gradle
file (not your module build.gradle
file):
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
Add this to your module's build.gradle
file (make sure the version matches the JitPack badge above):
dependencies {
...
implementation 'com.github.moh-abdullah-it:android-routes:0.1.2.0'
}
- Create your Route Class
public class Route extends BaseRoute {
public Route(Context context) {
super(context);
}
/*
* write routes hear
*/
....
}
- add routes to
Route.java
example:
public Route mainActivity() {
to(MainActivity.class);
return this;
}
- in any place from your project can use route
Route route;
route = new Route(this);
route.mainActivity().start();
- withData:
route.mainActivity()
.withData("id",10)
.withData("title","activity title")
.start();
- check condition before start:
route.mainActivity()
.withData("id",10)
.withData("title","activity title")
.start(your condition here);
- start route on click view:
route.mainActivity()
.startOnClick(view);
- check route has data:
if(route.has("id")){
//this is true
}
- get data from route:
Int id = route.getInt("id");
String title = route.getString("title");
- call phone number:
route.call("phone number").start()
- browse url:
route.url("your url").start()
- shear text and url:
route.shareTextUrl("title","url").start()
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.