My App crashes when I try to use a class

Jobse28Jobse28 DEMember ✭✭
edited March 2015 in Xamarin.Android

Hello everyone I have got a problem with my project.
I call my class from the MainActivity like this

LLST.Click += delegate {
If (textbox.text=="")
{
SetContentView(Resource.Layout.web);
WebView loader = FindViewById (Resource.Id.Web);
Load n = new Load();
n.Lade(loader);
}
};

Class :
using System;

using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using Android.Webkit;
using System.Net;
using Android.Views.InputMethods;
using System.Collections.Generic;
using Android.Text;
using System.Web.Services;
using System.Threading;

namespace XXX

{
public class Load
{
public void Lade (WebView loader)
{
uri = XXX
password = XXX

Dictionary<string, string> passwordParameters = new Dictionary<string, string> ();
passwordParameters.Add ("contentpassword_password", password);

        CookieAwareWebClient webClient = new CookieAwareWebClient ();
        string content = webClient.post (uri, passwordParameters);

        // Ermittle den Anfang des Beitragtexts
        int startIndex = content.IndexOf ("<h2");           
        if (startIndex < 0) {
            startIndex = 0;
        }
        // Ermittle das Ende des Beitragtexts
        int endIndex = content.IndexOf ("<div class=\"footerBoxes\">", startIndex);
        if (endIndex < 0) {
            endIndex = content.Length;
        }
        // Laenge des Beitrags berechnen...
        int length = endIndex - startIndex;
        // ... und den Beitrag ausschneiden
        string article = content.Substring (startIndex, endIndex - startIndex);
        // Schliesslich in unsere HTML-Huelle einfuegen
        string result = "<html><head><style type=\"text/css\">.clearfix { visibility: hidden; display: none; }</style></head><body>" + article + "</body></html>";

loader.LoadDataWithBaseURL (uri, result, "text/html", "UTF-8", null);

              } 

}

Sign In or Register to comment.