private void createAdView() {
   adView = new AdView(this, AdSize.BANNER, AdMob_Ad_Unit);
   LinearLayout layout = (LinearLayout) findViewById(R.id.mainLinear);
   layout.addView(adView, 0);
   AdRequest request = new AdRequest();
   request.addTestDevice(request.TEST_EMULATOR);
   request.addTestDevice("00194a163e3f5e");
   adView.loadAd(request);
 }
示例#2
0
 private void admobs() {
   AdView adview = (AdView) findViewById(R.id.adView);
   AdRequest request = new AdRequest();
   request.addTestDevice(AdRequest.TEST_EMULATOR);
   //		String imei = AndroidUtils.getIMEI(this);
   // nexus s
   request.addTestDevice("355031040408409");
   // request.addKeyword("android");
   // request.addKeyword("game");
   adview.loadAd(request);
 }
示例#3
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.main);
    AdRequest ar = new AdRequest();
    ar.addTestDevice("4B605421C6EAA120E18B7FA165D2E980");

    final ListView lv1 = (ListView) findViewById(R.id.listView);
    threadArray = new ArrayList<String>();
    authorArray = new ArrayList<String>();

    getDevice();

    lv1.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> a, View v, int position, long id) {
            Object o = lv1.getItemAtPosition(position);
            TitleResults fullObject = (TitleResults) o;
            threadTitle = fullObject.getItemName();
            Constants.THREADURL = threadArray.get(position);
            Intent intent = new Intent(MainActivity.this, ThreadActivity.class);
            Bundle b = new Bundle();
            b.putString("title", threadTitle);
            intent.putExtras(b);
            startActivity(intent);
          }
        });

    if (Constants.DEVICE != null) {
      ArrayList<TitleResults> titleArray = getTitles();
      lv1.setAdapter(new TitleAdapter(this, titleArray));
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    adView = new AdView(this, AdSize.SMART_BANNER, "a152f84b0f4f9ed");
    LinearLayout adContainer = (LinearLayout) this.findViewById(R.id.adsContainer);
    adContainer.addView(adView);

    AdRequest adRequest = new AdRequest();
    Set<String> keywordsSet = new HashSet<String>();
    keywordsSet.add("game");
    keywordsSet.add("dating");
    keywordsSet.add("money");
    keywordsSet.add("girl");
    adRequest.addKeywords(keywordsSet);
    adRequest.addTestDevice("1B91DF7A13E674202332C251084C3ADA");
    adView.loadAd(adRequest);

    imageView = (ImageView) this.findViewById(R.id.imageView1);

    progressDialog = new ProgressDialog(this);
    progressDialog.setTitle("Download Image");
    progressDialog.setMessage("Downloading in progress...");
    progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    progressDialog.setProgress(0);
    progressDialog.setButton(
        DialogInterface.BUTTON_NEGATIVE, "Show Image", dialogInterfaceOnClickListener);

    Button downloadButton = (Button) findViewById(R.id.downloadButton);
    downloadButton.setOnClickListener(downloadButtonOnClickListener);
  }
示例#5
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.chart);

    // request TEST ads to avoid being disabled for clicking your own ads
    AdRequest adRequest = new AdRequest();

    // test mode on EMULATOR
    adRequest.addTestDevice(AdRequest.TEST_EMULATOR);

    // test mode on DEVICE (this example code must be replaced with your device uniquq ID)
    adRequest.addTestDevice("MB120RT82011");
    adRequest.addTestDevice("TA23703EIP");

    adView = (AdView) findViewById(R.id.adMob);

    // Wenn ein TrackingService läuft, soll der Zugriff auf die Datenbank unterbunden werden, da
    // es sonst zu einem Programmabsturz kommt.
    if (RouteTrackingDialog.isMyServiceRunning(
        "de.myge.routetracking.GpsTrackingService", getApplicationContext())) {
      ErrorHandling.showError(
          getApplicationContext(), getResources().getString(R.string.error_visualise_routes));
    } else {
      // Datenbankzugriff holen, damit das Geschwindigkeitschart zu einem Profil geladen werden kann
      db = new CreateDatabase(this);

      // Spinner initialisieren. Dieser Spinner dient der Auswahl der getrackten Routen.
      final Spinner spinner = (Spinner) findViewById(R.id.routes_charts);

      spinner.setOnItemSelectedListener(
          new OnItemSelectedListener() {

            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
              String item = (String) parent.getItemAtPosition(pos);

              // Index ist die ID des Profils, das Ausgewählt wurde
              int index = 0;
              for (int i = 0; i < profiles.size(); i++) {
                if (profiles.get(i).getProfileName().equals(item)) {
                  index = profiles.get(i).getId();
                  break;
                }
              }

              List<GpsCoordinates> gpsCoord;
              try {
                //					gpsCoord = db.getCoordinatesDao().queryBuilder().where().eq("profile_id",
                // index).query();
                QueryBuilder<GpsCoordinates, Integer> qb = db.getCoordinatesDao().queryBuilder();
                qb.where().eq("profile_id", index);
                qb.orderBy("timestamp", true);
                gpsCoord = qb.query();
                if (gpsCoord.size() > 0) {
                  ArrayList<GraphViewData> graphViewData = new ArrayList<GraphView.GraphViewData>();
                  for (int i = 0; i < gpsCoord.size(); i++) {
                    if (de.myge.routetracking.settings.Settings.getInstance(ChartActivity.this)
                        .isSpeedInKmh()) {
                      graphViewData.add(new GraphViewData(i, gpsCoord.get(i).getSpeed() * 3.6f));
                    } else {
                      graphViewData.add(
                          new GraphViewData(i, gpsCoord.get(i).getSpeed() * 3.6f * 0.6213712f));
                    }
                  }

                  // init example series data
                  GraphViewSeries exampleSeries =
                      new GraphViewSeries(
                          graphViewData.toArray(new GraphViewData[graphViewData.size()]));

                  GraphView graphView =
                      new LineGraphView(
                          ChartActivity.this // context
                          ,
                          item // heading
                          );

                  Date start = gpsCoord.get(0).getTimestamp();
                  Date end = gpsCoord.get(gpsCoord.size() - 1).getTimestamp();

                  SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy hh:mm");

                  graphView.setHorizontalLabels(new String[] {sdf.format(start), sdf.format(end)});

                  graphView.addSeries(exampleSeries);
                  graphView.setScrollable(true);
                  graphView.setScalable(true);
                  LinearLayout layout = (LinearLayout) findViewById(R.id.chartLayout);
                  layout.removeAllViews();
                  layout.addView(spinner);
                  layout.addView(graphView);
                }
              } catch (SQLException e) {
                ErrorHandling.showError(getApplicationContext(), e);
              }
            }

            @Override
            public void onNothingSelected(AdapterView<?> arg0) {
              // TODO Auto-generated method stub

            }
          });

      try {
        // Alle Routen auflisten
        profiles = db.getProfileCoordinatesDao().queryForAll();
        // Routennamen in ein Array packen, damit die Routennamen dem Spinner zur Auwahl übergeben
        // werden können
        String profileNames[] = new String[profiles.size()];
        for (int i = 0; i < profiles.size(); i++) {
          profileNames[i] = profiles.get(i).getProfileName();
        }

        ArrayAdapter<String> adapter =
            new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, profileNames);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spinner.setAdapter(adapter);
      } catch (SQLException e) {
        ErrorHandling.showError(getApplicationContext(), e);
      }
    }
  }