Abstract Class issue in androidmanifest.xml


Last Updated:

  1. paul72

    paul72 Member This Topic's Starter

    Joined:
    Jul 20, 2010
    Messages:
    10
    Likes Received:
    0
    I'm working on an app that will browse to a web page. I am using an abstract class to get this done but I can't resolve an error I'm getting in the manifest.xml file.

    This project is named myblogapp and it uses 2 java files in the src folder. Here is the myblogapp.java file:

    package com.blueharvest.myblogapp;

    import java.util.SortedMap;
    import java.util.TreeMap;
    import android.app.ListActivity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.ArrayAdapter;
    import android.widget.ListView;
    public abstract class myblogapp extends ListActivity {
    private SortedMap<String, Object> actions = new TreeMap<String, Object>();
    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
    String key = (String) l.getItemAtPosition(position);
    startActivity((Intent) actions.get(key));
    }

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    prepareMenu();
    String[] keys = actions.keySet().toArray(
    new String[actions.keySet().size()]);
    setListAdapter(new ArrayAdapter<String>(this,
    android.R.layout.simple_list_item_1, keys));
    }

    public void addMenuItem(String label, Class<?> cls){
    actions.put(label, new Intent(this, cls ));
    }

    abstract void prepareMenu();
    }

    *************************here is the webview.java file:*******

    package com.blueharvest.myblogapp;
    import android.app.Activity;
    import android.graphics.Bitmap;
    import android.graphics.drawable.BitmapDrawable;
    import android.os.Bundle;
    import android.view.View;
    import android.view.animation.Animation;
    import android.view.animation.AnimationUtils;
    import android.webkit.WebChromeClient;
    import android.webkit.WebView;
    import android.webkit.WebViewClient;
    import android.widget.Button;
    import android.widget.EditText;
    import android.widget.ImageSwitcher;
    import android.widget.ImageView;
    import android.widget.TextSwitcher;
    import android.widget.TextView;
    import android.widget.ViewSwitcher;
    import android.widget.Gallery.LayoutParams;
    public class WebViewDemo extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.web);

    final TextSwitcher pageTitle = (TextSwitcher)findViewById(R.id.pagetitle);
    pageTitle.setFactory(new ViewSwitcher.ViewFactory() {
    public View makeView() {
    TextView tv = new TextView(WebViewDemo.this);
    tv.setLayoutParams(new TextSwitcher.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

    return tv;
    }

    });

    final ImageSwitcher favImage = (ImageSwitcher)findViewById(R.id.favicon);
    favImage.setFactory(new ViewSwitcher.ViewFactory() {
    public View makeView() {
    ImageView iv = new ImageView(WebViewDemo.this);
    iv.setBackgroundColor(0xFF000000);
    iv.setScaleType(ImageView.ScaleType.FIT_CENTER);
    iv.setLayoutParams(new ImageSwitcher.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
    return iv;
    }

    });
    Animation in = AnimationUtils.loadAnimation(this, android.R.anim.slide_in_left);
    Animation out = AnimationUtils.loadAnimation(this, android.R.anim.slide_out_right);
    favImage.setInAnimation(in);
    favImage.setOutAnimation(out);
    pageTitle.setInAnimation(in);
    pageTitle.setOutAnimation(out);



    final EditText et = (EditText) findViewById(R.id.url);
    final WebView wv = (WebView) findViewById(R.id.web_holder);
    wv.loadUrl("Google");
    Button go = (Button) findViewById(R.id.go_button);
    go.setOnClickListener(new View.OnClickListener() {
    public void onClick(View v) {
    wv.loadUrl(et.getText().toString());
    }
    });
    WebViewClient webClient = new WebViewClient() {
    @Override
    public void onPageFinished(WebView view, String url) {
    super.onPageFinished(view, url);

    String title = wv.getTitle();
    pageTitle.setText(title);

    }

    };



    //
    WebChromeClient webChrome = new WebChromeClient() {

    @Override
    public void onReceivedIcon(WebView view, Bitmap icon) {
    super.onReceivedIcon(view, icon);
    favImage.setImageDrawable(new BitmapDrawable(icon));
    }
    };

    wv.setWebViewClient(webClient);
    wv.setWebChromeClient(webChrome);
    wv.setInitialScale(30);
    }
    }


    *****************Finally, this is the manifest file I have**********
    <?xml version="1.0" encoding="utf-8"?>
    <manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.blueharvest.myblogapp"
    android:versionCode="1"
    android:versionName="1.0">
    <application
    android:icon="@drawable/icon"
    android:label="@string/app_name"
    android:debuggable="true">
    <activity
    android:name=".myblogapp"
    android:label="@string/app_name">
    <intent-filter>
    <action
    android:name="android.intent.action.MAIN" />
    <category
    android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    </activity>
    <activity
    android:name="WebView" />
    </application>
    <uses-permission
    android:name="android.permission.INTERNET" />
    <uses-permission
    android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-sdk android:minSdkVersion="3" />
    </manifest>


    I'm getting an error on the Manifest file by the "android:label" text that reads "com.blueharvest.myblogapp.myblogapp is an abstract"

    Any thoughts?
     

    Advertisement
  2. paul72

    paul72 Member This Topic's Starter

    Joined:
    Jul 20, 2010
    Messages:
    10
    Likes Received:
    0
    Please disregard, I found a different solution.
     

Share This Page

Loading...