Skip to content

Instantly share code, notes, and snippets.

@the-jedi-droid
Created September 14, 2015 02:43
Show Gist options
  • Save the-jedi-droid/75d1f6a4a62e48c55193 to your computer and use it in GitHub Desktop.
Save the-jedi-droid/75d1f6a4a62e48c55193 to your computer and use it in GitHub Desktop.
package io.hypertrack.htdemo;
import com.hypertrack.android.sdk.base.network.HyperTrack;
import com.hypertrack.android.sdk.base.view.HTMapFragment;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
public class DemoActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_demo);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction().add(R.id.container, new PlaceholderFragment()).commit();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.demo, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {
public PlaceholderFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_demo, container, false);
HTMapFragment htMapFragment =
(HTMapFragment) getChildFragmentManager().findFragmentById(R.id.htMapfragment);
HyperTrack.setApiKey(<SET YOUR API KEY HERE>);
htMapFragment.updateOrder("2");
return rootView;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment